A Ruby interface to SWAPI (the Star Wars API).
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore Initial commit Feb 17, 2015
.travis.yml
CHANGELOG.md
Gemfile
LICENSE.txt Initial commit Feb 17, 2015
README.md Adds build status indicator Feb 17, 2015
Rakefile
tatooine.gemspec

README.md

Tatooine

A Ruby interface to SWAPI (the Star Wars API).

Build Status

Installation

Add this line to your application's Gemfile:

gem 'tatooine'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tatooine

Usage

There are 6 resources available: Planets, Starships, Vehicles, People, Films and Species. They all have a similar interface.

planets = Tatooine::Planet.list
Tatooine::Planet.count
# => 60
planets.length
# => 10 # resources are paginated
planets.concat Tatooine::Planet.next
planets.length
# => 20

tatooine = Tatooine::Planet.get(1)
tatooine.name
# => "Tatooine"
tatooine.residents
# => [<Tatooine::Person>, ...]
tatooine.residents.first.name
# => "Luke Skywalker" # Will make the request to get the resource

Schema

In SWAPI the objects are described by their schemas. Check the SWAPI documentation to find out more about each of the objects.

Contributing

  1. Fork it ( https://github.com/philnash/tatooine/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request