Class: Io::Flow::V0::Models::ShippingLabelPackage
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingLabelPackage
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Describes a package to be shipped, including dimensions and items included
Instance Attribute Summary collapse
-
#dimensions ⇒ Object
readonly
Returns the value of attribute dimensions.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#reference_number ⇒ Object
readonly
Returns the value of attribute reference_number.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShippingLabelPackage
constructor
A new instance of ShippingLabelPackage.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingLabelPackage
Returns a new instance of ShippingLabelPackage.
66586 66587 66588 66589 66590 66591 66592 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66586 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:dimensions, :items], 'ShippingLabelPackage') @dimensions = (x = opts.delete(:dimensions); x.is_a?(::Io::Flow::V0::Models::Dimension) ? x : ::Io::Flow::V0::Models::Dimension.new(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)) } @reference_number = (x = opts.delete(:reference_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('reference_number', x, String)) end |
Instance Attribute Details
#dimensions ⇒ Object (readonly)
Returns the value of attribute dimensions.
66584 66585 66586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66584 def dimensions @dimensions end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
66584 66585 66586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66584 def items @items end |
#reference_number ⇒ Object (readonly)
Returns the value of attribute reference_number.
66584 66585 66586 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66584 def reference_number @reference_number end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
66598 66599 66600 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66598 def copy(incoming={}) ShippingLabelPackage.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
66602 66603 66604 66605 66606 66607 66608 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66602 def to_hash { :dimensions => dimensions.to_hash, :items => items.map { |o| o.to_hash }, :reference_number => reference_number } end |
#to_json ⇒ Object
66594 66595 66596 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66594 def to_json JSON.dump(to_hash) end |