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.



14
15
16
17
18
19
20
# File 'lib/idnow/models/identification_data.rb', line 14

def initialize(params = {})
  params.keys.each do |key|
    fail 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.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def birthname
  @birthname
end

#birthplaceObject

Returns the value of attribute birthplace.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def birthplace
  @birthplace
end

#cityObject

Returns the value of attribute city.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def city
  @city
end

#countryObject

Returns the value of attribute country.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def country
  @country
end

#custom1Object

Returns the value of attribute custom1.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def custom1
  @custom1
end

#custom2Object

Returns the value of attribute custom2.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def custom2
  @custom2
end

#custom3Object

Returns the value of attribute custom3.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def custom3
  @custom3
end

#custom4Object

Returns the value of attribute custom4.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def custom4
  @custom4
end

#custom5Object

Returns the value of attribute custom5.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def custom5
  @custom5
end

#emailObject

Returns the value of attribute email.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def email
  @email
end

#firstnameObject

Returns the value of attribute firstname.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def firstname
  @firstname
end

#genderObject

Returns the value of attribute gender.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def gender
  @gender
end

#lastnameObject

Returns the value of attribute lastname.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def lastname
  @lastname
end

#mobilephoneObject

Returns the value of attribute mobilephone.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def mobilephone
  @mobilephone
end

#nationalityObject

Returns the value of attribute nationality.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def nationality
  @nationality
end

#streetObject

Returns the value of attribute street.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def street
  @street
end

#streetnumberObject

Returns the value of attribute streetnumber.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def streetnumber
  @streetnumber
end

#titleObject

Returns the value of attribute title.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def title
  @title
end

#trackingidObject

Returns the value of attribute trackingid.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def trackingid
  @trackingid
end

#zipcodeObject

Returns the value of attribute zipcode.



10
11
12
# File 'lib/idnow/models/identification_data.rb', line 10

def zipcode
  @zipcode
end

Instance Method Details

#birthdayObject

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



32
33
34
# File 'lib/idnow/models/identification_data.rb', line 32

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

#birthday=(birthday) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/idnow/models/identification_data.rb', line 36

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

#to_jsonObject



22
23
24
25
26
27
28
# File 'lib/idnow/models/identification_data.rb', line 22

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