Class: Idnow::UserData
- Inherits:
-
Object
- Object
- Idnow::UserData
- Includes:
- Jsonable
- Defined in:
- lib/idnow/models/user_data.rb
Instance Attribute Summary collapse
-
#birthday ⇒ Object
Returns the value of attribute birthday.
-
#birthname ⇒ Object
Returns the value of attribute birthname.
-
#birthplace ⇒ Object
Returns the value of attribute birthplace.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#firstname ⇒ Object
Returns the value of attribute firstname.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#lastname ⇒ Object
Returns the value of attribute lastname.
-
#nationality ⇒ Object
Returns the value of attribute nationality.
-
#street ⇒ Object
Returns the value of attribute street.
-
#streetnumber ⇒ Object
Returns the value of attribute streetnumber.
-
#title ⇒ Object
Returns the value of attribute title.
-
#zipcode ⇒ Object
Returns the value of attribute zipcode.
Instance Method Summary collapse
- #address ⇒ Object
- #address_changed? ⇒ Boolean
-
#initialize(data) ⇒ UserData
constructor
A new instance of UserData.
Methods included from Jsonable
Constructor Details
#initialize(data) ⇒ UserData
Returns a new instance of UserData.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/idnow/models/user_data.rb', line 10 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) @raw_data = data end |
Instance Attribute Details
#birthday ⇒ Object
Returns the value of attribute birthday.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def birthday @birthday end |
#birthname ⇒ Object
Returns the value of attribute birthname.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def birthname @birthname end |
#birthplace ⇒ Object
Returns the value of attribute birthplace.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def birthplace @birthplace end |
#city ⇒ Object
Returns the value of attribute city.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def country @country end |
#firstname ⇒ Object
Returns the value of attribute firstname.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def firstname @firstname end |
#gender ⇒ Object
Returns the value of attribute gender.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def gender @gender end |
#lastname ⇒ Object
Returns the value of attribute lastname.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def lastname @lastname end |
#nationality ⇒ Object
Returns the value of attribute nationality.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def nationality @nationality end |
#street ⇒ Object
Returns the value of attribute street.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def street @street end |
#streetnumber ⇒ Object
Returns the value of attribute streetnumber.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def streetnumber @streetnumber end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def title @title end |
#zipcode ⇒ Object
Returns the value of attribute zipcode.
7 8 9 |
# File 'lib/idnow/models/user_data.rb', line 7 def zipcode @zipcode end |
Instance Method Details
#address ⇒ Object
27 28 29 |
# File 'lib/idnow/models/user_data.rb', line 27 def address "#{street} #{streetnumber}, #{zipcode} #{city}, #{country}" end |
#address_changed? ⇒ Boolean
31 32 33 |
# File 'lib/idnow/models/user_data.rb', line 31 def address_changed? @raw_data['address'].values.any? { |field| field['status'] == 'CHANGE' } end |