class Xapi::AgentAccount

Agent Account model class

Attributes

homePage[RW]
name[RW]

Public Class Methods

new(options={}, &block) click to toggle source
# File lib/xapi/agent_account.rb, line 9
def initialize(options={}, &block)
  json = options.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 = options.fetch(:home_page, nil)
    self.name =options.fetch(:name, nil)

    if block_given?
      block[self]
    end
  end
end

Public Instance Methods

serialize(version) click to toggle source
# File lib/xapi/agent_account.rb, line 25
def serialize(version)
  node = {}
  node['name'] = name if name
  node['homePage'] = homePage if homePage
  node
end