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.



66636
66637
66638
66639
66640
66641
66642
66643
66644
66645
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66636

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.



66634
66635
66636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66634

def address
  @address
end

#contactObject (readonly)

Returns the value of attribute contact.



66634
66635
66636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66634

def contact
  @contact
end

#exporter_of_recordObject (readonly)

Returns the value of attribute exporter_of_record.



66634
66635
66636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66634

def exporter_of_record
  @exporter_of_record
end

#keyObject (readonly)

Returns the value of attribute key.



66634
66635
66636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66634

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



66634
66635
66636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66634

def name
  @name
end

#signature_urlObject (readonly)

Returns the value of attribute signature_url.



66634
66635
66636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66634

def signature_url
  @signature_url
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



66651
66652
66653
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66651

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

#to_hashObject



66655
66656
66657
66658
66659
66660
66661
66662
66663
66664
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66655

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



66647
66648
66649
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 66647

def to_json
  JSON.dump(to_hash)
end