Starwars
A Ruby interface for http://swapi.co/ - the Star Wars API

API Support
- [x] Films API
- [x] People API
- [x] Planet API
- [x] Species API
- [x] Vehicles API
- [x] Starship API
Installation
Add this line to your application's Gemfile:
gem 'starwars'
And then execute:
$ bundle
Or install it yourself as:
$ gem install starwars
Usage
require "starwars"
luke = Starwars::Person.fetch(1)
puts luke.name
puts luke.height
falcon = Starwars::Spaceship.new(id: 10)
falcon.fetch
puts falcon.name
puts falcon.pilots
you can also nest the quries, such as:
falcon.pilots.each do |piolt|
puts piolt.fetch.name
end
You can load a resouce by url:
aldeeran = Starwars::Planet.new(url: 'http://swapi.co/api/planets/3/').fetch
puts aldeeran.name
puts aldeeran.residents
puts aldeeran.population
Contributing
- Fork it ( https://github.com/moski/starwars/fork )
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request