Class: Xapi::AgentAccount
- Inherits:
-
Object
- Object
- Xapi::AgentAccount
- Defined in:
- lib/xapi/agent_account.rb
Overview
Agent Account model class
Instance Attribute Summary collapse
-
#homePage ⇒ Object
Returns the value of attribute homePage.
-
#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/xapi/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.homePage = attributes['homePage'] if attributes['homePage'] else self.homePage = .fetch(:home_page, nil) self.name =.fetch(:name, nil) if block_given? block[self] end end end |
Instance Attribute Details
#homePage ⇒ Object
Returns the value of attribute homePage.
7 8 9 |
# File 'lib/xapi/agent_account.rb', line 7 def homePage @homePage end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/xapi/agent_account.rb', line 7 def name @name end |
Instance Method Details
#serialize(version) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/xapi/agent_account.rb', line 25 def serialize(version) node = {} node['name'] = name if name node['homePage'] = homePage if homePage node end |