Class: Idnow::IdentificationData

Inherits:
Object
  • Object
show all
Defined in:
lib/idnow/models/identification_data.rb

Defined Under Namespace

Modules: Gender

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ IdentificationData

Returns a new instance of IdentificationData.



19
20
21
22
23
24
25
# File 'lib/idnow/models/identification_data.rb', line 19

def initialize(params = {})
  params.keys.each do |key|
    raise ArgumentError, "Attribute #{key} is not supported!" unless respond_to?(key.to_sym)

    send("#{key}=", params[key])
  end
end

Instance Attribute Details

#birthnameObject

Returns the value of attribute birthname.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def birthname
  @birthname
end

#birthplaceObject

Returns the value of attribute birthplace.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def birthplace
  @birthplace
end

#cityObject

Returns the value of attribute city.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def city
  @city
end

#countryObject

Returns the value of attribute country.



17
18
19
# File 'lib/idnow/models/identification_data.rb', line 17

def country
  @country
end

#custom1Object

Returns the value of attribute custom1.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def custom1
  @custom1
end

#custom2Object

Returns the value of attribute custom2.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def custom2
  @custom2
end

#custom3Object

Returns the value of attribute custom3.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def custom3
  @custom3
end

#custom4Object

Returns the value of attribute custom4.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def custom4
  @custom4
end

#custom5Object

Returns the value of attribute custom5.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def custom5
  @custom5
end

#emailObject

Returns the value of attribute email.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def email
  @email
end

#firstnameObject

Returns the value of attribute firstname.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def firstname
  @firstname
end

#genderObject

Returns the value of attribute gender.



17
18
19
# File 'lib/idnow/models/identification_data.rb', line 17

def gender
  @gender
end

#lastnameObject

Returns the value of attribute lastname.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def lastname
  @lastname
end

#mobilephoneObject

Returns the value of attribute mobilephone.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def mobilephone
  @mobilephone
end

#nationalityObject

Returns the value of attribute nationality.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def nationality
  @nationality
end

#preferredLangObject

Returns the value of attribute preferredLang.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def preferredLang
  @preferredLang
end

#streetObject

Returns the value of attribute street.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def street
  @street
end

#streetnumberObject

Returns the value of attribute streetnumber.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def streetnumber
  @streetnumber
end

#titleObject

Returns the value of attribute title.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def title
  @title
end

#trackingidObject

Returns the value of attribute trackingid.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def trackingid
  @trackingid
end

#zipcodeObject

Returns the value of attribute zipcode.



12
13
14
# File 'lib/idnow/models/identification_data.rb', line 12

def zipcode
  @zipcode
end

Instance Method Details

#birthdayObject

Getter / Setter ############



37
38
39
# File 'lib/idnow/models/identification_data.rb', line 37

def birthday
  @birthday&.strftime('%Y-%m-%d')
end

#birthday=(birthday) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/idnow/models/identification_data.rb', line 41

def birthday=(birthday)
  @birthday = if birthday.instance_of?(Date) || birthday.instance_of?(DateTime)
                birthday
              else
                Date.parse(birthday)
              end
end

#to_jsonObject



27
28
29
30
31
32
33
# File 'lib/idnow/models/identification_data.rb', line 27

def to_json
  result = {}
  instance_variables.each do |attribute|
    result[attribute.to_s.delete('@')] = instance_variable_get(attribute)
  end
  result.to_json
end