Project

sswars

0.0
No commit activity in last 3 years
No release in over 3 years
Using the public Star Wars api (swapi.co) return character and planet names.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 10.0

Runtime

~> 0.14.0
 Project Readme

Sswars

This gem is a simple Star Wars name progeram. It grabs the names of Star Wars characters and planets from the public Star Wars api site: http://swapi.co

It only has two public calls

  • find_people(#)
  • find_planet(#)

If there is no planet or person with that number an empty hash is returned.

My development notes

  1. First run the command: bundle gem sswars
  2. Change into that directory
  3. Edit the file sswars.gemspec with appropriate information.
  4. Edit the file lib/sswars.rb with the Ruby code to do the work.
  • The module name should be: module Sswars
  • Include gem "httparty"
  • Create two methods: find_person() and find_planet
  1. Test execution in IRB.
  • In IRB run: require_relative 'lib/sswars' - should return true.
  • In IRB test by running: Sswars.find_people(2) - should return => "C-3PO"
  • In IRB test by running: Sswars.find_planet(42) - should return => "Haruun Kal"
  1. Create local git repo and commit. Push to Github.
  1. Create gem, run:
  • bundle
  • gem build sswars.gemspec
  1. Install gem locally and test
  • To install: gem install ./sswars-0.1.0.gem
  • In IRB you only have to type: require sswars
  1. Now push to RubyGem.org
  1. Profit!

Add this line to your application's Gemfile:

gem 'sswars'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sswars

Usage

This was just for fun & learning.

Development

None planned now.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rtfminc/sswars.