recently_ps4_games 0.2.0 → 0.3.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 +4 -4
- data/bin/recently_ps4_games +1 -1
- data/lib/recently_ps4_games/cli.rb +3 -9
- data/lib/recently_ps4_games/game.rb +1 -9
- data/lib/recently_ps4_games/scraper.rb +7 -11
- data/lib/recently_ps4_games/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e530123a586981062c8602ad6967f8f343ce4b5f
|
4
|
+
data.tar.gz: d63fc715a02cd270a936d55876d5659092d8bb6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34074a6af4bc5780ff66d52b6ff64c732d9b737a72a9dad2a93663a6e86fb5f85902abd473d0c00c1a50ac3ee5731dc47b9fc421fcad2125d4f010e4efdaea54
|
7
|
+
data.tar.gz: 96ccb7ad27dcb02a76008bcef4c6fafa6825a325538671ac36c7bc65a0e30604902906cded5df375844f114c9150aa4116bfa5012158cbe33929ae3f6dc72587
|
data/bin/recently_ps4_games
CHANGED
@@ -3,16 +3,11 @@ class RecentlyPs4Games::Cli
|
|
3
3
|
def call
|
4
4
|
puts "Welcome to recently_ps4_games!!"
|
5
5
|
puts "...now makinging games list..."
|
6
|
-
|
7
|
-
interact_with_user
|
6
|
+
RecentlyPs4Games::Scraper.scrape_game_list
|
7
|
+
interact_with_user
|
8
8
|
puts "Bye!"
|
9
9
|
end
|
10
10
|
|
11
|
-
def make_games
|
12
|
-
games_arr = RecentlyPs4Games::Scraper.scrape_game_list
|
13
|
-
RecentlyPs4Games::Game.create_by_games_arr(games_arr)
|
14
|
-
end
|
15
|
-
|
16
11
|
def interact_with_user
|
17
12
|
display_list
|
18
13
|
display_detail(get_detail(ask_what_to_detail))
|
@@ -38,8 +33,7 @@ class RecentlyPs4Games::Cli
|
|
38
33
|
|
39
34
|
def get_detail(id)
|
40
35
|
game = RecentlyPs4Games::Game.find_by_id(id)
|
41
|
-
|
42
|
-
game.add_attributes(detail)
|
36
|
+
RecentlyPs4Games::Scraper.scrape_details(game)
|
43
37
|
end
|
44
38
|
|
45
39
|
def display_detail(game)
|
@@ -7,15 +7,8 @@ class RecentlyPs4Games::Game
|
|
7
7
|
game_hash.each do |k, v|
|
8
8
|
self.send("#{k}=", v)
|
9
9
|
end
|
10
|
+
@id = (@@all.size + 1)
|
10
11
|
@@all << self
|
11
|
-
@id = @@all.size
|
12
|
-
self
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.create_by_games_arr(games_arr)
|
16
|
-
games_arr.each do |game|
|
17
|
-
self.new(game)
|
18
|
-
end
|
19
12
|
end
|
20
13
|
|
21
14
|
def self.find_by_id(id)
|
@@ -28,7 +21,6 @@ class RecentlyPs4Games::Game
|
|
28
21
|
details_hash.each do |k, v|
|
29
22
|
self.send("#{k}=", v)
|
30
23
|
end
|
31
|
-
self
|
32
24
|
end
|
33
25
|
|
34
26
|
def self.all
|
@@ -8,35 +8,31 @@ class RecentlyPs4Games::Scraper
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.scrape_game_list
|
11
|
-
games_arr = []
|
12
11
|
list_page = Nokogiri::HTML(self.get_dynamic_page_html)
|
13
12
|
game_grids = list_page.css("div.inlineTabs.section.gameGrid")
|
14
13
|
game_grids.each do |game_grid|
|
15
14
|
games = game_grid.css("ul.clearfix li.layout-type-1 div.tile.clearfix div.game-tile-details h2 a.title")
|
16
15
|
games.each do |game|
|
17
|
-
|
16
|
+
RecentlyPs4Games::Game.new({
|
18
17
|
title: game.text,
|
19
18
|
detail_url: game.attr("href")
|
20
|
-
}
|
19
|
+
})
|
21
20
|
end
|
22
21
|
end
|
23
|
-
games_arr
|
24
22
|
end
|
25
23
|
|
26
|
-
def self.scrape_details(
|
27
|
-
detail_page = Nokogiri::HTML(open(
|
24
|
+
def self.scrape_details(game)
|
25
|
+
detail_page = Nokogiri::HTML(open(game.detail_url))
|
28
26
|
prod_meta = detail_page.css("div.prod-meta")
|
29
27
|
release_info = prod_meta.css("ul.release-info li")
|
30
|
-
|
31
|
-
details = {
|
28
|
+
game.add_attributes({
|
32
29
|
discription: prod_meta.css("p.teaser").text,
|
33
30
|
release_date: release_info.css("span.releasedate").text.delete("\n\t"),
|
34
31
|
genre: release_info[1].children[2].text.delete("\n\t"),
|
35
32
|
publisher: release_info[2].children[1].text.delete("\n\t"),
|
36
33
|
developer: release_info[3].children[1].text.delete("\n\t")
|
37
|
-
}
|
38
|
-
|
39
|
-
details
|
34
|
+
})
|
35
|
+
game
|
40
36
|
end
|
41
37
|
|
42
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recently_ps4_games
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ayafushimi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|