Class: Idnow::UserData

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Jsonable

#to_h, #to_json

Constructor Details

#initialize(data) ⇒ UserData

Returns a new instance of UserData.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/idnow/models/user_data.rb', line 8

def initialize(data)
  @birthday     = dig_value('birthday', data)
  @birthname    = dig_value('birthname', data)
  @birthplace   = dig_value('birthplace', data)
  @city         = dig_value('address', 'city', data)
  @country      = dig_value('address', 'country', data)
  @firstname    = dig_value('firstname', data)
  @gender       = dig_value('gender', data)
  @lastname     = dig_value('lastname', data)
  @nationality  = dig_value('nationality', data)
  @street       = dig_value('address', 'street', data)
  @streetnumber = dig_value('address', 'streetnumber', data)
  @title        = dig_value('title', data)
  @zipcode      = dig_value('address', 'zipcode', data)
end

Instance Attribute Details

#birthdayObject

Returns the value of attribute birthday.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def birthday
  @birthday
end

#birthnameObject

Returns the value of attribute birthname.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def birthname
  @birthname
end

#birthplaceObject

Returns the value of attribute birthplace.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def birthplace
  @birthplace
end

#cityObject

Returns the value of attribute city.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def city
  @city
end

#countryObject

Returns the value of attribute country.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def country
  @country
end

#firstnameObject

Returns the value of attribute firstname.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def firstname
  @firstname
end

#genderObject

Returns the value of attribute gender.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def gender
  @gender
end

#lastnameObject

Returns the value of attribute lastname.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def lastname
  @lastname
end

#nationalityObject

Returns the value of attribute nationality.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def nationality
  @nationality
end

#streetObject

Returns the value of attribute street.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def street
  @street
end

#streetnumberObject

Returns the value of attribute streetnumber.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def streetnumber
  @streetnumber
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def title
  @title
end

#zipcodeObject

Returns the value of attribute zipcode.



5
6
7
# File 'lib/idnow/models/user_data.rb', line 5

def zipcode
  @zipcode
end

Instance Method Details

#addressObject



24
25
26
# File 'lib/idnow/models/user_data.rb', line 24

def address
  "#{street} #{streetnumber}, #{zipcode} #{city}, #{country}"
end