Class: Io::Flow::V0::Models::BridgeShippingLabelForm
- Inherits:
-
ShippingLabelForm
- Object
- ShippingLabelForm
- Io::Flow::V0::Models::BridgeShippingLabelForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Form to create a shipping label via the GLBE Bridge.
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#package ⇒ Object
readonly
Returns the value of attribute package.
Attributes inherited from ShippingLabelForm
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ BridgeShippingLabelForm
constructor
A new instance of BridgeShippingLabelForm.
- #subtype_to_hash ⇒ Object
- #to_json ⇒ Object
Methods inherited from ShippingLabelForm
Constructor Details
#initialize(incoming = {}) ⇒ BridgeShippingLabelForm
Returns a new instance of BridgeShippingLabelForm.
32507 32508 32509 32510 32511 32512 32513 32514 32515 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32507 def initialize(incoming={}) super(:discriminator => ShippingLabelForm::Types::BRIDGE_SHIPPING_LABEL_FORM) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:order_number], 'BridgeShippingLabelForm') @order_number = HttpClient::Preconditions.assert_class('order_number', opts.delete(:order_number), String) @items = (x = opts.delete(:items); x.nil? ? nil : HttpClient::Preconditions.assert_class('items', x, Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LineItemForm) ? x : ::Io::Flow::V0::Models::LineItemForm.new(x)) }) @package = (x = opts.delete(:package); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x))) @origin = (x = opts.delete(:origin); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))) end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
32505 32506 32507 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32505 def items @items end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
32505 32506 32507 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32505 def order_number @order_number end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
32505 32506 32507 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32505 def origin @origin end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
32505 32506 32507 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32505 def package @package end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
32521 32522 32523 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32521 def copy(incoming={}) BridgeShippingLabelForm.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#subtype_to_hash ⇒ Object
32525 32526 32527 32528 32529 32530 32531 32532 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32525 def subtype_to_hash { :order_number => order_number, :items => items.nil? ? nil : items.map { |o| o.to_hash }, :package => package.nil? ? nil : package.to_hash, :origin => origin.nil? ? nil : origin.to_hash } end |
#to_json ⇒ Object
32517 32518 32519 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32517 def to_json JSON.dump(to_hash) end |