Class: TinCanApi::AgentAccount
- Inherits:
-
Object
- Object
- TinCanApi::AgentAccount
- Defined in:
- lib/tin_can_api/agent_account.rb
Overview
Agent Account model class
Instance Attribute Summary collapse
-
#home_page ⇒ Object
Returns the value of attribute home_page.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ AgentAccount
constructor
A new instance of AgentAccount.
- #serialize(version) ⇒ Object
Constructor Details
#initialize(options = {}, &block) ⇒ AgentAccount
Returns a new instance of AgentAccount.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tin_can_api/agent_account.rb', line 9 def initialize(={}, &block) json = .fetch(:json, nil) if json attributes = JSON.parse(json) self.name = attributes['name'] if attributes['name'] self.home_page = attributes['homePage'] if attributes['homePage'] else self.home_page = .fetch(:home_page, nil) self.name =.fetch(:name, nil) if block_given? block[self] end end end |
Instance Attribute Details
#home_page ⇒ Object
Returns the value of attribute home_page.
7 8 9 |
# File 'lib/tin_can_api/agent_account.rb', line 7 def home_page @home_page end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/tin_can_api/agent_account.rb', line 7 def name @name end |
Instance Method Details
#serialize(version) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/tin_can_api/agent_account.rb', line 25 def serialize(version) node = {} node['name'] = name if name node['homePage'] = home_page if home_page node end |