Class: GoodData::Fact
- Inherits:
-
MdObject
- Object
- Rest::Object
- Rest::Resource
- MdObject
- GoodData::Fact
- Includes:
- Mixin::IsFact
- Defined in:
- lib/gooddata/models/metadata/fact.rb
Constant Summary collapse
- FACT_BASE_AGGREGATIONS =
TODO: verify that we have all (which we do not right now)
[:sum, :min, :max, :avg, :median, :runsum, :runmin, :runmax, :runavg, :runstdev, :runstdevp, :runvar, :runvarp, :stdev, :stdevp, :var, :varp]
Constants inherited from MdObject
MdObject::IDENTIFIERS_CFG, MdObject::MD_OBJ_CTG
Constants included from Mixin::MdIdToUri
Mixin::MdIdToUri::IDENTIFIERS_CFG
Constants included from Mixin::MdObjectIndexer
Mixin::MdObjectIndexer::MD_OBJ_CTG
Constants included from Mixin::MdObjectQuery
Mixin::MdObjectQuery::ERROR_MESSAGE_NO_PROJECT
Instance Attribute Summary
Attributes inherited from Rest::Object
Class Method Summary collapse
-
.all(options = { :client => GoodData.connection, :project => GoodData.project }) ⇒ Array<GoodData::MdObject> | Array<Hash>
Method intended to get all objects of that type in a specified project.
Instance Method Summary collapse
-
#create_metric(options = { :type => :sum }) ⇒ GoodData::Metric
(also: #create_measure)
Creates the basic count metric with the fact used.
Methods included from Mixin::IsFact
Methods inherited from MdObject
#==, #add_tag, #browser_uri, #delete, #deprecated, #deprecated=, find_replaceable_values, #get_flag?, #initialize, #listed?, #production, #production=, #project, #reload!, #remove_tag, replace, #replace, #replace!, replace_bracketed, replace_quoted, #restricted, #restricted=, #save, #save_as, #set_flag, #tag_set, #unlisted, #unlisted=, #validate
Methods included from Mixin::MdIdToUri
Methods included from Mixin::MdObjectIndexer
Methods included from Mixin::MdObjectQuery
#all, #dependency, #dependency?, #query, #usedby, #usedby?, #using, #using?
Methods included from Mixin::MdFinders
#find_by_identifier, #find_by_tag, #find_by_title, #find_first_by_identifier, #find_first_by_title
Methods included from Mixin::MdObjId
Methods included from Mixin::MdGrantees
#change_permission, #grant, #grantees, #revoke
Methods included from Mixin::MdRelations
#dependency, #dependency?, #usedby, #usedby?, #using, #using?
Methods included from Mixin::ObjId
Methods included from Mixin::Links
Methods inherited from Rest::Resource
Methods inherited from Rest::Object
client, default_client, #initialize, #saved?
Methods included from Mixin::DataPropertyReader
Methods included from Mixin::DataPropertyWriter
Methods included from Mixin::MetaPropertyReader
Methods included from Mixin::MetaPropertyWriter
Methods included from Mixin::MetaGetter
Methods included from Mixin::DataGetter
Methods included from Mixin::RootKeyGetter
Methods included from Mixin::ContentGetter
Constructor Details
This class inherits a constructor from GoodData::MdObject
Class Method Details
.all(options = { :client => GoodData.connection, :project => GoodData.project }) ⇒ Array<GoodData::MdObject> | Array<Hash>
Method intended to get all objects of that type in a specified project
to pull in full objects. This is desirable from the usability POV but unfortunately has negative impact on performance so it is not the default.
29 30 31 |
# File 'lib/gooddata/models/metadata/fact.rb', line 29 def all( = { :client => GoodData.connection, :project => GoodData.project }) query('fact', Fact, ) end |
Instance Method Details
#create_metric(options = { :type => :sum }) ⇒ GoodData::Metric Also known as: create_measure
Creates the basic count metric with the fact used. The metric created is not saved.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/gooddata/models/metadata/fact.rb', line 38 def create_metric( = { :type => :sum }) a_type = [:type] || :sum unless FACT_BASE_AGGREGATIONS.include?(a_type) fail "Suggested aggreagtion function (#{a_type}) does not exist for " / 'base metric created out of fact. You can use only one of ' / "#{FACT_BASE_AGGREGATIONS.map { |x| ':' + x.to_s }.join(',')}" end a_title = [:title] || "#{a_type} of #{title}" project.create_metric("SELECT #{a_type.to_s.upcase}([#{uri}])", title: a_title, extended_notation: false) end |