class Beaver::ItemReq
ItemReq
Model.
Attributes
TODO: Write general description for this method @return [String]
TODO: Write general description for this method @return [CurrencyEnum]
TODO: Write general description for this method @return [String]
TODO: Write general description for this method @return [List of String]
TODO: Write general description for this method @return [Integer]
TODO: Write general description for this method @return [String]
TODO: Write general description for this method @return [Object]
TODO: Write general description for this method @return [String]
TODO: Write general description for this method @return [List of EmbeddedRbit]
TODO: Write general description for this method @return [String]
TODO: Write general description for this method @return [List of String]
TODO: Write general description for this method @return [Terms]
TODO: Write general description for this method @return [String]
TODO: Write general description for this method @return [Weight]
Public Class Methods
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
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
# 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