Class: GoodData::Dataset

Inherits:
MdObject show all
Defined in:
lib/gooddata/models/metadata/dataset.rb

Constant Summary

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

Instance Attribute Summary

Attributes inherited from Rest::Object

#client, #json, #project

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MdObject

#==, #add_tag, #browser_uri, #delete, #deprecated, #deprecated=, find_replaceable_values, #initialize, #listed?, #project, #reload!, #remove_tag, replace, #replace, #replace!, replace_bracketed, replace_quoted, #save, #save_as, #tag_set, #unlisted, #unlisted=, #validate

Methods included from Mixin::MdIdToUri

#identifier_to_uri

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

#uri_obj_id

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

#obj_id

Methods included from Mixin::Links

#links

Methods inherited from Rest::Resource

#initialize

Methods inherited from Rest::Object

client, default_client, #initialize, #saved?

Methods included from Mixin::DataPropertyReader

#data_property_reader

Methods included from Mixin::DataPropertyWriter

#data_property_writer

Methods included from Mixin::MetaPropertyReader

#metadata_property_reader

Methods included from Mixin::MetaPropertyWriter

#metadata_property_writer

Methods included from Mixin::MetaGetter

#meta

Methods included from Mixin::DataGetter

#data

Methods included from Mixin::RootKeyGetter

#root_key

Methods included from Mixin::ContentGetter

#content

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

Parameters:

  • options (Hash) (defaults to: { :client => GoodData.connection, :project => GoodData.project })

    the options hash

Options Hash (options):

  • :full (Boolean)

    if passed true the subclass can decide 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

Returns:

  • (Array<GoodData::MdObject> | Array<Hash>)

    Return the appropriate metadata objects or their representation



17
18
19
# File 'lib/gooddata/models/metadata/dataset.rb', line 17

def all(options = { :client => GoodData.connection, :project => GoodData.project })
  query('dataSet', Dataset, options)
end

Instance Method Details

#attribute_urisArray<String>

Gives you list of attribute uris on a dataset

Returns:

  • (Array<String>)


32
33
34
# File 'lib/gooddata/models/metadata/dataset.rb', line 32

def attribute_uris
  content['attributes']
end

#attributesArray<GoodData::Attribute>

Gives you list of attributes on a dataset

Returns:



25
26
27
# File 'lib/gooddata/models/metadata/dataset.rb', line 25

def attributes
  attribute_uris.pmap { |a_uri| project.attributes(a_uri) }
end

#date_dimension?Boolean

Tells you if a dataset is a date dimension. This is done by looking at the attributes and inspecting their identifiers.

Returns:

  • (Boolean)


54
55
56
# File 'lib/gooddata/models/metadata/dataset.rb', line 54

def date_dimension?
  attributes.all?(&:date_attribute?) && fact_uris.empty?
end

#fact_urisArray<String>

Gives you list of fact uris on a dataset

Returns:

  • (Array<String>)


46
47
48
# File 'lib/gooddata/models/metadata/dataset.rb', line 46

def fact_uris
  content['facts']
end

#factsArray<GoodData::Fact>

Gives you list of facts on a dataset

Returns:



39
40
41
# File 'lib/gooddata/models/metadata/dataset.rb', line 39

def facts
  fact_uris.pmap { |a_uri| project.facts(a_uri) }
end

#synchronizeObject Also known as: delete_data

Delete the data in a dataset



59
60
61
# File 'lib/gooddata/models/metadata/dataset.rb', line 59

def synchronize
  project.execute_maql("SYNCHRONIZE {#{identifier}}")
end