Module: Metropol::LegalId

Included in:
Client, Request
Defined in:
lib/metropol/legal_id.rb

Constant Summary collapse

ID_TYPES =
{
  national_id: '001',
  passport: '002',
  service_id: '003',
  alien_registration: '004',
  company_id: '005'
}.freeze

Instance Method Summary collapse

Instance Method Details

#code_for(id_type) ⇒ Object

Return the Metropol code for a given legal identity type



14
15
16
17
18
19
20
21
# File 'lib/metropol/legal_id.rb', line 14

def code_for(id_type)
  if valid_id? id_type
    return ID_TYPES[id_type]
  else
    raise(ArgumentError,
          'Invalid id_type. Please use a valid id_type for e.g. :national_id')
  end
end

#valid_id?(id_type) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/metropol/legal_id.rb', line 23

def valid_id?(id_type)
  return ID_TYPES.has_key? id_type
end