Class: Io::Flow::V0::Models::TradeAgreementCertifier

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

Overview

Person or organization responsible for certifying an item complies with a trade agreement.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ TradeAgreementCertifier

Returns a new instance of TradeAgreementCertifier.



71776
71777
71778
71779
71780
71781
71782
71783
71784
71785
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71776

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:key, :name, :exporter_of_record], 'TradeAgreementCertifier')
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String)
  @exporter_of_record = (x = opts.delete(:exporter_of_record); x.is_a?(::Io::Flow::V0::Models::ExporterOfRecord) ? x : ::Io::Flow::V0::Models::ExporterOfRecord.apply(x))
  @contact = (x = opts.delete(:contact); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Contact) ? x : ::Io::Flow::V0::Models::Contact.new(x)))
  @address = (x = opts.delete(:address); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Address) ? x : ::Io::Flow::V0::Models::Address.new(x)))
  @signature_url = (x = opts.delete(:signature_url); x.nil? ? nil : HttpClient::Preconditions.assert_class('signature_url', x, String))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



71774
71775
71776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71774

def address
  @address
end

#contactObject (readonly)

Returns the value of attribute contact.



71774
71775
71776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71774

def contact
  @contact
end

#exporter_of_recordObject (readonly)

Returns the value of attribute exporter_of_record.



71774
71775
71776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71774

def exporter_of_record
  @exporter_of_record
end

#keyObject (readonly)

Returns the value of attribute key.



71774
71775
71776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71774

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



71774
71775
71776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71774

def name
  @name
end

#signature_urlObject (readonly)

Returns the value of attribute signature_url.



71774
71775
71776
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71774

def signature_url
  @signature_url
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



71791
71792
71793
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71791

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

#to_hashObject



71795
71796
71797
71798
71799
71800
71801
71802
71803
71804
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71795

def to_hash
  {
    :key => key,
    :name => name,
    :exporter_of_record => exporter_of_record.value,
    :contact => contact.nil? ? nil : contact.to_hash,
    :address => address.nil? ? nil : address.to_hash,
    :signature_url => signature_url
  }
end

#to_jsonObject



71787
71788
71789
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 71787

def to_json
  JSON.dump(to_hash)
end