Class: Io::Flow::V0::Models::TaxDutyQuoteSimpleShippingForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TaxDutyQuoteSimpleShippingForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Shipping revenue paid by the consumer for a single shipping charge. If a shipping revenue line is not provided for any ship_from location, it will be assumed no shipping was collected for shipments from this location.
Instance Attribute Summary collapse
-
#includes ⇒ Object
readonly
Returns the value of attribute includes.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#ship_from ⇒ Object
readonly
Returns the value of attribute ship_from.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TaxDutyQuoteSimpleShippingForm
constructor
A new instance of TaxDutyQuoteSimpleShippingForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TaxDutyQuoteSimpleShippingForm
Returns a new instance of TaxDutyQuoteSimpleShippingForm.
70188 70189 70190 70191 70192 70193 70194 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70188 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:price], 'TaxDutyQuoteSimpleShippingForm') @price = HttpClient::Preconditions.assert_class('price', HttpClient::Helper.to_big_decimal(opts.delete(:price)), BigDecimal) @includes = HttpClient::Preconditions.assert_class('includes', (x = opts.delete(:includes); x.nil? ? [] : x), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::LevyInclusion) ? x : ::Io::Flow::V0::Models::LevyInclusion.apply(x)) } @ship_from = (x = opts.delete(:ship_from); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::StreetAddress) ? x : ::Io::Flow::V0::Models::StreetAddress.new(x))) end |
Instance Attribute Details
#includes ⇒ Object (readonly)
Returns the value of attribute includes.
70186 70187 70188 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70186 def includes @includes end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
70186 70187 70188 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70186 def price @price end |
#ship_from ⇒ Object (readonly)
Returns the value of attribute ship_from.
70186 70187 70188 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70186 def ship_from @ship_from end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
70200 70201 70202 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70200 def copy(incoming={}) TaxDutyQuoteSimpleShippingForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
70204 70205 70206 70207 70208 70209 70210 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70204 def to_hash { :price => price.to_f.to_s, :includes => includes.map { |o| o.value }, :ship_from => ship_from.nil? ? nil : ship_from.to_hash } end |
#to_json ⇒ Object
70196 70197 70198 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 70196 def to_json JSON.dump(to_hash) end |