Class: AeUsersMigrator::Import::Person
- Inherits:
-
Object
- Object
- AeUsersMigrator::Import::Person
- Defined in:
- lib/ae_users_migrator/import.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Returns the value of attribute account.
-
#best_call_time ⇒ Object
Returns the value of attribute best_call_time.
-
#birthdate ⇒ Object
Returns the value of attribute birthdate.
-
#email_addresses ⇒ Object
readonly
Returns the value of attribute email_addresses.
-
#firstname ⇒ Object
Returns the value of attribute firstname.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lastname ⇒ Object
Returns the value of attribute lastname.
-
#nickname ⇒ Object
Returns the value of attribute nickname.
-
#open_id_identities ⇒ Object
readonly
Returns the value of attribute open_id_identities.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
Instance Method Summary collapse
-
#initialize(json) ⇒ Person
constructor
A new instance of Person.
- #primary_email_address ⇒ Object
Constructor Details
#initialize(json) ⇒ Person
Returns a new instance of Person.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ae_users_migrator/import.rb', line 49 def initialize(json) @email_addresses = json["email_addresses"].collect do |ea_record| EmailAddress.new(ea_record["email_address"] || ea_record) end @open_id_identities = json["open_id_identities"].collect do |oid_record| OpenIdIdentity.new(oid_record["open_id_identity"] || oid_record) end @roles = json["roles"].collect do |role_record| rr = Role.new(role_record["role"] || role_record) end if json["account"] @account = Account.new(json["account"]["account"] || json["account"]) end %w{nickname birthdate gender id firstname lastname phone best_call_time}.each do |f| self.send("#{f}=", json[f]) end end |
Instance Attribute Details
#account ⇒ Object (readonly)
Returns the value of attribute account.
46 47 48 |
# File 'lib/ae_users_migrator/import.rb', line 46 def account @account end |
#best_call_time ⇒ Object
Returns the value of attribute best_call_time.
47 48 49 |
# File 'lib/ae_users_migrator/import.rb', line 47 def best_call_time @best_call_time end |
#birthdate ⇒ Object
Returns the value of attribute birthdate.
47 48 49 |
# File 'lib/ae_users_migrator/import.rb', line 47 def birthdate @birthdate end |
#email_addresses ⇒ Object (readonly)
Returns the value of attribute email_addresses.
46 47 48 |
# File 'lib/ae_users_migrator/import.rb', line 46 def email_addresses @email_addresses end |
#firstname ⇒ Object
Returns the value of attribute firstname.
47 48 49 |
# File 'lib/ae_users_migrator/import.rb', line 47 def firstname @firstname end |
#gender ⇒ Object
Returns the value of attribute gender.
47 48 49 |
# File 'lib/ae_users_migrator/import.rb', line 47 def gender @gender end |
#id ⇒ Object
Returns the value of attribute id.
47 48 49 |
# File 'lib/ae_users_migrator/import.rb', line 47 def id @id end |
#lastname ⇒ Object
Returns the value of attribute lastname.
47 48 49 |
# File 'lib/ae_users_migrator/import.rb', line 47 def lastname @lastname end |
#nickname ⇒ Object
Returns the value of attribute nickname.
47 48 49 |
# File 'lib/ae_users_migrator/import.rb', line 47 def nickname @nickname end |
#open_id_identities ⇒ Object (readonly)
Returns the value of attribute open_id_identities.
46 47 48 |
# File 'lib/ae_users_migrator/import.rb', line 46 def open_id_identities @open_id_identities end |
#phone ⇒ Object
Returns the value of attribute phone.
47 48 49 |
# File 'lib/ae_users_migrator/import.rb', line 47 def phone @phone end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
46 47 48 |
# File 'lib/ae_users_migrator/import.rb', line 46 def roles @roles end |
Instance Method Details
#primary_email_address ⇒ Object
72 73 74 |
# File 'lib/ae_users_migrator/import.rb', line 72 def primary_email_address @email_addresses.select { |ea| ea.primary }.first || @email_addresses.first end |