tablehop 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tablehop.rb +20 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02de19850717d14a51179bbe683ca9619aeb74f013bbb1eb8ede1677a43b8d2b
|
4
|
+
data.tar.gz: fa28500cb8b6b60930f1435bab94400bfabbccf83a43245c5c1f1f6f15d27923
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0bf4376402efaae695f8854f813d40a1a650c7c640bc6c026b679c85da8166fcc18b53c8e16545375826e0877e7e461db69fd58e23e48def3849a795ec5c13e
|
7
|
+
data.tar.gz: 4e343f34b86cf4bad77d00084150e5ba3051daadd1dafed8bc3958afcbe9fc774dc44f1a3a1ebe475959ad9555beba8a68bf3e93685e8f570cfd22910e8c8238
|
data/lib/tablehop.rb
CHANGED
@@ -4,28 +4,29 @@ require 'openssl'
|
|
4
4
|
require 'json'
|
5
5
|
require 'open-uri'
|
6
6
|
require 'nokogiri'
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
7
|
+
module Tablehop
|
8
|
+
class Tablehop
|
9
|
+
def self.getPopularGames
|
10
|
+
recent_favourites = Nokogiri::HTML(URI.open("https://api.geekdo.com/xmlapi2/hot?type=rpg"))
|
11
|
+
#puts doc.xpath('//html/body/items/item')[0]
|
12
|
+
popular_games = []
|
13
|
+
loop_length = recent_favourites.xpath('//html/body/items/item').length
|
14
|
+
for item in 0..loop_length-1
|
15
|
+
item_link = 'https://boardgamegeek.com/boardgame/' + recent_favourites.xpath('//html/body/items/item/@id')[item].to_s
|
16
|
+
game_dict = {
|
17
|
+
'name' => recent_favourites.xpath('//html/body/items/item/name/@value')[item].to_s,
|
18
|
+
'image' => recent_favourites.xpath('//html/body/items/item/thumbnail/@value')[item].to_s,
|
19
|
+
'item_id' => recent_favourites.xpath('//html/body/items/item/@id')[item].to_s,
|
20
|
+
'item_link' => item_link
|
21
|
+
}
|
22
|
+
popular_games.append(game_dict)
|
23
|
+
end
|
24
|
+
#puts popular_games.length.to_s
|
25
|
+
#indItem = Nokogiri::HTML(doc.xpath('//html/body/items/item')[0])
|
26
|
+
return popular_games
|
22
27
|
end
|
23
|
-
#puts popular_games.length.to_s
|
24
|
-
#indItem = Nokogiri::HTML(doc.xpath('//html/body/items/item')[0])
|
25
|
-
return popular_games
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
29
31
|
|
30
32
|
|
31
|
-
|