Class: Io::Flow::V0::Models::TradeAgreementDuty

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

The duty rate that applies for a trade agreement.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ TradeAgreementDuty

Returns a new instance of TradeAgreementDuty.



71813
71814
71815
71816
71817
71818
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71813

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:trade_agreement, :duty], 'TradeAgreementDuty')
  @trade_agreement = (x = opts.delete(:trade_agreement); x.is_a?(::Io::Flow::V0::Models::TradeAgreement) ? x : ::Io::Flow::V0::Models::TradeAgreement.new(x))
  @duty = (x = opts.delete(:duty); x.is_a?(::Io::Flow::V0::Models::Duty) ? x : ::Io::Flow::V0::Models::Duty.new(x))
end

Instance Attribute Details

#dutyObject (readonly)

Returns the value of attribute duty.



71811
71812
71813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71811

def duty
  @duty
end

#trade_agreementObject (readonly)

Returns the value of attribute trade_agreement.



71811
71812
71813
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71811

def trade_agreement
  @trade_agreement
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



71824
71825
71826
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71824

def copy(incoming={})
  TradeAgreementDuty.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



71828
71829
71830
71831
71832
71833
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71828

def to_hash
  {
    :trade_agreement => trade_agreement.to_hash,
    :duty => duty.to_hash
  }
end

#to_jsonObject



71820
71821
71822
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71820

def to_json
  JSON.dump(to_hash)
end