tablehop 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/tablehop.rb +31 -0
  3. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 335ecd62234eaa054846049de4d1f0d44b36fb463db23ab82a24c4c052add70a
4
+ data.tar.gz: 26bd508f0d930e2b007d168148863b8af3d9dbbc5f7da1432167129f0426c52c
5
+ SHA512:
6
+ metadata.gz: 627bdac247356a53229ba4d52862a1020926bb488d0f9330f15954b81c468f6a9fc1349529d02d030b4588ab0822bb7e60101c9b32d182e6a45f60e43f0b28b7
7
+ data.tar.gz: fcf31763046709a6fa31bf2d06364402a0bcc684dd31b33ffad137a3cde15399aa6f86d2955c8db0f620d9913383fc41d945243b7f0dd3eee72c0dee3e7aab11
data/lib/tablehop.rb ADDED
@@ -0,0 +1,31 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+ require 'openssl'
4
+ require 'json'
5
+ require 'open-uri'
6
+ require 'nokogiri'
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)
22
+ end
23
+ #puts popular_games.length.to_s
24
+ #indItem = Nokogiri::HTML(doc.xpath('//html/body/items/item')[0])
25
+ return popular_games
26
+ end
27
+ end
28
+
29
+
30
+
31
+
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tablehop
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.5
5
+ platform: ruby
6
+ authors:
7
+ - Liam duggan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-08-12 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Email and infraction handling for table hop
14
+ email: liamduggancourse@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/tablehop.rb
20
+ homepage: https://rubygems.org/gems/tablehop
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.1.4
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Additional fuctionality for the Rails project Tablehop
43
+ test_files: []