class TinCanApi::AgentAccount

Agent Account model class

Attributes

home_page[RW]
name[RW]

Public Class Methods

new(options={}, &block) click to toggle source
# File lib/tin_can_api/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.home_page = attributes['homePage'] if attributes['homePage']
  else
    self.home_page = 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/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