Class: TinCanApi::Verb
- Inherits:
-
Object
- Object
- TinCanApi::Verb
- Defined in:
- lib/tin_can_api/verb.rb
Instance Attribute Summary collapse
-
#display ⇒ Object
Returns the value of attribute display.
-
#id ⇒ Object
Returns the value of attribute id.
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ Verb
constructor
A new instance of Verb.
- #serialize(version) ⇒ Object
Constructor Details
#initialize(options = {}, &block) ⇒ Verb
Returns a new instance of Verb.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/tin_can_api/verb.rb', line 7 def initialize(={}, &block) json = .fetch(:json, nil) if json attributes = JSON.parse(json) self.id = attributes['id'] if attributes['id'] self.display = attributes['display'] if attributes['display'] else self.id = .fetch(:id, nil) self.display = .fetch(:display, nil) if block_given? block[self] end end end |
Instance Attribute Details
#display ⇒ Object
Returns the value of attribute display.
5 6 7 |
# File 'lib/tin_can_api/verb.rb', line 5 def display @display end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/tin_can_api/verb.rb', line 5 def id @id end |
Instance Method Details
#serialize(version) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/tin_can_api/verb.rb', line 27 def serialize(version) node = {} node['id'] = id.to_s if id node['display'] = display if display node end |