Class: Pipl::API::Response::Person
- Inherits:
-
Object
- Object
- Pipl::API::Response::Person
- Defined in:
- lib/pipl/api/response/person.rb
Instance Attribute Summary collapse
-
#ages ⇒ Object
readonly
Returns the value of attribute ages.
-
#estimated_world_persons_count ⇒ Object
readonly
Returns the value of attribute estimated_world_persons_count.
-
#full_names ⇒ Object
readonly
Returns the value of attribute full_names.
-
#gender ⇒ Object
readonly
Returns the value of attribute gender.
-
#locations ⇒ Object
readonly
Returns the value of attribute locations.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nicknames ⇒ Object
readonly
Returns the value of attribute nicknames.
-
#spellings ⇒ Object
readonly
Returns the value of attribute spellings.
-
#translations ⇒ Object
readonly
Returns the value of attribute translations.
Instance Method Summary collapse
-
#initialize(data) ⇒ Person
constructor
A new instance of Person.
- #to_hash ⇒ Object (also: #to_h)
Constructor Details
#initialize(data) ⇒ Person
Returns a new instance of Person.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/pipl/api/response/person.rb', line 15 def initialize(data) @name = Name.new(data["name"]) @full_names = convert_names(data["full_names"]) @nicknames = convert_names(data["nicknames"]) @spellings = convert_names(data["spellings"]) @translations = convert_names(data["translations"]) @gender = Gender.new(data["gender"]) @locations = convert_locations(data["top_locations"]) @ages = convert_locations(data["top_ages"]) @estimated_world_persons_count = data["estimated_world_persons_count"] end |
Instance Attribute Details
#ages ⇒ Object (readonly)
Returns the value of attribute ages.
11 12 13 |
# File 'lib/pipl/api/response/person.rb', line 11 def ages @ages end |
#estimated_world_persons_count ⇒ Object (readonly)
Returns the value of attribute estimated_world_persons_count.
13 14 15 |
# File 'lib/pipl/api/response/person.rb', line 13 def estimated_world_persons_count @estimated_world_persons_count end |
#full_names ⇒ Object (readonly)
Returns the value of attribute full_names.
6 7 8 |
# File 'lib/pipl/api/response/person.rb', line 6 def full_names @full_names end |
#gender ⇒ Object (readonly)
Returns the value of attribute gender.
12 13 14 |
# File 'lib/pipl/api/response/person.rb', line 12 def gender @gender end |
#locations ⇒ Object (readonly)
Returns the value of attribute locations.
10 11 12 |
# File 'lib/pipl/api/response/person.rb', line 10 def locations @locations end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/pipl/api/response/person.rb', line 5 def name @name end |
#nicknames ⇒ Object (readonly)
Returns the value of attribute nicknames.
7 8 9 |
# File 'lib/pipl/api/response/person.rb', line 7 def nicknames @nicknames end |
#spellings ⇒ Object (readonly)
Returns the value of attribute spellings.
8 9 10 |
# File 'lib/pipl/api/response/person.rb', line 8 def spellings @spellings end |
#translations ⇒ Object (readonly)
Returns the value of attribute translations.
9 10 11 |
# File 'lib/pipl/api/response/person.rb', line 9 def translations @translations end |
Instance Method Details
#to_hash ⇒ Object Also known as: to_h
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pipl/api/response/person.rb', line 27 def to_hash { name: name.to_hash, full_names: full_names.map(&:to_hash), nicknames: nicknames.map(&:to_hash), spellings: spellings.map(&:to_hash), translations: translations.map(&:to_hash), gender: gender.to_hash, locations: locations.map(&:to_hash), ages: ages.map(&:to_hash), estimated_world_persons_count: estimated_world_persons_count } end |