steamspy 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fb826bab12ba8dd282ad9d9cf757674d24966e2
4
- data.tar.gz: ee875f48dabcbf1f3ef02bb521d4ab2c81a1071f
3
+ metadata.gz: 2dc5feab757b1b3a7955e3bcc77000d8779c3721
4
+ data.tar.gz: e6df0ddc993b3fd8db950d5db2413ba802b553cf
5
5
  SHA512:
6
- metadata.gz: 91c18193c1ebdbe719decd2a7f775c8c31dac08ec24b3b25317b972209d4577a3671a82e111d08c82a3b261c37fa52d722373a68d23d7a937a43df47c61190f9
7
- data.tar.gz: 59eb651d1c41a58c41a04033ee23a606167a257fae3b22f5906028c186c0c21010611d0dbe1df5b58f12aa29a8f4d3379f34cddc06ec9a14e223ce9d2cc33e11
6
+ metadata.gz: daa5a3772853146d88c05cdd5878805822f175bcc4586842733388c36a5129dae2fc9caabc15aefed33b6b9b4d000e3a5838ab25530d417ccfd229a3429472d9
7
+ data.tar.gz: 05b3585d4bfcaf72bf4483907a3cc09db0890445ca8dff0a9809df96e8324da821a4094f6147517236afb41487f1ee3272b2c5b12f2077dffa5cc2858561a22a
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # steamspy-ruby [![Build Status](https://travis-ci.org/rbrs/steamspy-ruby.svg?branch=master)](https://travis-ci.org/rbrs/steamspy-ruby)
2
2
 
3
- A Ruby interface to the SteamSpy API.
3
+ A Ruby interface to the [SteamSpy](http://steamspy.com/) API.
4
4
 
5
5
  ### Installation
6
6
 
data/lib/steamspy/api.rb CHANGED
@@ -7,34 +7,34 @@ module SteamSpy
7
7
  def appdetails(appid)
8
8
  raise ArgumentError unless appid
9
9
  req = @connection.request("?request=appdetails&appid=#{appid}")
10
- Response.new(req.code, JSON.parse(req.body))
10
+ Response.new(req.code, req.body)
11
11
  end
12
12
 
13
13
  def genre(genre)
14
14
  raise ArgumentError unless genre
15
15
  genre = genre.gsub!(/\s+/, '+')
16
16
  req = @connection.request("?request=genre&genre=#{genre}")
17
- Response.new(req.code, JSON.parse(req.body))
17
+ Response.new(req.code, req.body)
18
18
  end
19
19
 
20
20
  def top100in2weeks
21
21
  req = @connection.request("?request=top100in2weeks")
22
- Response.new(req.code, JSON.parse(req.body))
22
+ Response.new(req.code, req.body)
23
23
  end
24
24
 
25
25
  def top100forever
26
26
  req = @connection.request("?request=top100forever")
27
- Response.new(req.code, JSON.parse(req.body))
27
+ Response.new(req.code, req.body)
28
28
  end
29
29
 
30
30
  def top100owned
31
31
  req = @connection.request("?request=top100owned")
32
- Response.new(req.code, JSON.parse(req.body))
32
+ Response.new(req.code, req.body)
33
33
  end
34
34
 
35
35
  def all
36
36
  req = @connection.request("?request=all")
37
- Response.new(req.code, JSON.parse(req.body))
37
+ Response.new(req.code, req.body)
38
38
  end
39
39
  end
40
40
  end
@@ -12,17 +12,16 @@ module SteamSpy
12
12
  end
13
13
 
14
14
  class Response
15
+ attr_reader :status
16
+ attr_reader :data
17
+
15
18
  def initialize(status, data)
16
19
  @status = status
17
- @data = data
18
- end
19
-
20
- def status
21
- @status
22
- end
23
-
24
- def data
25
- @data
20
+ begin
21
+ @data = JSON.parse(data)
22
+ rescue
23
+ @data = {}
24
+ end
26
25
  end
27
26
  end
28
27
  end
@@ -1,3 +1,3 @@
1
1
  module SteamSpy
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: steamspy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rolandas Barysas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake