potter_actors 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 +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +8 -0
- data/Gemfile +11 -0
- data/README.md +36 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/run +7 -0
- data/bin/setup +8 -0
- data/lib/.DS_Store +0 -0
- data/lib/environment.rb +11 -0
- data/lib/models/characters.rb +19 -0
- data/lib/services/api.rb +16 -0
- data/lib/services/cli.rb +80 -0
- data/lib/version.rb +3 -0
- data/potter_actors.gemspec +28 -0
- metadata +61 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 919d9616da9e7e8a667ef38cd10586f92ee403e21cbc469dde202280dfcd43ce
|
|
4
|
+
data.tar.gz: 89feb77ad064e85120616fc7d546871304bf98a19ec3beec6b4029e6664f3faa
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 902a2dccee085e9928191569a6f8bfb66e44104146eb12490a9f4880174e5d3d71c0836df621d5c0ea1410e2d0decd2a1501c53bbb92eed88a3cff7471d2eec8
|
|
7
|
+
data.tar.gz: 913c6a3e747b0dd498851bb370db5a6c2d5b9456f814e3909e353e2271344afc06ca71370343e53de292a7a82b7d759e212d24c1b86ba9999d6291bcd269107d
|
data/.DS_Store
ADDED
|
Binary file
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# PotterActors
|
|
2
|
+
|
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/potter_actors`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
4
|
+
|
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'potter_actors'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle install
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install potter_actors
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
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).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/potter_actors.
|
|
36
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "potter_actors"
|
|
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(__FILE__)
|
data/bin/run
ADDED
data/bin/setup
ADDED
data/lib/.DS_Store
ADDED
|
Binary file
|
data/lib/environment.rb
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'pry'
|
|
2
|
+
require 'rest-client'
|
|
3
|
+
require 'json'
|
|
4
|
+
require 'color_text'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
require_relative './models/characters.rb'
|
|
8
|
+
require_relative './services/api.rb'
|
|
9
|
+
require_relative './services/cli.rb'
|
|
10
|
+
|
|
11
|
+
# requires the above because they are constants we will need throughout our app
|
data/lib/services/api.rb
ADDED
data/lib/services/cli.rb
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
|
|
2
|
+
class Cli
|
|
3
|
+
|
|
4
|
+
def begin
|
|
5
|
+
puts ""
|
|
6
|
+
puts "Welcome to the Harry Potter Actor API! Here you can select a character and see the name of the actor who played them in the films.".neon
|
|
7
|
+
puts ""
|
|
8
|
+
puts "Please hold while the application loads the data...".neon
|
|
9
|
+
Api.get_data
|
|
10
|
+
puts ""
|
|
11
|
+
choose_menu
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def choose_menu
|
|
15
|
+
puts "Which character would you like to select?".neon
|
|
16
|
+
puts ""
|
|
17
|
+
list_characters
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def list_characters
|
|
21
|
+
Characters.all.each.with_index(1) do |character, index|
|
|
22
|
+
puts "#{index}. #{character.name}"
|
|
23
|
+
end
|
|
24
|
+
enter_choice
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def get_input
|
|
28
|
+
puts ""
|
|
29
|
+
print "Please enter the number of the character you wish to choose: ".neon
|
|
30
|
+
input = gets.chomp
|
|
31
|
+
input
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def enter_choice
|
|
35
|
+
input = get_input
|
|
36
|
+
|
|
37
|
+
if input.to_i.between?(1, Characters.all.length)
|
|
38
|
+
|
|
39
|
+
index = input.to_i - 1
|
|
40
|
+
character = Characters.all[index]
|
|
41
|
+
results(character)
|
|
42
|
+
elsif input == "exit"
|
|
43
|
+
exit_program
|
|
44
|
+
else
|
|
45
|
+
error
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def results(character)
|
|
51
|
+
puts "#{character.name} is played by #{character.actor}.".green
|
|
52
|
+
puts "Would you like to select another character?".neon
|
|
53
|
+
input = gets.chomp
|
|
54
|
+
if input.downcase == "yes"
|
|
55
|
+
choose_menu
|
|
56
|
+
elsif input.downcase == "no"
|
|
57
|
+
exit_program
|
|
58
|
+
elsif input.downcase == "exit"
|
|
59
|
+
exit_program
|
|
60
|
+
else
|
|
61
|
+
error
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def error
|
|
66
|
+
puts "Error--The value you have entered is not valid. Would you like to try again?".red
|
|
67
|
+
error_try_again = gets.chomp
|
|
68
|
+
if error_try_again.downcase == "yes"
|
|
69
|
+
get_input
|
|
70
|
+
else
|
|
71
|
+
exit_program
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def exit_program
|
|
76
|
+
puts "Goodbye!".yellow
|
|
77
|
+
exit
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
data/lib/version.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require_relative 'lib/version'
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = "potter_actors"
|
|
5
|
+
spec.version = PotterActors::VERSION
|
|
6
|
+
spec.authors = ["mccleskeyc"]
|
|
7
|
+
spec.email = ["mccleskeyc@gmail.com"]
|
|
8
|
+
|
|
9
|
+
spec.summary = %q{Choose a Harry Potter character to learn who the actor is that plays them.}
|
|
10
|
+
spec.description = %q{Provides user with list of Harry Potter actors that they can choose to provide the respective actor.}
|
|
11
|
+
spec.homepage = "https://github.com/mccleskeyc/potter-actors"
|
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
|
13
|
+
|
|
14
|
+
#spec.metadata["allowed_push_host"] = "http://mygemserver.com"
|
|
15
|
+
|
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/mccleskeyc/potter-actors"
|
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/mccleskeyc/potter-actors"
|
|
19
|
+
|
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
22
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
24
|
+
end
|
|
25
|
+
spec.bindir = "exe"
|
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
27
|
+
spec.require_paths = ["lib"]
|
|
28
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: potter_actors
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- mccleskeyc
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-12-05 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: Provides user with list of Harry Potter actors that they can choose to
|
|
14
|
+
provide the respective actor.
|
|
15
|
+
email:
|
|
16
|
+
- mccleskeyc@gmail.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- ".DS_Store"
|
|
22
|
+
- ".gitignore"
|
|
23
|
+
- Gemfile
|
|
24
|
+
- README.md
|
|
25
|
+
- Rakefile
|
|
26
|
+
- bin/console
|
|
27
|
+
- bin/run
|
|
28
|
+
- bin/setup
|
|
29
|
+
- lib/.DS_Store
|
|
30
|
+
- lib/environment.rb
|
|
31
|
+
- lib/models/characters.rb
|
|
32
|
+
- lib/services/api.rb
|
|
33
|
+
- lib/services/cli.rb
|
|
34
|
+
- lib/version.rb
|
|
35
|
+
- potter_actors.gemspec
|
|
36
|
+
homepage: https://github.com/mccleskeyc/potter-actors
|
|
37
|
+
licenses: []
|
|
38
|
+
metadata:
|
|
39
|
+
homepage_uri: https://github.com/mccleskeyc/potter-actors
|
|
40
|
+
source_code_uri: https://github.com/mccleskeyc/potter-actors
|
|
41
|
+
changelog_uri: https://github.com/mccleskeyc/potter-actors
|
|
42
|
+
post_install_message:
|
|
43
|
+
rdoc_options: []
|
|
44
|
+
require_paths:
|
|
45
|
+
- lib
|
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
47
|
+
requirements:
|
|
48
|
+
- - ">="
|
|
49
|
+
- !ruby/object:Gem::Version
|
|
50
|
+
version: 2.3.0
|
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
|
+
requirements:
|
|
53
|
+
- - ">="
|
|
54
|
+
- !ruby/object:Gem::Version
|
|
55
|
+
version: '0'
|
|
56
|
+
requirements: []
|
|
57
|
+
rubygems_version: 3.1.4
|
|
58
|
+
signing_key:
|
|
59
|
+
specification_version: 4
|
|
60
|
+
summary: Choose a Harry Potter character to learn who the actor is that plays them.
|
|
61
|
+
test_files: []
|