The Wayback Machine - https://web.archive.org/web/20200906130341/https://github.com/emaraschio/swapi-ruby/
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 

README.md

Swapi Ruby

A Ruby helper library for swapi.co - the Star Wars API

Darth Vader

Description

Documentation: http://swapi.co/documentation

Installation

$ gem install swapi

Basic Usage

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

Methods

These are the top-level methods you can use to get resources from swapi.co

get_person(people_id)

Return a single Person resource.

Example::

Swapi.get_person 1
>>> <Person - Luke Skywalker>

get_planet(planet_id)

Return a single Planet resource.

Example::

Swapi.get_planet 1
>>> <Planet - Tatooine>

get_starship(starship_id)

Return a single Starship resource.

Example::

Swapi.get_starship 6
>>> <Starship - Death Star>

get_vehicle(vehicle_id)

Return a single Vehicle resource.

Example::

Swapi.get_vehicle 4
>>> <Vehicle - Sand Crawler>

get_film(film_id)

Return a single Film resource.

Example::

Swapi.get_film 1
>>> <Film - A New Hope>

get_all("resource_type")

Return all the items in a single resource.

Example::

Swapi.get_all "films"

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.