Class: GoodData::TextItem

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

Constant Summary collapse

EMPTY_OBJECT =
{
  'textItem' => {
    'positionX' => 0,
    'sizeY' => 200,
    'sizeX' => 300,
    'positionY' => 0
  }
}
ASSIGNABLE_MEMBERS =
DashboardItem::ASSIGNABLE_MEMBERS + [
  :text,
  :text_size
]

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) ⇒ TextItem

Returns a new instance of TextItem.



35
36
37
# File 'lib/gooddata/models/metadata/dashboard/text_item.rb', line 35

def initialize(tab, json)
  super
end

Class Method Details

.create(tab, item) ⇒ Object



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

def create(tab, item)
  res = GoodData::TextItem.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

#textObject



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

def text
  data['text']
end

#text=(new_text) ⇒ Object



43
44
45
# File 'lib/gooddata/models/metadata/dashboard/text_item.rb', line 43

def text=(new_text)
  data['text'] = new_text
end

#text_sizeObject



47
48
49
# File 'lib/gooddata/models/metadata/dashboard/text_item.rb', line 47

def text_size
  data['textSize']
end

#text_size=(new_text_size) ⇒ Object



51
52
53
# File 'lib/gooddata/models/metadata/dashboard/text_item.rb', line 51

def text_size=(new_text_size)
  data['textSize'] = new_text_size
end