Class: Io::Flow::V0::Models::SummaryShippingLabelForm
- Inherits:
-
ShippingLabelForm
- Object
- ShippingLabelForm
- Io::Flow::V0::Models::SummaryShippingLabelForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
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
Instance Attribute Summary collapse
-
#center_key ⇒ Object
readonly
Returns the value of attribute center_key.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
Attributes inherited from ShippingLabelForm
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ SummaryShippingLabelForm
constructor
A new instance of SummaryShippingLabelForm.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ShippingLabelForm
Constructor Details
#initialize(incoming = {}) ⇒ SummaryShippingLabelForm
Returns a new instance of SummaryShippingLabelForm.
52201 52202 52203 52204 52205 52206 52207 52208 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52201 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 |
Instance Attribute Details
#center_key ⇒ Object (readonly)
Returns the value of attribute center_key.
52199 52200 52201 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52199 def center_key @center_key end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
52199 52200 52201 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52199 def items @items end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
52199 52200 52201 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52199 def order_number @order_number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
52214 52215 52216 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52214 def copy(incoming={}) SummaryShippingLabelForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
52218 52219 52220 52221 52222 52223 52224 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52218 def subtype_to_hash { :order_number => order_number, :items => items.map { |o| o.to_hash }, :center_key => center_key } end |
#to_json ⇒ Object
52210 52211 52212 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52210 def to_json JSON.dump(to_hash) end |