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
Instance Attribute Summary collapse
-
#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.
47089 47090 47091 47092 47093 47094 47095 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47089 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)) } end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
47087 47088 47089 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47087 def items @items end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
47087 47088 47089 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47087 def order_number @order_number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
47101 47102 47103 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47101 def copy(incoming={}) SummaryShippingLabelForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
47105 47106 47107 47108 47109 47110 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47105 def subtype_to_hash { :order_number => order_number, :items => items.map { |o| o.to_hash } } end |
#to_json ⇒ Object
47097 47098 47099 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 47097 def to_json JSON.dump(to_hash) end |