Project

swapi

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby helper library for swapi.co - the Star Wars API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

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"