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
-
#delivered_duty ⇒ Object
readonly
Returns the value of attribute delivered_duty.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#insurance ⇒ Object
readonly
Returns the value of attribute insurance.
-
#order_number ⇒ Object
readonly
Returns the value of attribute order_number.
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#packages ⇒ Object
readonly
Returns the value of attribute packages.
-
#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.
15010 15011 15012 15013 15014 15015 15016 15017 15018 15019 15020 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15010 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:service, :delivered_duty, :destination, :origin, :packages], 'ShippingLabelForm') @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String) @delivered_duty = (x = opts.delete(:delivered_duty); x.is_a?(::Io::Flow::V0::Models::DeliveredDuty) ? x : ::Io::Flow::V0::Models::DeliveredDuty.apply(x)) @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)) @packages = HttpClient::Preconditions.assert_class('packages', opts.delete(:packages), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x)) } @insurance = (x = opts.delete(:insurance); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Price) ? x : ::Io::Flow::V0::Models::Price.new(x))) @order_number = (x = opts.delete(:order_number); x.nil? ? nil : HttpClient::Preconditions.assert_class('order_number', x, String)) end |
Instance Attribute Details
#delivered_duty ⇒ Object (readonly)
Returns the value of attribute delivered_duty.
15008 15009 15010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15008 def delivered_duty @delivered_duty end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
15008 15009 15010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15008 def destination @destination end |
#insurance ⇒ Object (readonly)
Returns the value of attribute insurance.
15008 15009 15010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15008 def insurance @insurance end |
#order_number ⇒ Object (readonly)
Returns the value of attribute order_number.
15008 15009 15010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15008 def order_number @order_number end |
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
15008 15009 15010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15008 def origin @origin end |
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
15008 15009 15010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15008 def packages @packages end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
15008 15009 15010 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15008 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
15026 15027 15028 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15026 def copy(incoming={}) ShippingLabelForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
15030 15031 15032 15033 15034 15035 15036 15037 15038 15039 15040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15030 def to_hash { :service => service, :delivered_duty => delivered_duty.value, :destination => destination.to_hash, :origin => origin.to_hash, :packages => packages.map { |o| o.to_hash }, :insurance => insurance.nil? ? nil : insurance.to_hash, :order_number => order_number } end |
#to_json ⇒ Object
15022 15023 15024 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15022 def to_json JSON.dump(to_hash) end |