class Beaver::OrderReq
OrderReq
Model.
Attributes
TODO: Write general description for this method @return [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 [Buyer]
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 [DeliveryTypeEnum]
TODO: Write general description for this method @return [Integer]
TODO: Write general description for this method @return [Integer]
TODO: Write general description for this method @return [Integer]
TODO: Write general description for this method @return [Integer]
TODO: Write general description for this method @return [List of LineItem1]
TODO: Write general description for this method @return [String]
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 [AddressPaymentsReq]
TODO: Write general description for this method @return [AddressPaymentsReq]
TODO: Write general description for this method @return [AddressPaymentsReq]
TODO: Write general description for this method @return [ShippingStatus1]
TODO: Write general description for this method @return [String]
TODO: Write general description for this method @return [Status4Enum]
TODO: Write general description for this method @return [Integer]
TODO: Write general description for this method @return [Terms]
TODO: Write general description for this method @return [Type4Enum]
TODO: Write general description for this method @return [Integer]
TODO: Write general description for this method @return [Float]
Public Class Methods
Creates an instance of the object from a hash.
# File lib/beaver/models/order_req.rb, line 207 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_id = hash['account_id'] type = hash['type'] alternate_tax_amount = hash['alternate_tax_amount'] alternate_tax_id = hash['alternate_tax_id'] buyer = Buyer.from_hash(hash['buyer']) if hash['buyer'] currency = hash['currency'] customer_reference_number = hash['customer_reference_number'] delivery_type = hash['delivery_type'] discount_amount = hash['discount_amount'] duty_amount = hash['duty_amount'] freight_amount = hash['freight_amount'] grand_total_amount = hash['grand_total_amount'] # Parameter is an array, so we need to iterate through it line_items = nil unless hash['line_items'].nil? line_items = [] hash['line_items'].each do |structure| line_items << (LineItem1.from_hash(structure) if structure) end end long_description = hash['long_description'] notes = hash['notes'] # 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'] service_address = AddressPaymentsReq.from_hash(hash['service_address']) if hash['service_address'] if hash['ship_from_address'] ship_from_address = AddressPaymentsReq.from_hash(hash['ship_from_address']) end ship_to_address = AddressPaymentsReq.from_hash(hash['ship_to_address']) if hash['ship_to_address'] shipping_status = ShippingStatus1.from_hash(hash['shipping_status']) if hash['shipping_status'] short_description = hash['short_description'] status = hash['status'] tax_amount = hash['tax_amount'] terms = Terms.from_hash(hash['terms']) if hash['terms'] vat_amount = hash['vat_amount'] vat_rate = hash['vat_rate'] # Create object from extracted values. OrderReq.new(account_id, type, alternate_tax_amount, alternate_tax_id, buyer, currency, customer_reference_number, delivery_type, discount_amount, duty_amount, freight_amount, grand_total_amount, line_items, long_description, notes, rbits, reference_number, service_address, ship_from_address, ship_to_address, shipping_status, short_description, status, tax_amount, terms, vat_amount, vat_rate) end
A mapping from model property names to API property names.
# File lib/beaver/models/order_req.rb, line 118 def self.names @_hash = {} if @_hash.nil? @_hash['account_id'] = 'account_id' @_hash['alternate_tax_amount'] = 'alternate_tax_amount' @_hash['alternate_tax_id'] = 'alternate_tax_id' @_hash['buyer'] = 'buyer' @_hash['currency'] = 'currency' @_hash['customer_reference_number'] = 'customer_reference_number' @_hash['delivery_type'] = 'delivery_type' @_hash['discount_amount'] = 'discount_amount' @_hash['duty_amount'] = 'duty_amount' @_hash['freight_amount'] = 'freight_amount' @_hash['grand_total_amount'] = 'grand_total_amount' @_hash['line_items'] = 'line_items' @_hash['long_description'] = 'long_description' @_hash['notes'] = 'notes' @_hash['rbits'] = 'rbits' @_hash['reference_number'] = 'reference_number' @_hash['service_address'] = 'service_address' @_hash['ship_from_address'] = 'ship_from_address' @_hash['ship_to_address'] = 'ship_to_address' @_hash['shipping_status'] = 'shipping_status' @_hash['short_description'] = 'short_description' @_hash['status'] = 'status' @_hash['tax_amount'] = 'tax_amount' @_hash['terms'] = 'terms' @_hash['type'] = 'type' @_hash['vat_amount'] = 'vat_amount' @_hash['vat_rate'] = 'vat_rate' @_hash end
# File lib/beaver/models/order_req.rb, line 150 def initialize(account_id = nil, type = nil, alternate_tax_amount = nil, alternate_tax_id = nil, buyer = nil, currency = nil, customer_reference_number = nil, delivery_type = nil, discount_amount = nil, duty_amount = nil, freight_amount = nil, grand_total_amount = nil, line_items = nil, long_description = nil, notes = nil, rbits = nil, reference_number = nil, service_address = nil, ship_from_address = nil, ship_to_address = nil, shipping_status = nil, short_description = nil, status = nil, tax_amount = nil, terms = nil, vat_amount = nil, vat_rate = nil) @account_id = account_id @alternate_tax_amount = alternate_tax_amount @alternate_tax_id = alternate_tax_id @buyer = buyer @currency = currency @customer_reference_number = customer_reference_number @delivery_type = delivery_type @discount_amount = discount_amount @duty_amount = duty_amount @freight_amount = freight_amount @grand_total_amount = grand_total_amount @line_items = line_items @long_description = long_description @notes = notes @rbits = rbits @reference_number = reference_number @service_address = service_address @ship_from_address = ship_from_address @ship_to_address = ship_to_address @shipping_status = shipping_status @short_description = short_description @status = status @tax_amount = tax_amount @terms = terms @type = type @vat_amount = vat_amount @vat_rate = vat_rate end