class Io::Flow::V0::Models::OrderPutForm
The order put form is used to upsert an order, providing the details on pricing and delivery options for destination and items/quantities specified.
Attributes
attributes[R]
customer[R]
delivered_duty[R]
destination[R]
discount[R]
discounts[R]
items[R]
options[R]
order_type[R]
selections[R]
Public Class Methods
new(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 52878 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:items], 'OrderPutForm') @order_type = (x = (x = opts.delete(:order_type); x.nil? ? "standard" : x); x.is_a?(::Io::Flow::V0::Models::OrderType) ? x : ::Io::Flow::V0::Models::OrderType.apply(x)) @items = HttpClient::Preconditions.assert_class('items', opts.delete(:items), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) } @customer = (x = opts.delete(:customer); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderCustomerForm) ? x : ::Io::Flow::V0::Models::OrderCustomerForm.new(x))) @delivered_duty = (x = opts.delete(:delivered_duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x))) @selections = (x = opts.delete(:selections); x.nil? ? nil : HttpClient::Preconditions.assert_class('selections', x, Array).map { |v| HttpClient::Preconditions.assert_class('selections', v, String) }) @destination = (x = opts.delete(:destination); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderAddress) ? x : ::Io::Flow::V0::Models::OrderAddress.new(x))) @discount = (x = opts.delete(:discount); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))) @discounts = (x = opts.delete(:discounts); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::DiscountsForm) ? x : ::Io::Flow::V0::Models::DiscountsForm.new(x))) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) @authorization_keys = (x = opts.delete(:authorization_keys); x.nil? ? nil : HttpClient::Preconditions.assert_class('authorization_keys', x, Array).map { |v| HttpClient::Preconditions.assert_class('authorization_keys', v, String) }) @options = (x = opts.delete(:options); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::OrderOptions) ? x : ::Io::Flow::V0::Models::OrderOptions.new(x))) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 52898 def copy(incoming={}) OrderPutForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 52902 def to_hash { :order_type => order_type.value, :items => items.map { |o| o.to_hash }, :customer => customer.nil? ? nil : customer.to_hash, :delivered_duty => delivered_duty.nil? ? nil : delivered_duty.value, :selections => selections.nil? ? nil : selections, :destination => destination.nil? ? nil : destination.to_hash, :discount => discount.nil? ? nil : discount.to_hash, :discounts => discounts.nil? ? nil : discounts.to_hash, :attributes => attributes.nil? ? nil : attributes, :authorization_keys => authorization_keys.nil? ? nil : authorization_keys, :options => options.nil? ? nil : options.to_hash } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 52894 def to_json JSON.dump(to_hash) end