class GoodData::Folder
Public Class Methods
all(options = { :client => GoodData.connection, :project => GoodData.project })
click to toggle source
Method intended to get all objects of that type in a specified project
@param options [Hash] the options hash @option options [Boolean] :full 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. @return [Array<GoodData::MdObject> | Array<Hash>] Return the appropriate metadata objects or their representation
# File lib/gooddata/models/metadata/folder.rb, line 26 def all(options = { :client => GoodData.connection, :project => GoodData.project }) query('folder', Folder, options) end
create(opts)
click to toggle source
# File lib/gooddata/models/metadata/folder.rb, line 30 def create(opts) title = opts[:title] summary = opts[:summary] || '' type = opts[:type] || 'fact' folder = { 'folder' => { 'content' => { 'type' => Array(type) }, 'meta' => { 'tags' => '', 'summary' => summary, 'title' => title } } } client, project = GoodData.get_client_and_project(opts) client.create(Folder, folder, project: project) end
Public Instance Methods
entries()
click to toggle source
# File lib/gooddata/models/metadata/folder.rb, line 53 def entries (json['folder']['content']['entries'] || []).pmap do |entry| res = case json['folder']['content']['type'].first when 'fact' GoodData::Fact[entry['link'], :client => client, :project => project] when 'metric' GoodData::Metric[entry['link'], :client => client, :project => project] else GoodData::MdObject[entry['link'], :client => client, :project => project] end res end end
type()
click to toggle source
# File lib/gooddata/models/metadata/folder.rb, line 67 def type json['folder']['content']['type'][0] end