Project

swapi_dev

0.0
No release in over a year
Ruby wrapper for The Star Wars API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 5.19
~> 13.0, >= 13.0.6
~> 1.55, >= 1.55.1
~> 0.22.0
~> 3.18, >= 3.18.1
 Project Readme

SwapiDev

A Ruby wrapper for the Star Wars API

RubyGem

https://rubygems.org/gems/swapi_dev

Api documentation

here is the documentation of The Star War API

Installation

Add this line to your application's Gemfile:

gem 'swapi_dev'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install swapi_dev

Usage

First you need to require the gem

require "swapi_dev"

Methods

You will find methods for 6 diferent Resources, all of them with the same behavior:

  • Planets
  • Starships
  • Vehicles
  • People
  • Films
  • Species

Example using People

SwapiDev.people # accepts: format, page, search
SwapiDev.people_id(some_id) # accepts: format

Searching

All searches will use case-insensitive partial matches on the set of search fields.

# people search
SwapiDev.people(search: "Luke Skywalker")
# vehicle search
SwapiDev.vehicle(search: "Sand Crawler")

To see the set of search fields for each resource, check the table below:

Resource Fields
People name
Films title
Starships name, model
Vehicles name, model
Species name
Planets name

Pagination

You can pass a page argument if you want to get specific page.

SwapiDev.people(page: 2)

Format

This encoding is identical to JSON except with wookiee translations. All methods accept wookiee format keyword.

SwapiDev.people(format: :wookie)
SwapiDev.people(search: "Luke", format: :wookie)
SwapiDev.people_id(1, format: :wookie)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Eduardo-Lpz/swapi_dev. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the SwapiDev project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.