class Xapi::Verb

Attributes

display[RW]
id[RW]

Public Class Methods

new(options={}, &block) click to toggle source
# File lib/xapi/verb.rb, line 7
def initialize(options={}, &block)
  json = options.fetch(:json, nil)
  if json
    attributes = JSON.parse(json)
    self.id = attributes['id'] if attributes['id']
    self.display = attributes['display'] if attributes['display']
  else
    self.id = options.fetch(:id, nil)
    self.display = options.fetch(:display, nil)

    if block_given?
      block[self]
    end
  end
end

Public Instance Methods

id=(value) click to toggle source
# File lib/xapi/verb.rb, line 23
def id=(value)
  @id = value if value
end
serialize(version) click to toggle source
# File lib/xapi/verb.rb, line 27
def serialize(version)
  node = {}
  node['id'] = id.to_s if id
  node['display'] = display if display
  node
end