Class: Io::Flow::V0::Models::DutyItemForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::DutyItemForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#customs_description ⇒ Object
readonly
Returns the value of attribute customs_description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#origin_criteria ⇒ Object
readonly
Returns the value of attribute origin_criteria.
-
#product_id ⇒ Object
readonly
Returns the value of attribute product_id.
-
#sku ⇒ Object
readonly
Returns the value of attribute sku.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ DutyItemForm
constructor
A new instance of DutyItemForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ DutyItemForm
Returns a new instance of DutyItemForm.
35521 35522 35523 35524 35525 35526 35527 35528 35529 35530 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35521 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:number, :name, :customs_description], 'DutyItemForm') @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::V0::Models::TradeAgreementName) ? x : ::Io::Flow::V0::Models::TradeAgreementName.apply(x)) @product_id = (x = opts.delete(:product_id); x.nil? ? nil : HttpClient::Preconditions.assert_class('product_id', x, String)) @sku = (x = opts.delete(:sku); x.nil? ? nil : HttpClient::Preconditions.assert_class('sku', x, String)) @customs_description = HttpClient::Preconditions.assert_class('customs_description', opts.delete(:customs_description), String) @origin_criteria = (x = opts.delete(:origin_criteria); x.nil? ? nil : HttpClient::Preconditions.assert_class('origin_criteria', x, String)) end |
Instance Attribute Details
#customs_description ⇒ Object (readonly)
Returns the value of attribute customs_description.
35519 35520 35521 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35519 def customs_description @customs_description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
35519 35520 35521 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35519 def name @name end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
35519 35520 35521 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35519 def number @number end |
#origin_criteria ⇒ Object (readonly)
Returns the value of attribute origin_criteria.
35519 35520 35521 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35519 def origin_criteria @origin_criteria end |
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
35519 35520 35521 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35519 def product_id @product_id end |
#sku ⇒ Object (readonly)
Returns the value of attribute sku.
35519 35520 35521 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35519 def sku @sku end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
35536 35537 35538 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35536 def copy(incoming={}) DutyItemForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
35540 35541 35542 35543 35544 35545 35546 35547 35548 35549 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35540 def to_hash { :number => number, :name => name.value, :product_id => product_id, :sku => sku, :customs_description => customs_description, :origin_criteria => origin_criteria } end |
#to_json ⇒ Object
35532 35533 35534 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 35532 def to_json JSON.dump(to_hash) end |