class Xapi::Team
Team
model class
Attributes
account[RW]
mbox[RW]
mbox_sha1_sum[RW]
name[RW]
object_type[RW]
open_id[RW]
Public Class Methods
new(options={}, &block)
click to toggle source
# File lib/xapi/team.rb, line 9 def initialize(options={}, &block) @object_type = 'Group' json = options.fetch(:json, nil) if json attributes = JSON.parse(json) self.name = attributes['name'] if attributes['name'] self.mbox = attributes['mbox'] if attributes['mbox'] self.mbox_sha1_sum = attributes['mbox_sha1sum'] if attributes['mbox_sha1sum'] self.open_id = attributes['openid'] if attributes['openid'] self.account = AgentAccount.new(json: attributes['account'].to_json) if attributes['account'] else self.name = options.fetch(:name, nil) self.mbox = options.fetch(:mbox, nil) self.mbox_sha1_sum = options.fetch(:mbox_sha1_sum, nil) self.open_id = options.fetch(:open_id, nil) self.account = options.fetch(:account, nil) if block_given? block[self] end end end
Public Instance Methods
serialize(version)
click to toggle source
# File lib/xapi/team.rb, line 32 def serialize(version) node = {} node['objectType'] = object_type node['name'] = name if name node['mbox'] = mbox if mbox node['mbox_sha1sum'] = mbox_sha1_sum if mbox_sha1_sum node['openid'] = open_id if open_id node['account'] = account.serialize(version) if account node end