akc_dog_breeds 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +45 -0
- data/LICENSE.txt +21 -0
- data/NOTES.md +8 -0
- data/README.md +41 -0
- data/Rakefile +6 -0
- data/akc_dog_breeds.gemspec +41 -0
- data/bin/console +14 -0
- data/bin/dog-breeds +5 -0
- data/bin/setup +8 -0
- data/lib/dog_breeds.rb +9 -0
- data/lib/dog_breeds/breed_details.rb +68 -0
- data/lib/dog_breeds/breeds.rb +131 -0
- data/lib/dog_breeds/cli.rb +43 -0
- data/lib/dog_breeds/groups.rb +30 -0
- data/lib/dog_breeds/version.rb +3 -0
- data/spec.md +19 -0
- metadata +137 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f8bcef40924a605481292245db2926d59391b425a753bc225224d48ca3090a1c
|
4
|
+
data.tar.gz: 41eab1b922e6cf970b78f70fa415535d0eeb6e85854353cdcfcd1baf0694b140
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d6bca36c7d73c09db27acfa3ab0283d70dfc346b7f32725ff7e4650ec29d07ddd3f4bdb5bd8a7796da9df9aa40b3dd0e48d07a9236a04d8e150ab338a6a7d6b7
|
7
|
+
data.tar.gz: 6fb8df31a0531b087276123c398241397f63c5c3e8d3519d6c91f68a2a6e81556a2295c7ed12093d59d0a0c47819a4cc2b908e3c85068f16b516df4e20d621ca
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
dog_breeds (0.1.0)
|
5
|
+
nokogiri
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coderay (1.1.2)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
method_source (0.9.0)
|
13
|
+
mini_portile2 (2.3.0)
|
14
|
+
nokogiri (1.8.2)
|
15
|
+
mini_portile2 (~> 2.3.0)
|
16
|
+
pry (0.11.3)
|
17
|
+
coderay (~> 1.1.0)
|
18
|
+
method_source (~> 0.9.0)
|
19
|
+
rake (10.5.0)
|
20
|
+
rspec (3.7.0)
|
21
|
+
rspec-core (~> 3.7.0)
|
22
|
+
rspec-expectations (~> 3.7.0)
|
23
|
+
rspec-mocks (~> 3.7.0)
|
24
|
+
rspec-core (3.7.1)
|
25
|
+
rspec-support (~> 3.7.0)
|
26
|
+
rspec-expectations (3.7.0)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.7.0)
|
29
|
+
rspec-mocks (3.7.0)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.7.0)
|
32
|
+
rspec-support (3.7.1)
|
33
|
+
|
34
|
+
PLATFORMS
|
35
|
+
ruby
|
36
|
+
|
37
|
+
DEPENDENCIES
|
38
|
+
bundler (~> 1.16)
|
39
|
+
dog_breeds!
|
40
|
+
pry
|
41
|
+
rake (~> 10.0)
|
42
|
+
rspec (~> 3.0)
|
43
|
+
|
44
|
+
BUNDLED WITH
|
45
|
+
1.16.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 <bethurban>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/NOTES.md
ADDED
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# DogBreeds
|
2
|
+
|
3
|
+
Welcome to the DogBreeds gem! This program shows the user a list of the American
|
4
|
+
Kennel Club's groups of dog breeds. The user can see all of the breeds within a
|
5
|
+
chosen group and then get details on the characteristics of each breed.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'dog_breeds'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install dog_breeds
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Run using ./bin/dog-breeds. Choose a dog breed group by entering the number of the group. Then choose
|
26
|
+
a breed from that group by entering the breed's number. Users will then see characteristics of the
|
27
|
+
chosen dog breed. Finally, enter 'Y' to learn about a different dog breed or 'N' to exit the program.
|
28
|
+
|
29
|
+
## Development
|
30
|
+
|
31
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
+
|
33
|
+
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).
|
34
|
+
|
35
|
+
## Contributing
|
36
|
+
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/<bethurban>/dog_breeds.
|
38
|
+
|
39
|
+
## License
|
40
|
+
|
41
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "dog_breeds/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "akc_dog_breeds"
|
8
|
+
spec.version = DogBreeds::VERSION
|
9
|
+
spec.authors = ["<bethurban>"]
|
10
|
+
spec.email = ["<beth.urban@gmail.com>"]
|
11
|
+
|
12
|
+
spec.summary = "Users can get more info on American Kennel Club dog breeds."
|
13
|
+
spec.description = "Users can see which dog breeds are in each American Kennel Club groups
|
14
|
+
and get more details on the characteristics of each breed."
|
15
|
+
spec.homepage = "https://github.com/bethurban/dog_breeds-cli-app"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
19
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
20
|
+
# if spec.respond_to?(:metadata)
|
21
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
22
|
+
# else
|
23
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
24
|
+
# "public gem pushes."
|
25
|
+
# end
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
28
|
+
f.match(%r{^(test|spec|features)/})
|
29
|
+
end
|
30
|
+
spec.bindir = "exe"
|
31
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
32
|
+
spec.require_paths = ["lib"]
|
33
|
+
|
34
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
35
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
37
|
+
spec.add_development_dependency "pry"
|
38
|
+
|
39
|
+
spec.add_dependency "nokogiri"
|
40
|
+
|
41
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dog_breeds"
|
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/dog-breeds
ADDED
data/bin/setup
ADDED
data/lib/dog_breeds.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'pry'
|
4
|
+
|
5
|
+
require_relative './dog_breeds/version'
|
6
|
+
require_relative './dog_breeds/cli'
|
7
|
+
require_relative './dog_breeds/groups'
|
8
|
+
require_relative './dog_breeds/breeds'
|
9
|
+
require_relative './dog_breeds/breed_details'
|
@@ -0,0 +1,68 @@
|
|
1
|
+
class DogBreeds::BreedDetails
|
2
|
+
attr_reader :fixed_url
|
3
|
+
|
4
|
+
def self.get_url(group, breed)
|
5
|
+
case group
|
6
|
+
when "1"
|
7
|
+
breed_list = DogBreeds::Breeds.scrape_sporting
|
8
|
+
dog = breed_list[breed.to_i - 1]
|
9
|
+
dog_url = dog.css('a')
|
10
|
+
url = dog_url[0]['href']
|
11
|
+
@fixed_url = "http://www.akc.org" + url
|
12
|
+
when "2"
|
13
|
+
breed_list = DogBreeds::Breeds.scrape_hound
|
14
|
+
dog = breed_list[breed.to_i - 1]
|
15
|
+
dog_url = dog.css('a')
|
16
|
+
url = dog_url[0]['href']
|
17
|
+
@fixed_url = "http://www.akc.org" + url
|
18
|
+
when "3"
|
19
|
+
breed_list = DogBreeds::Breeds.scrape_working
|
20
|
+
dog = breed_list[breed.to_i - 1]
|
21
|
+
dog_url = dog.css('a')
|
22
|
+
url = dog_url[0]['href']
|
23
|
+
@fixed_url = "http://www.akc.org" + url
|
24
|
+
when "4"
|
25
|
+
breed_list = DogBreeds::Breeds.scrape_terrier
|
26
|
+
dog = breed_list[breed.to_i - 1]
|
27
|
+
dog_url = dog.css('a')
|
28
|
+
url = dog_url[0]['href']
|
29
|
+
@fixed_url = "http://www.akc.org" + url
|
30
|
+
when "5"
|
31
|
+
breed_list = DogBreeds::Breeds.scrape_toy
|
32
|
+
dog = breed_list[breed.to_i - 1]
|
33
|
+
dog_url = dog.css('a')
|
34
|
+
url = dog_url[0]['href']
|
35
|
+
@fixed_url = "http://www.akc.org" + url
|
36
|
+
when "6"
|
37
|
+
breed_list = DogBreeds::Breeds.scrape_non_sporting
|
38
|
+
dog = breed_list[breed.to_i - 1]
|
39
|
+
dog_url = dog.css('a')
|
40
|
+
url = dog_url[0]['href']
|
41
|
+
@fixed_url = "http://www.akc.org" + url
|
42
|
+
when "7"
|
43
|
+
breed_list = DogBreeds::Breeds.scrape_herding
|
44
|
+
dog = breed_list[breed.to_i - 1]
|
45
|
+
dog_url = dog.css('a')
|
46
|
+
url = dog_url[0]['href']
|
47
|
+
@fixed_url = "http://www.akc.org" + url
|
48
|
+
end
|
49
|
+
details(@fixed_url)
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.details(fixed_url)
|
53
|
+
doc = Nokogiri::HTML(open("#{fixed_url}"))
|
54
|
+
|
55
|
+
details = doc.css('.breed-details .breed-details__main').text
|
56
|
+
details.delete! "\t"
|
57
|
+
details.strip!
|
58
|
+
|
59
|
+
if details != ""
|
60
|
+
puts "\n#{doc.css('.feed-class article h1').text}"
|
61
|
+
puts "#{details}"
|
62
|
+
else
|
63
|
+
puts "\n#{doc.css('.feed-class article h1').text}"
|
64
|
+
puts "The American Kennel Club does not provide any further information on this breed at this time."
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
class DogBreeds::Breeds
|
2
|
+
|
3
|
+
@@group_number = ""
|
4
|
+
|
5
|
+
def self.list
|
6
|
+
puts "Which group of breeds would you like to see? (1-7)"
|
7
|
+
@@group_number = gets.strip
|
8
|
+
case @@group_number
|
9
|
+
when "1"
|
10
|
+
scrape_sporting
|
11
|
+
@breeds.each_with_index do |breed, number|
|
12
|
+
puts "#{number + 1}. #{breed}"
|
13
|
+
end
|
14
|
+
when "2"
|
15
|
+
scrape_hound
|
16
|
+
@breeds.each_with_index do |breed, number|
|
17
|
+
puts "#{number + 1}. #{breed}"
|
18
|
+
end
|
19
|
+
when "3"
|
20
|
+
scrape_working
|
21
|
+
@breeds.each_with_index do |breed, number|
|
22
|
+
puts "#{number + 1}. #{breed}"
|
23
|
+
end
|
24
|
+
when "4"
|
25
|
+
scrape_terrier
|
26
|
+
@breeds.each_with_index do |breed, number|
|
27
|
+
puts "#{number + 1}. #{breed}"
|
28
|
+
end
|
29
|
+
when "5"
|
30
|
+
scrape_toy
|
31
|
+
@breeds.each_with_index do |breed, number|
|
32
|
+
puts "#{number + 1}. #{breed}"
|
33
|
+
end
|
34
|
+
when "6"
|
35
|
+
scrape_non_sporting
|
36
|
+
@breeds.each_with_index do |breed, number|
|
37
|
+
puts "#{number + 1}. #{breed}"
|
38
|
+
end
|
39
|
+
when "7"
|
40
|
+
scrape_herding
|
41
|
+
@breeds.each_with_index do |breed, number|
|
42
|
+
puts "#{number + 1}. #{breed}"
|
43
|
+
end
|
44
|
+
else
|
45
|
+
puts "\nInvalid entry. Please enter a valid group number."
|
46
|
+
DogBreeds::Groups.list
|
47
|
+
self.list
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.pick_breed(group_number = "")
|
52
|
+
group_number = @@group_number
|
53
|
+
puts "\nWhich breed would you like more information on? (Enter the breed's number.)"
|
54
|
+
@breed_number = gets.strip
|
55
|
+
DogBreeds::BreedDetails.get_url(@@group_number, @breed_number)
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.scrape_sporting
|
59
|
+
doc = Nokogiri::HTML(open("http://www.akc.org/dog-breeds/groups/sporting/"))
|
60
|
+
@breeds = []
|
61
|
+
@dogs = doc.css('.event-contain .scale-contents h2')
|
62
|
+
#@dogs instance variable gives you XML of all the dogs in the group, which is
|
63
|
+
#used in the BreedDetails class to scrape the chosen breed's individual URL
|
64
|
+
@dogs.each do |dog|
|
65
|
+
@breeds << dog.css('a[href]').text
|
66
|
+
end
|
67
|
+
#@breeds is an array of strings of all the breeds in the group
|
68
|
+
@dogs
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.scrape_hound
|
72
|
+
doc = Nokogiri::HTML(open("http://www.akc.org/dog-breeds/groups/hound/"))
|
73
|
+
@breeds = []
|
74
|
+
@dogs = doc.css('.event-contain .scale-contents h2')
|
75
|
+
@dogs.each do |dog|
|
76
|
+
@breeds << dog.css('a[href]').text
|
77
|
+
end
|
78
|
+
@dogs
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.scrape_working
|
82
|
+
doc = Nokogiri::HTML(open("http://www.akc.org/dog-breeds/groups/working/"))
|
83
|
+
@breeds = []
|
84
|
+
@dogs = doc.css('.event-contain .scale-contents h2')
|
85
|
+
@dogs.each do |dog|
|
86
|
+
@breeds << dog.css('a[href]').text
|
87
|
+
end
|
88
|
+
@dogs
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.scrape_terrier
|
92
|
+
doc = Nokogiri::HTML(open("http://www.akc.org/dog-breeds/groups/terrier/"))
|
93
|
+
@breeds = []
|
94
|
+
@dogs = doc.css('.event-contain .scale-contents h2')
|
95
|
+
@dogs.each do |dog|
|
96
|
+
@breeds << dog.css('a[href]').text
|
97
|
+
end
|
98
|
+
@dogs
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.scrape_toy
|
102
|
+
doc = Nokogiri::HTML(open("http://www.akc.org/dog-breeds/groups/toy/"))
|
103
|
+
@breeds = []
|
104
|
+
@dogs = doc.css('.event-contain .scale-contents h2')
|
105
|
+
@dogs.each do |dog|
|
106
|
+
@breeds << dog.css('a[href]').text
|
107
|
+
end
|
108
|
+
@dogs
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.scrape_non_sporting
|
112
|
+
doc = Nokogiri::HTML(open("http://www.akc.org/dog-breeds/groups/non-sporting/"))
|
113
|
+
@breeds = []
|
114
|
+
@dogs = doc.css('.event-contain .scale-contents h2')
|
115
|
+
@dogs.each do |dog|
|
116
|
+
@breeds << dog.css('a[href]').text
|
117
|
+
end
|
118
|
+
@dogs
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.scrape_herding
|
122
|
+
doc = Nokogiri::HTML(open("http://www.akc.org/dog-breeds/groups/herding/"))
|
123
|
+
@breeds = []
|
124
|
+
@dogs = doc.css('.event-contain .scale-contents h2')
|
125
|
+
@dogs.each do |dog|
|
126
|
+
@breeds << dog.css('a[href]').text
|
127
|
+
end
|
128
|
+
@dogs
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class DogBreeds::CLI
|
2
|
+
|
3
|
+
def call
|
4
|
+
input = nil
|
5
|
+
puts "Welcome!\n\n"
|
6
|
+
while input != "N"
|
7
|
+
list_groups
|
8
|
+
list_breeds
|
9
|
+
pick_breed
|
10
|
+
puts ""
|
11
|
+
puts "Do you want to learn about another breed? (Y/N)"
|
12
|
+
input = gets.strip.upcase
|
13
|
+
end
|
14
|
+
goodbye
|
15
|
+
end
|
16
|
+
|
17
|
+
def list_groups
|
18
|
+
groups = DogBreeds::Groups.scrape_groups
|
19
|
+
puts "These are the American Kennel Club's groups of dog breeds:"
|
20
|
+
puts <<~DOC
|
21
|
+
1. #{groups[0]}
|
22
|
+
2. #{groups[1]}
|
23
|
+
3. #{groups[2]}
|
24
|
+
4. #{groups[3]}
|
25
|
+
5. #{groups[4]}
|
26
|
+
6. #{groups[5]}
|
27
|
+
7. #{groups[6]}
|
28
|
+
|
29
|
+
DOC
|
30
|
+
end
|
31
|
+
|
32
|
+
def list_breeds
|
33
|
+
DogBreeds::Breeds.list
|
34
|
+
end
|
35
|
+
|
36
|
+
def pick_breed
|
37
|
+
DogBreeds::Breeds.pick_breed
|
38
|
+
end
|
39
|
+
|
40
|
+
def goodbye
|
41
|
+
puts "\nWoof! See you next time!"
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class DogBreeds::Groups
|
2
|
+
|
3
|
+
@@group_fixed_array = []
|
4
|
+
|
5
|
+
def self.scrape_groups
|
6
|
+
doc = Nokogiri::HTML(open("http://www.akc.org/dog-breeds/"))
|
7
|
+
groups = doc.css('.side-nav ul')[1]
|
8
|
+
groups_string = groups.css('li').text
|
9
|
+
groups_array = groups_string.split(/(?=[A-Z])/)
|
10
|
+
#groups_array has each group name split into separate strings, so we combine them below
|
11
|
+
#["Sporting ", "Group"] becomes ["Sporting Group"]
|
12
|
+
group_1 = groups_array[0] + groups_array[1]
|
13
|
+
@@group_fixed_array << group_1
|
14
|
+
group_2 = groups_array[2] + groups_array[3]
|
15
|
+
@@group_fixed_array << group_2
|
16
|
+
group_3 = groups_array[4] + groups_array[5]
|
17
|
+
@@group_fixed_array << group_3
|
18
|
+
group_4 = groups_array[6] + groups_array[7]
|
19
|
+
@@group_fixed_array << group_4
|
20
|
+
group_5 = groups_array[8] + groups_array[9]
|
21
|
+
@@group_fixed_array << group_5
|
22
|
+
group_6 = groups_array[10] + groups_array[11] + groups_array[12]
|
23
|
+
@@group_fixed_array << group_6
|
24
|
+
group_7 = groups_array[13] + groups_array[14]
|
25
|
+
@@group_fixed_array << group_7
|
26
|
+
|
27
|
+
@@group_fixed_array
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/spec.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Specifications for the CLI Assessment
|
2
|
+
|
3
|
+
Specs:
|
4
|
+
- [x] Have a CLI for interfacing with the application
|
5
|
+
The CLI class welcomes the user and asks him to choose from a list of dog groups.
|
6
|
+
The user is then given a list of breeds in his chosen group. He can pick which
|
7
|
+
breed he wants more information on and is given a list of breed characteristics.
|
8
|
+
The user can then choose to get details on another dog breed or exit the program.
|
9
|
+
|
10
|
+
- [x] Pull data from an external source
|
11
|
+
The program scrapes the dog group names, the dog breeds in each group, and the
|
12
|
+
traits of each breed from the American Kennel Club's website: http://www.akc.org/
|
13
|
+
No information is hard coded.
|
14
|
+
|
15
|
+
- [x] Implement both list and detail views
|
16
|
+
The user is given two list views - one master list of breed groups, then a
|
17
|
+
list of breeds in a chosen group.
|
18
|
+
After choosing a breed within in a group, the user gets a detail view on that
|
19
|
+
breed - a list of traits specific to that breed.
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: akc_dog_breeds
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "<bethurban>"
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-04-05 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.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
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: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: nokogiri
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: |-
|
84
|
+
Users can see which dog breeds are in each American Kennel Club groups
|
85
|
+
and get more details on the characteristics of each breed.
|
86
|
+
email:
|
87
|
+
- "<beth.urban@gmail.com>"
|
88
|
+
executables: []
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".DS_Store"
|
93
|
+
- ".gitignore"
|
94
|
+
- ".rspec"
|
95
|
+
- ".travis.yml"
|
96
|
+
- Gemfile
|
97
|
+
- Gemfile.lock
|
98
|
+
- LICENSE.txt
|
99
|
+
- NOTES.md
|
100
|
+
- README.md
|
101
|
+
- Rakefile
|
102
|
+
- akc_dog_breeds.gemspec
|
103
|
+
- bin/console
|
104
|
+
- bin/dog-breeds
|
105
|
+
- bin/setup
|
106
|
+
- lib/dog_breeds.rb
|
107
|
+
- lib/dog_breeds/breed_details.rb
|
108
|
+
- lib/dog_breeds/breeds.rb
|
109
|
+
- lib/dog_breeds/cli.rb
|
110
|
+
- lib/dog_breeds/groups.rb
|
111
|
+
- lib/dog_breeds/version.rb
|
112
|
+
- spec.md
|
113
|
+
homepage: https://github.com/bethurban/dog_breeds-cli-app
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.7.6
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Users can get more info on American Kennel Club dog breeds.
|
137
|
+
test_files: []
|