class Beaver::ItemReq

ItemReq Model.

Attributes

account_id[RW]

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

currency[RW]

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

description[RW]

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

photos[RW]

TODO: Write general description for this method @return [List of String]

price[RW]

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

product_code[RW]

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

product_details[RW]

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

product_name[RW]

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

rbits[RW]

TODO: Write general description for this method @return [List of EmbeddedRbit]

reference_number[RW]

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

shipping_options[RW]

TODO: Write general description for this method @return [List of String]

terms[RW]

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

uri[RW]

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

weight[RW]

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

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash.

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

  # Extract variables from the hash.
  product_name = hash['product_name']
  account_id = hash['account_id']
  currency = hash['currency']
  description = hash['description']
  photos = hash['photos']
  price = hash['price']
  product_code = hash['product_code']
  product_details = hash['product_details']
  # Parameter is an array, so we need to iterate through it
  rbits = nil
  unless hash['rbits'].nil?
    rbits = []
    hash['rbits'].each do |structure|
      rbits << (EmbeddedRbit.from_hash(structure) if structure)
    end
  end
  reference_number = hash['reference_number']
  shipping_options = hash['shipping_options']
  terms = Terms.from_hash(hash['terms']) if hash['terms']
  uri = hash['uri']
  weight = Weight.from_hash(hash['weight']) if hash['weight']

  # Create object from extracted values.
  ItemReq.new(product_name,
              account_id,
              currency,
              description,
              photos,
              price,
              product_code,
              product_details,
              rbits,
              reference_number,
              shipping_options,
              terms,
              uri,
              weight)
end
names() click to toggle source

A mapping from model property names to API property names.

# File lib/beaver/models/item_req.rb, line 66
def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_id'] = 'account_id'
  @_hash['currency'] = 'currency'
  @_hash['description'] = 'description'
  @_hash['photos'] = 'photos'
  @_hash['price'] = 'price'
  @_hash['product_code'] = 'product_code'
  @_hash['product_details'] = 'product_details'
  @_hash['product_name'] = 'product_name'
  @_hash['rbits'] = 'rbits'
  @_hash['reference_number'] = 'reference_number'
  @_hash['shipping_options'] = 'shipping_options'
  @_hash['terms'] = 'terms'
  @_hash['uri'] = 'uri'
  @_hash['weight'] = 'weight'
  @_hash
end
new(product_name = nil, account_id = nil, currency = nil, description = nil, photos = nil, price = nil, product_code = nil, product_details = nil, rbits = nil, reference_number = nil, shipping_options = nil, terms = nil, uri = nil, weight = nil) click to toggle source
# File lib/beaver/models/item_req.rb, line 85
def initialize(product_name = nil,
               account_id = nil,
               currency = nil,
               description = nil,
               photos = nil,
               price = nil,
               product_code = nil,
               product_details = nil,
               rbits = nil,
               reference_number = nil,
               shipping_options = nil,
               terms = nil,
               uri = nil,
               weight = nil)
  @account_id = account_id
  @currency = currency
  @description = description
  @photos = photos
  @price = price
  @product_code = product_code
  @product_details = product_details
  @product_name = product_name
  @rbits = rbits
  @reference_number = reference_number
  @shipping_options = shipping_options
  @terms = terms
  @uri = uri
  @weight = weight
end