class GoodData::Dashboard
Constants
- ASSIGNABLE_MEMBERS
- EMPTY_OBJECT
Public Class Methods
Source
# File lib/gooddata/models/metadata/dashboard.rb, line 54 def all(options = { :client => GoodData.connection, :project => GoodData.project }) query('projectDashboard', Dashboard, options) end
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
Source
# File lib/gooddata/models/metadata/dashboard.rb, line 58 def create(dashboard = {}, options = { :client => GoodData.client, :project => GoodData.project }) client, project = GoodData.get_client_and_project(GoodData::Helpers.symbolize_keys(options)) res = client.create(Dashboard, GoodData::Helpers.deep_dup(GoodData::Helpers.stringify_keys(EMPTY_OBJECT)), :project => project) dashboard.each do |k, v| res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k end res end
Public Instance Methods
Source
# File lib/gooddata/models/metadata/dashboard.rb, line 69 def add_tab(tab) new_tab = GoodData::DashboardTab.create(self, tab) content['tabs'] << new_tab.json new_tab end
Source
# File lib/gooddata/models/metadata/dashboard.rb, line 81 def export(format, options = {}) supported_formats = [:pdf] fail "Wrong format provied \"#{format}\". Only supports formats #{supported_formats.join(', ')}" unless supported_formats.include?(format) tab = options[:tab] || '' req_uri = "/gdc/projects/#{project.pid}/clientexport" x = client.post( req_uri, 'clientExport' => { 'url' => "#{client.connection.server_url}/dashboard.html#project=" \ "#{project.uri}&dashboard=#{uri}&tab=#{tab}&export=1", 'name' => title } ) client.poll_on_code(x['asyncTask']['link']['poll'], options.merge(process: false)) end
Source
# File lib/gooddata/models/metadata/dashboard.rb, line 77 def exportable? true end
Source
# File lib/gooddata/models/metadata/dashboard.rb, line 104 def replace(mapping) x = GoodData::MdObject.replace_quoted(self, mapping) vals = GoodData::MdObject.find_replaceable_values(self, mapping) GoodData::MdObject.replace_quoted(x, vals) end
Method used for replacing values in their state according to mapping. Can be used to replace any values but it is typically used to replace the URIs. Returns a new object of the same type.
@param [Array<Array>]Mapping specifying what should be exchanged for what. As mapping should be used output of GoodData::Helpers.prepare_mapping
. @return [GoodData::Dashboard]
Source
# File lib/gooddata/models/metadata/dashboard.rb, line 110 def tabs content['tabs'].map do |tab| GoodData::DashboardTab.new(self, tab) end end
Source
# File lib/gooddata/models/metadata/dashboard.rb, line 116 def tabs_ids tabs.map { |t| t['identifier'] } end