class Io::Flow::V0::Models::TaxDutyQuoteSimpleShippingForm

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.

Attributes

includes[R]
price[R]
ship_from[R]

Public Class Methods

new(incoming={}) click to toggle source
# 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

Public Instance Methods

copy(incoming={}) click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 70196
def to_json
  JSON.dump(to_hash)
end