Class: Gaah::Resource::Resource
- Defined in:
- lib/gaah/resource/resource.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from ApiModel
Instance Method Summary collapse
-
#initialize(xml) ⇒ Resource
constructor
A new instance of Resource.
- #marshal_dump ⇒ Object
- #marshal_load(array) ⇒ Object
- #to_json(*args) ⇒ Object
Methods inherited from ApiModel
Constructor Details
#initialize(xml) ⇒ Resource
Returns a new instance of Resource.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/gaah/resource/resource.rb', line 6 def initialize(xml) store_xml(xml) @id = inner_text(:id) (@xml/'apps|property').each do |property| case property.attributes['name'].value when 'resourceCommonName' then @name = property.attributes['value'].value when 'resourceEmail' then @email = property.attributes['value'].value when 'resourceType' then @type = property.attributes['value'].value end end end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
4 5 6 |
# File 'lib/gaah/resource/resource.rb', line 4 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/gaah/resource/resource.rb', line 4 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/gaah/resource/resource.rb', line 4 def type @type end |
Instance Method Details
#marshal_dump ⇒ Object
28 29 30 |
# File 'lib/gaah/resource/resource.rb', line 28 def marshal_dump [@id, @name, @email, @type] end |
#marshal_load(array) ⇒ Object
32 33 34 |
# File 'lib/gaah/resource/resource.rb', line 32 def marshal_load(array) @id, @name, @email, @type = array end |
#to_json(*args) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/gaah/resource/resource.rb', line 19 def to_json(*args) { id: @id, name: @name, email: @email, type: @type, }.to_json end |