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.



41115
41116
41117
41118
41119
41120
41121
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41115

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.



41113
41114
41115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41113

def issuing_country
  @issuing_country
end

#nameObject (readonly)

Returns the value of attribute name.



41113
41114
41115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41113

def name
  @name
end

#numberObject (readonly)

Returns the value of attribute number.



41113
41114
41115
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41113

def number
  @number
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



41127
41128
41129
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41127

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

#to_hashObject



41131
41132
41133
41134
41135
41136
41137
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41131

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

#to_jsonObject



41123
41124
41125
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41123

def to_json
  JSON.dump(to_hash)
end