Class: Io::Flow::V0::Models::EntityIdentifier

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

Overview

Tax identifier could be associated to a merchant of record entity.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ EntityIdentifier

Returns a new instance of EntityIdentifier.



36111
36112
36113
36114
36115
36116
36117
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36111

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:name, :number], 'EntityIdentifier')
  @name = (x = opts.delete(:name); x.is_a?(::Io::Flow::V0::Models::EntityIdentifierType) ? x : ::Io::Flow::V0::Models::EntityIdentifierType.apply(x))
  @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String)
  @issuing_country = (x = opts.delete(:issuing_country); x.nil? ? nil : HttpClient::Preconditions.assert_class('issuing_country', x, String))
end

Instance Attribute Details

#issuing_countryObject (readonly)

Returns the value of attribute issuing_country.



36109
36110
36111
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36109

def issuing_country
  @issuing_country
end

#nameObject (readonly)

Returns the value of attribute name.



36109
36110
36111
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36109

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



36109
36110
36111
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36109

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



36123
36124
36125
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36123

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

#to_hashObject



36127
36128
36129
36130
36131
36132
36133
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36127

def to_hash
  {
    :name => name.value,
    :number => number,
    :issuing_country => issuing_country
  }
end

#to_jsonObject



36119
36120
36121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 36119

def to_json
  JSON.dump(to_hash)
end