class Io::Flow::V0::Models::SummaryShippingLabelForm
Minimal form to create a shipping label. Origin and destination are assumed based on a given order’s center and final shipping destination, if no center key is provided
Attributes
center_key[R]
items[R]
order_number[R]
Public Class Methods
new(incoming={})
click to toggle source
Calls superclass method
Io::Flow::V0::Models::ShippingLabelForm::new
# File lib/flow_commerce/flow_api_v0_client.rb, line 69350 def initialize(incoming={}) super(:discriminator => ShippingLabelForm::Types::SUMMARY_SHIPPING_LABEL_FORM) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:order_number, :items], 'SummaryShippingLabelForm') @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String) @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)) } @center_key = (x = opts.delete(:center_key); x.nil? ? nil : HttpClient::Preconditions.assert_class('center_key', x, String)) end
Public Instance Methods
copy(incoming={})
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 69363 def copy(incoming={}) SummaryShippingLabelForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end
subtype_to_hash()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 69367 def subtype_to_hash { :order_number => order_number, :items => items.map { |o| o.to_hash }, :center_key => center_key } end
to_json()
click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 69359 def to_json JSON.dump(to_hash) end