Module: Swapi

Defined in:
lib/swapi.rb

Constant Summary collapse

BASE_URL =
'http://swapi.co/api'
PLANETS =
'planets'
PEOPLE =
'people'
STARSHIPS =
'starships'
VEHICLES =
'vehicles'
SPECIES =
'species'
FILMS =
'films'

Class Method Summary collapse

Class Method Details

.get_all(type) ⇒ Object



13
14
15
# File 'lib/swapi.rb', line 13

def get_all(type)
  get type
end

.get_film(film_id) ⇒ Object



37
38
39
# File 'lib/swapi.rb', line 37

def get_film(film_id)
  get FILMS, film_id
end

.get_person(people_id) ⇒ Object



21
22
23
# File 'lib/swapi.rb', line 21

def get_person(people_id)
  get PEOPLE, people_id
end

.get_planet(planet_id) ⇒ Object



17
18
19
# File 'lib/swapi.rb', line 17

def get_planet(planet_id)
  get PLANETS, planet_id
end

.get_species(species_id) ⇒ Object



33
34
35
# File 'lib/swapi.rb', line 33

def get_species(species_id)
  get SPECIES, species_id
end

.get_starship(starship_id) ⇒ Object



25
26
27
# File 'lib/swapi.rb', line 25

def get_starship(starship_id)
  get STARSHIPS, starship_id
end

.get_vehicle(vehicle_id) ⇒ Object



29
30
31
# File 'lib/swapi.rb', line 29

def get_vehicle(vehicle_id)
  get VEHICLES, vehicle_id
end