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.
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.
15686 15687 15688 15689 15690 15691 15692 15693 15694 15695 15696 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15686 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:delivered_duty, :service, :destination, :origin, :package], 'ShippingLabelForm') @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.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x)) @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String) @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)) @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String)) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
15684 15685 15686 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15684 def attributes @attributes end |
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
15684 15685 15686 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15684 def delivered_duty @delivered_duty end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
15684 15685 15686 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15684 def destination @destination end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
15684 15685 15686 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15684 def order_number @order_number end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
15684 15685 15686 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15684 def origin @origin end |
#package ⇒ Object (readonly)
Returns the value of attribute package.
15684 15685 15686 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15684 def package @package end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
15684 15685 15686 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15684 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
15702 15703 15704 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15702 def copy(incoming={}) ShippingLabelForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15706 def to_hash { :attributes => attributes.nil? ? nil : attributes, :delivered_duty => delivered_duty.value, :service => service, :destination => destination.to_hash, :origin => origin.to_hash, :package => package.to_hash, :order_number => order_number } end |
#to_json ⇒ Object
15698 15699 15700 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15698 def to_json JSON.dump(to_hash) end |