Class: Io::Flow::V0::Models::TaxDutyQuoteLineItem
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::TaxDutyQuoteLineItem
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
An ordered quantity of goods for tax and duty calculation.
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#country_of_origin ⇒ Object
readonly
Returns the value of attribute country_of_origin.
-
#hs_code ⇒ Object
readonly
Returns the value of attribute hs_code.
-
#primary_identifier ⇒ Object
readonly
Returns the value of attribute primary_identifier.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#ship_from ⇒ Object
readonly
Returns the value of attribute ship_from.
-
#unit_values ⇒ Object
readonly
Returns the value of attribute unit_values.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ TaxDutyQuoteLineItem
constructor
A new instance of TaxDutyQuoteLineItem.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ TaxDutyQuoteLineItem
Returns a new instance of TaxDutyQuoteLineItem.
64970 64971 64972 64973 64974 64975 64976 64977 64978 64979 64980 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64970 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:primary_identifier, :ship_from, :quantity, :unit_values, :country_of_origin, :hs_code], 'TaxDutyQuoteLineItem') @primary_identifier = HttpClient::Preconditions.assert_class('primary_identifier', opts.delete(:primary_identifier), String) @attributes = HttpClient::Preconditions.assert_class('attributes', (x = opts.delete(:attributes); x.nil? ? {} : x), Hash).inject({}) { |h, d| h[d[0]] = HttpClient::Preconditions.assert_class('attributes', d[1], String); h } @ship_from = (x = opts.delete(:ship_from); x.is_a?(::Io::Flow::V0::Models::StreetAddress) ? x : ::Io::Flow::V0::Models::StreetAddress.new(x)) @quantity = HttpClient::Preconditions.assert_class('quantity', opts.delete(:quantity), Integer) @unit_values = (x = opts.delete(:unit_values); x.is_a?(::Io::Flow::V0::Models::TaxDutyQuoteValues) ? x : ::Io::Flow::V0::Models::TaxDutyQuoteValues.new(x)) @country_of_origin = HttpClient::Preconditions.assert_class('country_of_origin', opts.delete(:country_of_origin), String) @hs_code = HttpClient::Preconditions.assert_class('hs_code', opts.delete(:hs_code), String) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
64968 64969 64970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64968 def attributes @attributes end |
#country_of_origin ⇒ Object (readonly)
Returns the value of attribute country_of_origin.
64968 64969 64970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64968 def country_of_origin @country_of_origin end |
#hs_code ⇒ Object (readonly)
Returns the value of attribute hs_code.
64968 64969 64970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64968 def hs_code @hs_code end |
#primary_identifier ⇒ Object (readonly)
Returns the value of attribute primary_identifier.
64968 64969 64970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64968 def primary_identifier @primary_identifier end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
64968 64969 64970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64968 def quantity @quantity end |
#ship_from ⇒ Object (readonly)
Returns the value of attribute ship_from.
64968 64969 64970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64968 def ship_from @ship_from end |
#unit_values ⇒ Object (readonly)
Returns the value of attribute unit_values.
64968 64969 64970 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64968 def unit_values @unit_values end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
64986 64987 64988 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64986 def copy(incoming={}) TaxDutyQuoteLineItem.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
64990 64991 64992 64993 64994 64995 64996 64997 64998 64999 65000 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64990 def to_hash { :primary_identifier => primary_identifier, :attributes => attributes, :ship_from => ship_from.to_hash, :quantity => quantity, :unit_values => unit_values.to_hash, :country_of_origin => country_of_origin, :hs_code => hs_code } end |
#to_json ⇒ Object
64982 64983 64984 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 64982 def to_json JSON.dump(to_hash) end |