sswars 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4170abab56985212fa95a3a19d92c38ff3f7f6c2
4
+ data.tar.gz: 91016e6c421673271d393550812cbd5c1c3648e9
5
+ SHA512:
6
+ metadata.gz: bfe956f2036520123352776a2366eaa4d36845b4f7ab092f62ff2ae5282d1938645959f20e326dd99bdd11aa8654f2e896cb76fe492cd8d459b2891f7c3d4d8d
7
+ data.tar.gz: 4419be1703a2c1b028a8848eea63363a694336ada77892ca7fc496b8a8359d02aef959a917165de12a7dc92be211729a37f0822126efcb12f80dad21bda06218
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sswars.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Sswars
2
+
3
+ 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
4
+
5
+ It only has two public calls
6
+ * find_people(#)
7
+ * find_planet(#)
8
+
9
+ If there is no planet or person with that number an empty hash is returned.
10
+
11
+ ## My development notes
12
+
13
+ 1. First run the command: bundle gem sswars
14
+ 2. Change into that directory
15
+ 3. Edit the file **sswars.gemspec** with appropriate information.
16
+ 4. Edit the file **lib/sswars.rb** with the Ruby code to do the work.
17
+ * The module name should be: **module Sswars**
18
+ * Include gem "httparty"
19
+ * Create two methods: find_person() and find_planet
20
+ 5. Test execution in IRB.
21
+ * In IRB run: **require_relative 'lib/sswars'** - should return true.
22
+ * In IRB test by running: **Sswars.find_people(2)** - should return => "C-3PO"
23
+ * In IRB test by running: **Sswars.find_planet(42)** - should return => "Haruun Kal"
24
+ 6. Create local git repo and commit. Push to Github.
25
+ * Github: git@github.com:rvrichards/sswars.git
26
+ 7. Create gem, run:
27
+ * **bundle**
28
+ * **rake release**
29
+
30
+
31
+
32
+ Add this line to your application's Gemfile:
33
+
34
+ ```ruby
35
+ gem 'sswars'
36
+ ```
37
+
38
+ And then execute:
39
+
40
+ $ bundle
41
+
42
+ Or install it yourself as:
43
+
44
+ $ gem install sswars
45
+
46
+ ## Usage
47
+
48
+ TODO: Write usage instructions here
49
+
50
+ ## Development
51
+
52
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+
54
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+
56
+ ## Contributing
57
+
58
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rtfminc/sswars.
59
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sswars"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ module Sswars
2
+ VERSION = "0.1.0"
3
+ end
data/lib/sswars.rb ADDED
@@ -0,0 +1,24 @@
1
+ require "./lib/sswars/version"
2
+ require "httparty"
3
+
4
+ module Sswars
5
+ include HTTParty
6
+ base_uri "http://swapi.co/api/"
7
+ # base_uri "animatedgif.me"
8
+
9
+ # Class method
10
+ def self.find_people(id)
11
+ get_name get("/people/#{id}")
12
+ # get("/people/#{id}").parsed_response["name"]
13
+ end
14
+
15
+ def self.find_planet(id)
16
+ # get("/planets/#{id}").parsed_response["name"]
17
+ get_name get("/planets/#{id}")
18
+ end
19
+
20
+ private
21
+ def self.get_name(response)
22
+ response.parsed_response["name"]
23
+ end
24
+ end
data/sswars.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sswars/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sswars"
8
+ spec.version = Sswars::VERSION
9
+ spec.authors = ["Rob Richards"]
10
+ spec.email = ["(rtfminc@gmail.com)"]
11
+
12
+ spec.summary = %q{Simple Star Wars name finder.}
13
+ spec.description = %q{Using the public Star Wars api (swapi.co) return character and planet names.}
14
+ spec.homepage = "https://github.com/rvrichards/sswars."
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.13"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+
27
+ spec.add_dependency 'httparty', '~> 0.14.0'
28
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sswars
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Rob Richards
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: httparty
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.14.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.14.0
55
+ description: Using the public Star Wars api (swapi.co) return character and planet
56
+ names.
57
+ email:
58
+ - "(rtfminc@gmail.com)"
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - README.md
66
+ - Rakefile
67
+ - bin/console
68
+ - bin/setup
69
+ - lib/sswars.rb
70
+ - lib/sswars/version.rb
71
+ - sswars.gemspec
72
+ homepage: https://github.com/rvrichards/sswars.
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.5.1
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Simple Star Wars name finder.
96
+ test_files: []