ign-reviews 0.1.1
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/.gitignore +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/NOTES.md +52 -0
- data/README.md +31 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/ign-reviews +7 -0
- data/bin/setup +8 -0
- data/ign-reviews-0.1.0.gem +0 -0
- data/ign-reviews.gemspec +31 -0
- data/lib/ign-reviews.rb +9 -0
- data/lib/ign-reviews/cli.rb +129 -0
- data/lib/ign-reviews/game.rb +108 -0
- data/lib/ign-reviews/scraper.rb +76 -0
- data/lib/ign-reviews/version.rb +3 -0
- data/spec.md +6 -0
- metadata +152 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: dc3006257420b640cee3b4a58e6d1d7a4db95360f59ae7cf321d81aa676f778f
|
|
4
|
+
data.tar.gz: fe186a19999abf2c1d75a9df4f62ea1159578fb1cb3e41040ee2ebd7a8e234da
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 5f8dc67a255e5213a0b3f7df1bcaf61290695df1fddab26a66f25fd536ea78feaf6befed37e8d940ca21dc5e0ebc4ef721416831ddbacae1d8fd270bf4a945a6
|
|
7
|
+
data.tar.gz: caf9bd702f237e23a74b3f3571136ab46e88fbd9b6a4582284f6836512f2a2271fb0b0c86be34cfa8d50992afaff499b0bcf2c898eff27cc87bbd86acf094469
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at 'jamilya_ramos-chapman@alumni.brown.edu'. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: http://contributor-covenant.org
|
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 'Jamilya Ramos-Chapman'
|
|
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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
How to Build a CLI Gem
|
|
2
|
+
|
|
3
|
+
1. Plan your gem, imagine your interface
|
|
4
|
+
2. Start with the project structure - google
|
|
5
|
+
3. Start with the entry point - the file run
|
|
6
|
+
4. Force that to build the CLI interface
|
|
7
|
+
5. Stub out the interface
|
|
8
|
+
6. Start making things real
|
|
9
|
+
7. Discover objects.
|
|
10
|
+
8. Program
|
|
11
|
+
|
|
12
|
+
A command line interface for video games ranked via IGN.
|
|
13
|
+
|
|
14
|
+
User types "IGN"
|
|
15
|
+
|
|
16
|
+
-Ask user to choose a platform.
|
|
17
|
+
|
|
18
|
+
PLATFORMS
|
|
19
|
+
Numbered list
|
|
20
|
+
- All
|
|
21
|
+
- Xbox 360
|
|
22
|
+
- PS3
|
|
23
|
+
- PC
|
|
24
|
+
- Wii U
|
|
25
|
+
- 3DS
|
|
26
|
+
- Vita
|
|
27
|
+
- iPhone
|
|
28
|
+
- Xbox One
|
|
29
|
+
- PS4
|
|
30
|
+
|
|
31
|
+
GAME OPTIONS
|
|
32
|
+
Numbered list
|
|
33
|
+
- "Editor's Choice"
|
|
34
|
+
- "New Releases"
|
|
35
|
+
--sort by release date
|
|
36
|
+
- "Top 10 Games"
|
|
37
|
+
--sort by rating
|
|
38
|
+
- "Coming Soon"
|
|
39
|
+
--"http://www.ign.com/upcoming/games"
|
|
40
|
+
- "Browse by platform"
|
|
41
|
+
--list_platforms
|
|
42
|
+
- "Browse by genre"
|
|
43
|
+
--list_genres
|
|
44
|
+
- "Browse by rating"
|
|
45
|
+
--"Choose a rating from 1 to 10"
|
|
46
|
+
|
|
47
|
+
A game has a name, genre, platform, release date, rating, and url.
|
|
48
|
+
|
|
49
|
+
DISPLAY EX;
|
|
50
|
+
1. "Dragon Ball FighterZ - 8.5/10 - Playstation 4"
|
|
51
|
+
|
|
52
|
+
Need a scraper class to generated game objects with scraped information on each game from website.
|
data/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# IGN
|
|
2
|
+
|
|
3
|
+
This Ruby Gem provides a CLI to view video game reviews via IGN's website. You can view Editor's Choice games, new releases, upcoming games, the most recent releases, sort by platform/genre, or simply browse all listed on IGN.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
$ gem install ign-reviews
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Type the below and follow the on screen prompts.
|
|
12
|
+
|
|
13
|
+
$ ign-reviews
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
|
|
17
|
+
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.
|
|
18
|
+
|
|
19
|
+
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).
|
|
20
|
+
|
|
21
|
+
## Contributing
|
|
22
|
+
|
|
23
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/'jramosch'/metacritic. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
|
28
|
+
|
|
29
|
+
## Code of Conduct
|
|
30
|
+
|
|
31
|
+
Everyone interacting in the IGN project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/'jramosch'/metacritic/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "ign-reviews"
|
|
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/ign-reviews
ADDED
data/bin/setup
ADDED
|
Binary file
|
data/ign-reviews.gemspec
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "ign-reviews/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "ign-reviews"
|
|
8
|
+
spec.version = IGNReviews::VERSION
|
|
9
|
+
spec.authors = ["'Jamilya Ramos-Chapman'"]
|
|
10
|
+
spec.email = ["'jamilya_ramos-chapman@alumni.brown.edu'"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "IGN Video Game Reviews"
|
|
13
|
+
spec.description = "Provides details on current and upcoming video games reviewed by IGN."
|
|
14
|
+
spec.homepage = "https://rubygems.org/gems/ign-reviews"
|
|
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.16"
|
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
26
|
+
spec.add_development_dependency "rspec", '~> 0'
|
|
27
|
+
spec.add_development_dependency "pry", '~> 0'
|
|
28
|
+
|
|
29
|
+
spec.add_runtime_dependency "nokogiri", '~> 1.8', '>= 1.8.1'
|
|
30
|
+
spec.add_runtime_dependency "colorize", '~> 0'
|
|
31
|
+
end
|
data/lib/ign-reviews.rb
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
#CLI Controller
|
|
2
|
+
class IGNReviews::CLI
|
|
3
|
+
|
|
4
|
+
def call
|
|
5
|
+
make_games
|
|
6
|
+
welcome
|
|
7
|
+
menu
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def welcome
|
|
11
|
+
puts " ,--. "
|
|
12
|
+
puts " ,---, ,----.. ,--.'| "
|
|
13
|
+
puts ",`--.' | / / \\ ,--,: : | "
|
|
14
|
+
puts "| : :| : : ,`--.'`| ' : "
|
|
15
|
+
puts ": | '. | ;. / | : : | | "
|
|
16
|
+
puts "| : |. ; /--` : | \\ | : "
|
|
17
|
+
puts "' ' ;; | ; __ | : ' '; | "
|
|
18
|
+
puts "| | || : |.' .'' ' ;. ; "
|
|
19
|
+
puts "' : ;. | '_.' :| | | \\ | "
|
|
20
|
+
puts "| | '' ; : \\ |' : | ; .' "
|
|
21
|
+
puts "' : |' | '/ .'| | '`--' "
|
|
22
|
+
puts "; |.' | : / ' : | "
|
|
23
|
+
puts "'---' \\ \\ .' ; |.' "
|
|
24
|
+
puts " `---` '---' "
|
|
25
|
+
puts "----------------------------------"
|
|
26
|
+
puts " Video game news and reviews! "
|
|
27
|
+
puts " To leave program type 'exit' "
|
|
28
|
+
puts "++++++++++++++++++++++++++++++++++"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def make_games
|
|
32
|
+
IGNReviews::Game.make_front_page
|
|
33
|
+
IGNReviews::Game.make_editors_choice
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def menu
|
|
37
|
+
games_options
|
|
38
|
+
puts " "
|
|
39
|
+
input = gets.strip.downcase
|
|
40
|
+
case input
|
|
41
|
+
when "1"
|
|
42
|
+
IGNReviews::Game.list_editors_choice
|
|
43
|
+
games_menu(IGNReviews::Game.editors_choice)
|
|
44
|
+
when "2"
|
|
45
|
+
IGNReviews::Game.list_front_page
|
|
46
|
+
games_menu(IGNReviews::Game.front_page)
|
|
47
|
+
when "3"
|
|
48
|
+
IGNReviews::Game.make_coming_soon
|
|
49
|
+
games_menu(IGNReviews::Game.coming_soon)
|
|
50
|
+
when "4"
|
|
51
|
+
IGNReviews::Game.list_platforms
|
|
52
|
+
attributes_menu(IGNReviews::Game.platforms, "platform")
|
|
53
|
+
when "5"
|
|
54
|
+
IGNReviews::Game.list_genres
|
|
55
|
+
attributes_menu(IGNReviews::Game.genres, "genre")
|
|
56
|
+
when "6"
|
|
57
|
+
IGNReviews::Game.list_all
|
|
58
|
+
games_menu(IGNReviews::Game.list_all)
|
|
59
|
+
when "exit"
|
|
60
|
+
goodbye
|
|
61
|
+
else
|
|
62
|
+
puts " "
|
|
63
|
+
puts "Sorry. Please try again."
|
|
64
|
+
puts " "
|
|
65
|
+
menu
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def games_options
|
|
70
|
+
puts "Choose from the below (1-6) or type exit to leave."
|
|
71
|
+
puts " "
|
|
72
|
+
puts "1. Editor's Choice"
|
|
73
|
+
puts "2. New Releases"
|
|
74
|
+
puts "3. Coming Soon"
|
|
75
|
+
puts "4. Browse by platform"
|
|
76
|
+
puts "5. Browse by genre"
|
|
77
|
+
puts "6. List All"
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def games_menu(games)
|
|
81
|
+
puts " "
|
|
82
|
+
puts "Which would you like more info on?"
|
|
83
|
+
input = gets.strip.to_i
|
|
84
|
+
i = input - 1
|
|
85
|
+
puts " "
|
|
86
|
+
puts "#{games[i].name} - #{games[i].platform}"
|
|
87
|
+
puts "Rating: #{games[i].rating}/10"
|
|
88
|
+
puts "Genre: #{games[i].genre}"
|
|
89
|
+
puts "----------------------------------"
|
|
90
|
+
puts "#{games[i].description}"
|
|
91
|
+
puts " "
|
|
92
|
+
puts "Read more here: #{games[i].url.colorize(:blue)}"
|
|
93
|
+
puts " "
|
|
94
|
+
puts "Is that all? (Y/N)"
|
|
95
|
+
input = gets.strip.downcase
|
|
96
|
+
if input == "n"
|
|
97
|
+
menu
|
|
98
|
+
else
|
|
99
|
+
goodbye
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def attributes_menu(games, choice)
|
|
105
|
+
puts " "
|
|
106
|
+
puts "Which #{choice} would you like to see?"
|
|
107
|
+
input = gets.strip.to_i
|
|
108
|
+
puts " "
|
|
109
|
+
number = games[input-1]
|
|
110
|
+
|
|
111
|
+
if choice == "platform"
|
|
112
|
+
games = IGNReviews::Game.all.select { |game| game.platform == "#{number}"}
|
|
113
|
+
IGNReviews::Game.make_list(games)
|
|
114
|
+
puts " "
|
|
115
|
+
games_menu(games)
|
|
116
|
+
else
|
|
117
|
+
games = IGNReviews::Game.all.select { |game| game.genre == "#{number}"}
|
|
118
|
+
IGNReviews::Game.make_list(games)
|
|
119
|
+
puts " "
|
|
120
|
+
games_menu(games)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def goodbye
|
|
125
|
+
puts " "
|
|
126
|
+
puts "Bye Bye!"
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
end
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
class IGNReviews::Game
|
|
2
|
+
attr_accessor :name, :platform, :genre, :rating, :release_date, :url, :description, :genres, :platforms
|
|
3
|
+
|
|
4
|
+
@@all = []
|
|
5
|
+
@@front_page = []
|
|
6
|
+
@@editors_choice =[]
|
|
7
|
+
@@coming_soon = []
|
|
8
|
+
|
|
9
|
+
def initialize(game_hash)
|
|
10
|
+
game_hash.each {|key,value| self.send(("#{key}="),value)}
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.create_from_collection(games_array)
|
|
14
|
+
games_array.each do |game_hash|
|
|
15
|
+
game = self.new(game_hash)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.make_front_page
|
|
20
|
+
games_array = IGNReviews::Scraper.scrape_front_page
|
|
21
|
+
|
|
22
|
+
games_array.each do |game_hash|
|
|
23
|
+
game = self.new(game_hash)
|
|
24
|
+
@@front_page << game
|
|
25
|
+
if @@all.all? { |g| g.name != game.name }
|
|
26
|
+
@@all << game
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.make_editors_choice
|
|
32
|
+
games_array = IGNReviews::Scraper.scrape_editors_choice
|
|
33
|
+
|
|
34
|
+
games_array.each do |game_hash|
|
|
35
|
+
game = self.new(game_hash)
|
|
36
|
+
@@editors_choice << game
|
|
37
|
+
if @@all.all? { |g| g.name != game.name }
|
|
38
|
+
@@all << game
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def self.make_coming_soon
|
|
44
|
+
games = IGNReviews::Scraper.scrape_coming_soon
|
|
45
|
+
|
|
46
|
+
games.take(9).each.with_index(1) do |game_hash, i|
|
|
47
|
+
game = self.new(game_hash)
|
|
48
|
+
@@coming_soon << game
|
|
49
|
+
puts "#{i}. #{game.name} (#{game.platform}) - #{game.release_date}"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def self.make_list(games)
|
|
54
|
+
games.each.with_index(1) do |game, i|
|
|
55
|
+
puts "#{i}. #{game.name} - #{game.platform}"
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def self.list_genres
|
|
60
|
+
@genres = (@@all.collect {|game| game.genre}).uniq
|
|
61
|
+
@genres.each.with_index(1) do |genre,i|
|
|
62
|
+
puts "#{i}. #{genre}"
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def self.genres
|
|
67
|
+
@genres
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def self.platforms
|
|
71
|
+
@platforms
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def self.list_platforms
|
|
75
|
+
@platforms = (@@all.collect {|game| game.platform}).uniq
|
|
76
|
+
@platforms.each.with_index(1) do |platform,i|
|
|
77
|
+
puts "#{i}. #{platform}"
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def self.list_editors_choice
|
|
82
|
+
make_list(@@editors_choice)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def self.list_front_page
|
|
86
|
+
make_list(@@front_page)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def self.list_all
|
|
90
|
+
make_list(@@all)
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def self.all
|
|
94
|
+
@@all
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def self.front_page
|
|
98
|
+
@@front_page
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def self.editors_choice
|
|
102
|
+
@@editors_choice
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def self.coming_soon
|
|
106
|
+
@@coming_soon
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#this will collect game details into hashes to create game objects from
|
|
2
|
+
|
|
3
|
+
class IGNReviews::Scraper
|
|
4
|
+
|
|
5
|
+
def self.scrape_front_page
|
|
6
|
+
scraped_games = []
|
|
7
|
+
doc = Nokogiri::HTML(open("http://www.ign.com/reviews/games"))
|
|
8
|
+
|
|
9
|
+
games = doc.css("div.itemList-item")
|
|
10
|
+
|
|
11
|
+
games.each do |game|
|
|
12
|
+
scraped_game = {}
|
|
13
|
+
scraped_game[:name] = game.css("div.item-title a").text.strip
|
|
14
|
+
scraped_game[:platform] = game.css("span.item-platform").text
|
|
15
|
+
scraped_game[:genre] = game.css("span.item-genre").text.strip
|
|
16
|
+
scraped_game[:rating] = game.css("span.scoreBox-score").text
|
|
17
|
+
scraped_game[:release_date] = game.css("div.grid_3 div")[0].text
|
|
18
|
+
scraped_game[:url] = game.css("li a")[0]["href"]
|
|
19
|
+
scraped_game[:description] = game.css("p.item-details").text.split(/\s+- /).delete_if{|space|space == ""}[1]
|
|
20
|
+
|
|
21
|
+
scraped_games << scraped_game
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
scraped_games
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.scrape_editors_choice
|
|
28
|
+
scraped_games = []
|
|
29
|
+
doc = Nokogiri::HTML(open("http://www.ign.com/editors-choice/games"))
|
|
30
|
+
|
|
31
|
+
games = doc.css("div.gameList-game")
|
|
32
|
+
|
|
33
|
+
games.each do |game|
|
|
34
|
+
scraped_game = {}
|
|
35
|
+
scraped_game[:name] = game.css("div.game-title a").text.strip
|
|
36
|
+
scraped_game[:platform] = game.css("span.game-platform").text
|
|
37
|
+
scraped_game[:genre] = game.css("span.game-genre").text.strip
|
|
38
|
+
scraped_game[:rating] = game.css("span.scoreBox-score").text
|
|
39
|
+
scraped_game[:release_date] = game.css("div.grid_3 div")[0].text
|
|
40
|
+
scraped_game[:url] = game.css("li a")[0]["href"]
|
|
41
|
+
scraped_game[:description] = game.css("p.game-details").text.split(/\s+- /).delete_if{|space|space == ""}[1]
|
|
42
|
+
|
|
43
|
+
scraped_games << scraped_game
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
scraped_games
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def self.scrape_coming_soon
|
|
50
|
+
scraped_games = []
|
|
51
|
+
doc = Nokogiri::HTML(open("http://www.ign.com/reviews/games"))
|
|
52
|
+
|
|
53
|
+
games = doc.css("div.column-game")
|
|
54
|
+
|
|
55
|
+
games.each do |game|
|
|
56
|
+
scraped_game = {}
|
|
57
|
+
scraped_game[:name] = game.css("a.game-title").text.strip
|
|
58
|
+
scraped_game[:platform] = game.css("span.game-platform").text
|
|
59
|
+
scraped_game[:release_date] = game.css("div.date").text
|
|
60
|
+
scraped_game[:url] = game.css("a")[0]["href"]
|
|
61
|
+
scraped_game[:description] = scrape_description(game.css("a")[0]["href"])
|
|
62
|
+
|
|
63
|
+
scraped_games << scraped_game
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
scraped_games
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def self.scrape_description(url)
|
|
70
|
+
doc = Nokogiri::HTML(open("#{url}"))
|
|
71
|
+
|
|
72
|
+
description = doc.css("div.description").text.strip
|
|
73
|
+
description
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
data/spec.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Specifications for the CLI Assessment
|
|
2
|
+
|
|
3
|
+
Specs:
|
|
4
|
+
- [x] Have a CLI for interfacing with the application -- created CLI class that prompts user with options to choose from and, using the user's input, provides information selected
|
|
5
|
+
- [x] Pull data from an external source -- Scraper class scrapes IGN website for data to add attributes for each iteration of the Game class
|
|
6
|
+
- [x] Implement both list and detail views -- Iterate through collection of all games with make_list method and use games_menu to provide more details on selected game for user
|
metadata
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: ign-reviews
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- "'Jamilya Ramos-Chapman'"
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-02-08 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: '0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '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: '1.8'
|
|
76
|
+
- - ">="
|
|
77
|
+
- !ruby/object:Gem::Version
|
|
78
|
+
version: 1.8.1
|
|
79
|
+
type: :runtime
|
|
80
|
+
prerelease: false
|
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
82
|
+
requirements:
|
|
83
|
+
- - "~>"
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: '1.8'
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: 1.8.1
|
|
89
|
+
- !ruby/object:Gem::Dependency
|
|
90
|
+
name: colorize
|
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
96
|
+
type: :runtime
|
|
97
|
+
prerelease: false
|
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '0'
|
|
103
|
+
description: Provides details on current and upcoming video games reviewed by IGN.
|
|
104
|
+
email:
|
|
105
|
+
- "'jamilya_ramos-chapman@alumni.brown.edu'"
|
|
106
|
+
executables: []
|
|
107
|
+
extensions: []
|
|
108
|
+
extra_rdoc_files: []
|
|
109
|
+
files:
|
|
110
|
+
- ".gitignore"
|
|
111
|
+
- CODE_OF_CONDUCT.md
|
|
112
|
+
- Gemfile
|
|
113
|
+
- LICENSE.txt
|
|
114
|
+
- NOTES.md
|
|
115
|
+
- README.md
|
|
116
|
+
- Rakefile
|
|
117
|
+
- bin/console
|
|
118
|
+
- bin/ign-reviews
|
|
119
|
+
- bin/setup
|
|
120
|
+
- ign-reviews-0.1.0.gem
|
|
121
|
+
- ign-reviews.gemspec
|
|
122
|
+
- lib/ign-reviews.rb
|
|
123
|
+
- lib/ign-reviews/cli.rb
|
|
124
|
+
- lib/ign-reviews/game.rb
|
|
125
|
+
- lib/ign-reviews/scraper.rb
|
|
126
|
+
- lib/ign-reviews/version.rb
|
|
127
|
+
- spec.md
|
|
128
|
+
homepage: https://rubygems.org/gems/ign-reviews
|
|
129
|
+
licenses:
|
|
130
|
+
- MIT
|
|
131
|
+
metadata: {}
|
|
132
|
+
post_install_message:
|
|
133
|
+
rdoc_options: []
|
|
134
|
+
require_paths:
|
|
135
|
+
- lib
|
|
136
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
|
+
requirements:
|
|
138
|
+
- - ">="
|
|
139
|
+
- !ruby/object:Gem::Version
|
|
140
|
+
version: '0'
|
|
141
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
|
+
requirements:
|
|
143
|
+
- - ">="
|
|
144
|
+
- !ruby/object:Gem::Version
|
|
145
|
+
version: '0'
|
|
146
|
+
requirements: []
|
|
147
|
+
rubyforge_project:
|
|
148
|
+
rubygems_version: 2.7.4
|
|
149
|
+
signing_key:
|
|
150
|
+
specification_version: 4
|
|
151
|
+
summary: IGN Video Game Reviews
|
|
152
|
+
test_files: []
|