Class: Io::Flow::V0::Models::TaxRegistration

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. Indicates validity of a number for a specific country and (if valid) the associated person/company.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ TaxRegistration

Returns a new instance of TaxRegistration.



41093
41094
41095
41096
41097
41098
41099
41100
41101
41102
41103
41104
41105
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41093

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :key, :number, :timestamp, :result], 'TaxRegistration')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @key = HttpClient::Preconditions.assert_class('key', opts.delete(:key), String)
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @result = (x = opts.delete(:result); x.is_a?(::Io::Flow::V0::Models::TaxVerificationResult) ? x : ::Io::Flow::V0::Models::TaxVerificationResult.apply(x))
  @result_reason = (x = opts.delete(:result_reason); x.nil? ? nil : HttpClient::Preconditions.assert_class('result_reason', x, String))
  @name = (x = opts.delete(:name); x.nil? ? nil : HttpClient::Preconditions.assert_class('name', x, String))
  @address = (x = opts.delete(:address); x.nil? ? nil : HttpClient::Preconditions.assert_class('address', x, String))
  @company_name = (x = opts.delete(:company_name); x.nil? ? nil : HttpClient::Preconditions.assert_class('company_name', x, String))
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



41091
41092
41093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41091

def address
  @address
end

#company_nameObject (readonly)

Returns the value of attribute company_name.



41091
41092
41093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41091

def company_name
  @company_name
end

#idObject (readonly)

Returns the value of attribute id.



41091
41092
41093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41091

def id
  @id
end

#keyObject (readonly)

Returns the value of attribute key.



41091
41092
41093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41091

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



41091
41092
41093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41091

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



41091
41092
41093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41091

def number
  @number
end

#resultObject (readonly)

Returns the value of attribute result.



41091
41092
41093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41091

def result
  @result
end

#result_reasonObject (readonly)

Returns the value of attribute result_reason.



41091
41092
41093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41091

def result_reason
  @result_reason
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



41091
41092
41093
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41091

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



41111
41112
41113
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41111

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

#to_hashObject



41115
41116
41117
41118
41119
41120
41121
41122
41123
41124
41125
41126
41127
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41115

def to_hash
  {
    :id => id,
    :key => key,
    :number => number,
    :timestamp => timestamp,
    :result => result.value,
    :result_reason => result_reason,
    :name => name,
    :address => address,
    :company_name => company_name
  }
end

#to_jsonObject



41107
41108
41109
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41107

def to_json
  JSON.dump(to_hash)
end