tablehop 0.2.7 → 0.2.8
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 +19 -20
- 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: 2dd9fa65f50688eaed15f257c9dc02c32f602b1a6eb520d54b3b234c4cb6ad86
|
4
|
+
data.tar.gz: f66b6d7503bb32d73faf344e2b5287928a19a4f464a7a31794059fcf9e9bf298
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ddd7859df316252506f338e376fd3b01d1b05f887423f8f15d7d6675a861322c217a1a9e82b5f3fb4bc1fe9e6ae4e4aacf63007ba1b81bd6d1a6bc6b162375e0
|
7
|
+
data.tar.gz: 5561341fe129d673c36e67fe0cd82a84b6de45717ec780b58e4f22169d3253e3f6e0802e5fd9c954219963912935beba7b2cbdc9d69096d288eae9b42350572d
|
data/lib/tablehop.rb
CHANGED
@@ -4,29 +4,28 @@ 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
|
-
|
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
|
7
|
+
class Tablehop
|
8
|
+
def self.getPopularGames
|
9
|
+
recent_favourites = Nokogiri::HTML(URI.open("https://api.geekdo.com/xmlapi2/hot?type=rpg"))
|
10
|
+
#puts doc.xpath('//html/body/items/item')[0]
|
11
|
+
popular_games = []
|
12
|
+
loop_length = recent_favourites.xpath('//html/body/items/item').length
|
13
|
+
for item in 0..loop_length-1
|
14
|
+
item_link = 'https://boardgamegeek.com/boardgame/' + recent_favourites.xpath('//html/body/items/item/@id')[item].to_s
|
15
|
+
game_dict = {
|
16
|
+
'name' => recent_favourites.xpath('//html/body/items/item/name/@value')[item].to_s,
|
17
|
+
'image' => recent_favourites.xpath('//html/body/items/item/thumbnail/@value')[item].to_s,
|
18
|
+
'item_id' => recent_favourites.xpath('//html/body/items/item/@id')[item].to_s,
|
19
|
+
'item_link' => item_link
|
20
|
+
}
|
21
|
+
popular_games.append(game_dict)
|
27
22
|
end
|
23
|
+
#puts popular_games.length.to_s
|
24
|
+
#indItem = Nokogiri::HTML(doc.xpath('//html/body/items/item')[0])
|
25
|
+
return popular_games
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
29
|
|
32
30
|
|
31
|
+
|