Class: Idnow::IdentificationDocument

Inherits:
Object
  • Object
show all
Includes:
Jsonable
Defined in:
lib/idnow/models/identification_document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Jsonable

#to_h, #to_json

Constructor Details

#initialize(data) ⇒ IdentificationDocument

Returns a new instance of IdentificationDocument.



10
11
12
13
14
15
16
17
# File 'lib/idnow/models/identification_document.rb', line 10

def initialize(data)
  @country     = data.dig('country', 'value')
  @number      = data.dig('number', 'value')
  @issued_by   = data.dig('issuedby', 'value')
  @date_issued = data.dig('dateissued', 'value')
  @type        = data.dig('type', 'value')
  @valid_until = data.dig('validuntil', 'value')
end

Instance Attribute Details

#countryObject

Returns the value of attribute country.



7
8
9
# File 'lib/idnow/models/identification_document.rb', line 7

def country
  @country
end

#date_issuedObject



19
20
21
# File 'lib/idnow/models/identification_document.rb', line 19

def date_issued
  Date.parse(@date_issued) if @date_issued
end

#issued_byObject

Returns the value of attribute issued_by.



7
8
9
# File 'lib/idnow/models/identification_document.rb', line 7

def issued_by
  @issued_by
end

#numberObject

Returns the value of attribute number.



7
8
9
# File 'lib/idnow/models/identification_document.rb', line 7

def number
  @number
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/idnow/models/identification_document.rb', line 7

def type
  @type
end

#valid_untilObject



23
24
25
# File 'lib/idnow/models/identification_document.rb', line 23

def valid_until
  Date.parse(@valid_until) if @valid_until
end