Class: Starwars::Person
- Inherits:
-
Base
- Object
- OpenStruct
- Base
- Starwars::Person
- Defined in:
- lib/starwars/resources/person.rb,
lib/starwars.rb
Overview
A People resource is an individual person or character within the Star Wars universe.
Constant Summary collapse
- RESOURCE_NAME =
Define the source name in the starwars api
'people'
Constants inherited from Base
Instance Method Summary collapse
-
#birth_year ⇒ String
The birth year of the person.
-
#eye_color ⇒ String
The eye color of this person.
-
#films ⇒ Array<Film>
List of films.
-
#gender ⇒ String
The gender of this person.
-
#hair_color ⇒ String
The hair color of this person.
-
#height ⇒ Integer
The height of the person in centimeters.
-
#homeworld ⇒ Array<Planet>
List of homeworlds.
-
#mass ⇒ Integer
The mass of the person in kilograms.
-
#name ⇒ String
The name of this person.
-
#skin_color ⇒ String
The skin color of this person.
-
#species ⇒ Array<Specie>
List of species.
-
#starships ⇒ Array<Starship>
List of tarships.
-
#vehicles ⇒ Array<Vehicle>
List of vehicles.
Methods inherited from Base
#==, #created, #edited, fetch, #fetch, fetch_all, #id, #request_attributes, #url
Methods inherited from OpenStruct
Instance Method Details
#birth_year ⇒ String
using the in-universe standard of
The birth year of the person
BBY or ABY - Before the Battle of Yavin or After the Battle of Yavin. The Battle of Yavin is a battle that occurs at the end of Star Wars episode IV: A New Hope
61 |
# File 'lib/starwars/resources/person.rb', line 61 property :birth_year |
#eye_color ⇒ String
Will be “unknown” if not known or “n/a” if the person does not have an eye
The eye color of this person
35 |
# File 'lib/starwars/resources/person.rb', line 35 property :eye_color |
#films ⇒ Array<Film>
List of films
101 |
# File 'lib/starwars/resources/person.rb', line 101 collection :films, class: Starwars::Film, deserialize: ->(_, fragment, _) { Film.new(url: fragment) } |
#gender ⇒ String
Either “Male”, “Female” or “unknown”, “n/a” if the person does not have a gender
The gender of this person
73 |
# File 'lib/starwars/resources/person.rb', line 73 property :gender |
#hair_color ⇒ String
The hair color of this person
@note: Will be “unknown” if not known or “n/a”
if the person does not have hair
47 |
# File 'lib/starwars/resources/person.rb', line 47 property :hair_color |
#height ⇒ Integer
The height of the person in centimeters
80 |
# File 'lib/starwars/resources/person.rb', line 80 property :height, type: Integer |
#homeworld ⇒ Array<Planet>
List of homeworlds
94 |
# File 'lib/starwars/resources/person.rb', line 94 property :homeworld, class: Starwars::Planet, deserialize: ->(_, fragment, _) { Planet.new(url: fragment) } |
#mass ⇒ Integer
The mass of the person in kilograms
87 |
# File 'lib/starwars/resources/person.rb', line 87 property :mass, type: Integer |
#name ⇒ String
The name of this person
16 |
# File 'lib/starwars/resources/person.rb', line 16 property :name |
#skin_color ⇒ String
The skin color of this person
23 |
# File 'lib/starwars/resources/person.rb', line 23 property :skin_color |
#species ⇒ Array<Specie>
List of species
108 |
# File 'lib/starwars/resources/person.rb', line 108 collection :species, class: Starwars::Specie, deserialize: ->(_, fragment, _) { Specie.new(url: fragment) } |