Class: GoodData::HeadlineItem

Inherits:
DashboardItem show all
Defined in:
lib/gooddata/models/metadata/dashboard/headline_item.rb

Constant Summary collapse

EMPTY_OBJECT =
{
  'headlineItem' => {
    'positionX' => 0,
    'sizeY' => 200,
    'sizeX' => 300,
    'positionY' => 0
  }
}
ASSIGNABLE_MEMBERS =
DashboardItem::ASSIGNABLE_MEMBERS + [
  :id,
  :metric,
  :linked_with_external_filter
]

Instance Attribute Summary

Attributes inherited from DashboardItem

#json, #tab

Attributes inherited from Rest::Object

#client, #json, #project

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DashboardItem

#filters, #filters=, #position_x, #position_x=, #position_y, #position_y=, #size_x, #size_x=, #size_y, #size_y=

Methods included from Mixin::ObjId

#obj_id

Methods inherited from Rest::Object

client, default_client, #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

#initialize(tab, json) ⇒ HeadlineItem

Returns a new instance of HeadlineItem.



36
37
38
# File 'lib/gooddata/models/metadata/dashboard/headline_item.rb', line 36

def initialize(tab, json)
  super
end

Class Method Details

.create(tab, item) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/gooddata/models/metadata/dashboard/headline_item.rb', line 27

def create(tab, item)
  res = GoodData::HeadlineItem.new(tab, GoodData::Helpers.deep_dup(GoodData::Helpers.stringify_keys(EMPTY_OBJECT)))
  item.each do |k, v|
    res.send("#{k}=", v) if ASSIGNABLE_MEMBERS.include? k
  end
  res
end

Instance Method Details

#linked_with_external_filterObject



48
49
50
# File 'lib/gooddata/models/metadata/dashboard/headline_item.rb', line 48

def linked_with_external_filter
  data['linkedWithExternalFilter']
end

#linked_with_external_filter=(new_linked_with_external_filter) ⇒ Object



52
53
54
# File 'lib/gooddata/models/metadata/dashboard/headline_item.rb', line 52

def linked_with_external_filter=(new_linked_with_external_filter)
  data['linked_with_external_filter'] = new_linked_with_external_filter ? 1 : 0
end

#metricObject



40
41
42
# File 'lib/gooddata/models/metadata/dashboard/headline_item.rb', line 40

def metric
  data['metric']
end

#metric=(new_metric) ⇒ Object



44
45
46
# File 'lib/gooddata/models/metadata/dashboard/headline_item.rb', line 44

def metric=(new_metric)
  data['metric'] = new_metric.respond_to?(:uri) ? new_metric.uri : new_metric
end