Skip to content

Simple Star Wars - Using public Star Wars api, return names of planets and characters.

Notifications You must be signed in to change notification settings

rvrichards/sswars

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Simple Star Wars - Using public Star Wars api, return names of planets and characters.

Resources

Stars

Watchers

Forks

Packages

No packages published