Class: Io::Flow::V0::Models::ShippingLabelForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::ShippingLabelForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#delivered_duty ⇒ Object
readonly
Returns the value of attribute delivered_duty.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#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.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
-
#shipment_recipient ⇒ Object
readonly
Returns the value of attribute shipment_recipient.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ ShippingLabelForm
constructor
A new instance of ShippingLabelForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ ShippingLabelForm
Returns a new instance of ShippingLabelForm.
30627 30628 30629 30630 30631 30632 30633 30634 30635 30636 30637 30638 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30627 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:destination, :origin, :package], 'ShippingLabelForm') @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) @origin = (x = opts.delete(:origin); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x)) @package = (x = opts.delete(:package); x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x)) @attributes = (x = opts.delete(:attributes); x.nil? ? nil : HttpClient::Preconditions.assert_class('attributes', x, Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h }) @delivered_duty = (x = opts.delete(:delivered_duty); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x))) @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String)) @service = (x = opts.delete(:service); x.nil? ? nil : HttpClient::Preconditions.assert_class('service', x, String)) @shipment_recipient = (x = opts.delete(:shipment_recipient); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShipmentRecipient) ? x : ::Io::Flow::V0::Models::ShipmentRecipient.apply(x))) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
30625 30626 30627 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30625 def attributes @attributes end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
30625 30626 30627 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30625 def delivered_duty @delivered_duty end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
30625 30626 30627 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30625 def destination @destination end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
30625 30626 30627 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30625 def order_number @order_number end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
30625 30626 30627 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30625 def origin @origin end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
30625 30626 30627 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30625 def package @package end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
30625 30626 30627 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30625 def service @service end |
#shipment_recipient ⇒ Object (readonly)
Returns the value of attribute shipment_recipient.
30625 30626 30627 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30625 def shipment_recipient @shipment_recipient end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
30644 30645 30646 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30644 def copy(incoming={}) ShippingLabelForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
30648 30649 30650 30651 30652 30653 30654 30655 30656 30657 30658 30659 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30648 def to_hash { :destination => destination.to_hash, :origin => origin.to_hash, :package => package.to_hash, :attributes => attributes.nil? ? nil : attributes, :delivered_duty => delivered_duty.nil? ? nil : delivered_duty.value, :order_number => order_number, :service => service, :shipment_recipient => shipment_recipient.nil? ? nil : shipment_recipient.value } end |
#to_json ⇒ Object
30640 30641 30642 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30640 def to_json JSON.dump(to_hash) end |