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.
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
25409 25410 25411 25412 25413 25414 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25409 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)) } end |
Instance Attribute Details
#dimensions ⇒ Object (readonly)
Returns the value of attribute dimensions.
25407 25408 25409 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25407 def dimensions @dimensions end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
25407 25408 25409 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25407 def items @items end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
25420 25421 25422 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25420 def copy(incoming={}) ShippingLabelPackage.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
25424 25425 25426 25427 25428 25429 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25424 def to_hash { :dimensions => dimensions.to_hash, :items => items.map { |o| o.to_hash } } end |
#to_json ⇒ Object
25416 25417 25418 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 25416 def to_json JSON.dump(to_hash) end |