giant-bomber 0.0.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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/giant-bomber.rb +48 -0
  3. metadata +72 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 01f5ce078fe12224e8fdba40bd9d24375a5160a6
4
+ data.tar.gz: e7ac536e42b3d198e9e89a315d904213c541ff0e
5
+ SHA512:
6
+ metadata.gz: 20ffed698c92577ab267393dc477960ebc0bdfe9448e226ac7e30ee6a97b49b2947c2ba3eaa72c02661e03d63c05b4cc9817334dfaf400a6ffd5ff6eb753ae39
7
+ data.tar.gz: eb650a7814615074b79e41fd8e554bc32157ea42b77dc9bed491518be8288d2d43b0e27a44c5985b277c2a6ad1a6eed727b9e1e9eb34b81f860de1fdea048f21
@@ -0,0 +1,48 @@
1
+ require 'httparty'
2
+ require 'json'
3
+
4
+ class Agent
5
+ include HTTParty
6
+
7
+ attr_accessor :key
8
+ base_uri 'http://www.giantbomb.com/api'
9
+
10
+ #pass in your API key generated from the GiantBomb sign up
11
+ def initialize(key)
12
+ @key = key
13
+ @accept = "application/json"
14
+ end
15
+
16
+ #get a game based on its unique GiantBomb id
17
+ def game(id)
18
+ self.class.get("/game/#{id}/?api_key=#{@key}&format=json&field_list=name,deck,description,genres,image")["results"]
19
+ end
20
+
21
+ #get a list of platforms
22
+ def platforms
23
+ self.class.get("/platforms/?api_key=#{@key}&format=json&field_list=name,id")["results"]
24
+ end
25
+
26
+ #Search for info about a platform, based on its name
27
+ def platform(id)
28
+ self.class.get("/platform/#{id}/?api_key=#{@key}&format=json&field_list=name,description,deck,release_date,image")["results"]
29
+ end
30
+
31
+ #Create a relationship between platform name and its unique GiantBomb id
32
+ def platform_id_hash
33
+ list = platforms
34
+ platform_hash = Hash.new
35
+ list.each do |platform|
36
+ platform_hash[platform["name"]] = platform["id"]
37
+ end
38
+
39
+ platform_hash
40
+ end
41
+
42
+ #get the 20 most popular games from the platform of choice
43
+ def platform_games(platform_name)
44
+ self.class.get("/games/?api_key=#{@key}&format=json&platforms=#{platform_id.to_i}&field_list=name,deck,image,id,original_release_date&sort=number_of_user_reviews:desc&limit=20")["results"]
45
+ end
46
+
47
+
48
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: giant-bomber
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Byrd
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-05-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.13'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: A client for the Giant Bomb API
42
+ email: andrewmbyrd@gmail.com
43
+ executables: []
44
+ extensions: []
45
+ extra_rdoc_files: []
46
+ files:
47
+ - lib/giant-bomber.rb
48
+ homepage: http://rubygems.org/gems/giant-bomber
49
+ licenses:
50
+ - MIT
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project:
68
+ rubygems_version: 2.5.2
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Giant Bomb API Client
72
+ test_files: []