Class: UU::OS::Content::Component
- Inherits:
-
ContentClient
- Object
- ContentClient
- UU::OS::Content::Component
- Defined in:
- lib/uu/os/content/component.rb
Class Method Summary collapse
-
.create(sheet_uri, dto = nil) ⇒ Object
#create convenience self-instantiating shortcut.
-
.delete(sheet_uri, component_id) ⇒ Object
#delete convinience self-instantiating shortcut.
-
.get_attributes(sheet_uri, component_id) ⇒ Object
#get_attributes convenience self-instantiating shortcut.
-
.get_data(sheet_uri, component_id) ⇒ Object
#get_data convenience self-instantiating shortcut.
-
.set_attributes(sheet_uri, component = nil) ⇒ Object
#set_attributes convenience self-instantiating shortcut.
-
.set_constraints(sheet_uri, constraints = nil) ⇒ Object
#set_constraints convenience self-instantiating shortcut.
-
.set_data(sheet_uri, data = nil) ⇒ Object
#set_data convinience self-instantiating shortcut.
Instance Method Summary collapse
-
#create(sheet_uri, component = nil) ⇒ String
Creates the component in a given column.
-
#delete(sheet_uri, component_id) ⇒ Object
Removes the given component from the content structure.
-
#get_attributes(sheet_uri, component_id) ⇒ Hash
Retrieves the attributes of the given component.
-
#get_data(sheet_uri, data) ⇒ Array<Hash>, BinaryValue
Retrieves the data of the given component.
-
#initialize(session) ⇒ Component
constructor
Creates a new instance of
Component
. -
#set_attributes(sheet_uri, component = nil) ⇒ String
Updates basic attributes of the specified component.
-
#set_constraints(sheet_uri, constraints = nil) ⇒ Object
Sets constraints on the component.
-
#set_data(sheet_uri, data = nil) ⇒ Object
Modifies data of the given component.
Constructor Details
Class Method Details
.create(sheet_uri, dto = nil) ⇒ Object
#create convenience self-instantiating shortcut
49 50 51 52 |
# File 'lib/uu/os/content/component.rb', line 49 def self.create(sheet_uri, dto = nil) session = UU::OS::Security::Session.current_session self.new(session).create(sheet_uri, dto) end |
.delete(sheet_uri, component_id) ⇒ Object
#delete convinience self-instantiating shortcut
67 68 69 70 |
# File 'lib/uu/os/content/component.rb', line 67 def self.delete(sheet_uri, component_id) session = UU::OS::Security::Session.current_session self.new(session).delete(sheet_uri, component_id) end |
.get_attributes(sheet_uri, component_id) ⇒ Object
#get_attributes convenience self-instantiating shortcut
105 106 107 108 |
# File 'lib/uu/os/content/component.rb', line 105 def self.get_attributes(sheet_uri, component_id) session = UU::OS::Security::Session.current_session self.new(session).get_attributes(sheet_uri, component_id) end |
.get_data(sheet_uri, component_id) ⇒ Object
#get_data convenience self-instantiating shortcut
131 132 133 134 |
# File 'lib/uu/os/content/component.rb', line 131 def self.get_data(sheet_uri, component_id) session = UU::OS::Security::Session.current_session self.new(session).get_data(sheet_uri, component_id) end |
.set_attributes(sheet_uri, component = nil) ⇒ Object
#set_attributes convenience self-instantiating shortcut
157 158 159 160 |
# File 'lib/uu/os/content/component.rb', line 157 def self.set_attributes(sheet_uri, component = nil) session = UU::OS::Security::Session.current_session self.new(session).set_attributes(sheet_uri, component) end |
.set_constraints(sheet_uri, constraints = nil) ⇒ Object
#set_constraints convenience self-instantiating shortcut
181 182 183 184 |
# File 'lib/uu/os/content/component.rb', line 181 def self.set_constraints(sheet_uri, constraints = nil) session = UU::OS::Security::Session.current_session self.new(session).set_constraints(sheet_uri , constraints) end |
Instance Method Details
#create(sheet_uri, component = nil) ⇒ String
Creates the component in a given column. The type of the component should be specified. The data of the component can be set using a corresponding command set_data.
43 44 45 46 |
# File 'lib/uu/os/content/component.rb', line 43 def create(sheet_uri, component = nil) res = @cmd.invoke("Component/create", sheet_uri, prepare_params(component)) return res end |
#delete(sheet_uri, component_id) ⇒ Object
Removes the given component from the content structure.
62 63 64 |
# File 'lib/uu/os/content/component.rb', line 62 def delete(sheet_uri, component_id) @cmd.invoke("Component/delete", sheet_uri, prepare_params(component_id)) end |
#get_attributes(sheet_uri, component_id) ⇒ Hash
Retrieves the attributes of the given component.
100 101 102 |
# File 'lib/uu/os/content/component.rb', line 100 def get_attributes(sheet_uri, component_id) transform(@cmd.invoke('Component/getAttributes', sheet_uri, prepare_params(component_id))) #, invocation_method: 'get') end |
#get_data(sheet_uri, data) ⇒ Array<Hash>, BinaryValue
Retrieves the data of the given component. The data format is defined by the component type.
125 126 127 128 |
# File 'lib/uu/os/content/component.rb', line 125 def get_data(sheet_uri, data) res = @cmd.invoke('Component/getData', sheet_uri, prepare_params(data)) #, invocation_method: 'get') return res end |
#set_attributes(sheet_uri, component = nil) ⇒ String
Updates basic attributes of the specified component.
151 152 153 154 |
# File 'lib/uu/os/content/component.rb', line 151 def set_attributes(sheet_uri, component = nil) res = @cmd.invoke('Component/setAttributes', sheet_uri, prepare_params(component)) return res end |
#set_constraints(sheet_uri, constraints = nil) ⇒ Object
Sets constraints on the component.
176 177 178 |
# File 'lib/uu/os/content/component.rb', line 176 def set_constraints(sheet_uri, constraints = nil) @cmd.invoke('Component/setConstraints', sheet_uri, prepare_params(constraints)) end |
#set_data(sheet_uri, data = nil) ⇒ Object
Modifies data of the given component. Data should be in a valid format, defined by the component.
202 203 204 205 |
# File 'lib/uu/os/content/component.rb', line 202 def set_data(sheet_uri, data = nil) @cmd.invoke('Component/setData', sheet_uri, prepare_params(data)) return nil end |