A Ruby helper library for swapi.co - the Star Wars API
Documentation: http://swapi.co/documentation
$ gem install swapi
require "swapi"
# Will print a JSON response with Luke Skywalker information
luke = Swapi.get_person 1
# Will print a JSON response with Tatooine specs
tatooine = Swapi.get_planet 1
These are the top-level methods you can use to get resources from swapi.co
Return a single Person
resource.
Example::
Swapi.get_person 1
>>> <Person - Luke Skywalker>
Return a single Planet
resource.
Example::
Swapi.get_planet 1
>>> <Planet - Tatooine>
Return a single Starship
resource.
Example::
Swapi.get_starship 6
>>> <Starship - Death Star>
Return a single Vehicle
resource.
Example::
Swapi.get_vehicle 4
>>> <Vehicle - Sand Crawler>
Return a single Film
resource.
Example::
Swapi.get_film 1
>>> <Film - A New Hope>
Return all the items in a single resource.
Example::
Swapi.get_all "films"