Class: Io::Flow::V0::Models::DetailedTaxRegistration

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

Overview

Result of looking up a specific tax registration number. Includes details of both the consumer request and the VIES response.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ DetailedTaxRegistration

Returns a new instance of DetailedTaxRegistration.



30205
30206
30207
30208
30209
30210
30211
30212
30213
30214
30215
30216
30217
30218
30219
30220
30221
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30205

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :key, :number, :country, :success, :timestamp, :vies_result, :company_name_match_result], 'DetailedTaxRegistration')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @consumer_company_name = (x = opts.delete(:consumer_company_name); x.nil? ? nil : HttpClient::Preconditions.assert_class('consumer_company_name', x, String))
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @country = HttpClient::Preconditions.assert_class('country', opts.delete(:country), String)
  @success = HttpClient::Preconditions.assert_boolean('success', opts.delete(:success))
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @vies_result = (x = opts.delete(:vies_result); x.is_a?(::Io::Flow::V0::Models::TaxVerificationResult) ? x : ::Io::Flow::V0::Models::TaxVerificationResult.apply(x))
  @vies_result_reason = (x = opts.delete(:vies_result_reason); x.nil? ? nil : HttpClient::Preconditions.assert_class('vies_result_reason', x, String))
  @vies_company_name = (x = opts.delete(:vies_company_name); x.nil? ? nil : HttpClient::Preconditions.assert_class('vies_company_name', x, String))
  @vies_company_address = (x = opts.delete(:vies_company_address); x.nil? ? nil : HttpClient::Preconditions.assert_class('vies_company_address', x, String))
  @company_name_match_result = (x = opts.delete(:company_name_match_result); x.is_a?(::Io::Flow::V0::Models::TaxVerificationResult) ? x : ::Io::Flow::V0::Models::TaxVerificationResult.apply(x))
  @company_name_match_result_reason = (x = opts.delete(:company_name_match_result_reason); x.nil? ? nil : HttpClient::Preconditions.assert_class('company_name_match_result_reason', x, String))
end

Instance Attribute Details

#company_name_match_resultObject (readonly)

Returns the value of attribute company_name_match_result.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def company_name_match_result
  @company_name_match_result
end

#company_name_match_result_reasonObject (readonly)

Returns the value of attribute company_name_match_result_reason.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def company_name_match_result_reason
  @company_name_match_result_reason
end

#consumer_company_nameObject (readonly)

Returns the value of attribute consumer_company_name.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def consumer_company_name
  @consumer_company_name
end

#countryObject (readonly)

Returns the value of attribute country.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def country
  @country
end

#idObject (readonly)

Returns the value of attribute id.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def key
  @key
end

#numberObject (readonly)

Returns the value of attribute number.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def number
  @number
end

#successObject (readonly)

Returns the value of attribute success.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def success
  @success
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def timestamp
  @timestamp
end

#vies_company_addressObject (readonly)

Returns the value of attribute vies_company_address.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def vies_company_address
  @vies_company_address
end

#vies_company_nameObject (readonly)

Returns the value of attribute vies_company_name.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def vies_company_name
  @vies_company_name
end

#vies_resultObject (readonly)

Returns the value of attribute vies_result.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def vies_result
  @vies_result
end

#vies_result_reasonObject (readonly)

Returns the value of attribute vies_result_reason.



30203
30204
30205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30203

def vies_result_reason
  @vies_result_reason
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30227
30228
30229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30227

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

#to_hashObject



30231
30232
30233
30234
30235
30236
30237
30238
30239
30240
30241
30242
30243
30244
30245
30246
30247
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30231

def to_hash
  {
    :id => id,
    :key => key,
    :consumer_company_name => consumer_company_name,
    :number => number,
    :country => country,
    :success => success,
    :timestamp => timestamp,
    :vies_result => vies_result.value,
    :vies_result_reason => vies_result_reason,
    :vies_company_name => vies_company_name,
    :vies_company_address => vies_company_address,
    :company_name_match_result => company_name_match_result.value,
    :company_name_match_result_reason => company_name_match_result_reason
  }
end

#to_jsonObject



30223
30224
30225
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30223

def to_json
  JSON.dump(to_hash)
end