class Beaver::Buyer

Buyer Model.

Attributes

type[RW]

TODO: Write general description for this method @return [Type12Enum]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

# File lib/beaver/models/buyer.rb, line 39
def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash['type']
  legal_entity = LegalEntity.from_hash(hash['legal_entity']) if
    hash['legal_entity']
  legal_entity_id = hash['legal_entity_id']

  # Create object from extracted values.
  Buyer.new(type,
            legal_entity,
            legal_entity_id)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/buyer.rb, line 22
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['legal_entity'] = 'legal_entity'
  @_hash['legal_entity_id'] = 'legal_entity_id'
  @_hash['type'] = 'type'
  @_hash
end
new(type = nil, legal_entity = nil, legal_entity_id = nil) click to toggle source
# File lib/beaver/models/buyer.rb, line 30
def initialize(type = nil,
               legal_entity = nil,
               legal_entity_id = nil)
  @legal_entity = legal_entity
  @legal_entity_id = legal_entity_id
  @type = type
end