steamspy 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.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +57 -0
- data/lib/steamspy.rb +5 -0
- data/lib/steamspy/api.rb +40 -0
- data/lib/steamspy/connection.rb +28 -0
- data/lib/steamspy/version.rb +3 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7fb826bab12ba8dd282ad9d9cf757674d24966e2
|
4
|
+
data.tar.gz: ee875f48dabcbf1f3ef02bb521d4ab2c81a1071f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 91c18193c1ebdbe719decd2a7f775c8c31dac08ec24b3b25317b972209d4577a3671a82e111d08c82a3b261c37fa52d722373a68d23d7a937a43df47c61190f9
|
7
|
+
data.tar.gz: 59eb651d1c41a58c41a04033ee23a606167a257fae3b22f5906028c186c0c21010611d0dbe1df5b58f12aa29a8f4d3379f34cddc06ec9a14e223ce9d2cc33e11
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Rolandas Barysas
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# steamspy-ruby [](https://travis-ci.org/rbrs/steamspy-ruby)
|
2
|
+
|
3
|
+
A Ruby interface to the SteamSpy API.
|
4
|
+
|
5
|
+
### Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem 'steamspy'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
```
|
22
|
+
$ gem install steamspy
|
23
|
+
```
|
24
|
+
|
25
|
+
### Usage
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'steamspy'
|
29
|
+
|
30
|
+
steamspy = SteamSpy::Api.new
|
31
|
+
|
32
|
+
# Get application details
|
33
|
+
ss = steamspy.appdetails(730)
|
34
|
+
ss.status # => 200
|
35
|
+
ss.data # => {...}
|
36
|
+
|
37
|
+
# Get games in genre
|
38
|
+
ss = steamspy.genre("Early Access")
|
39
|
+
|
40
|
+
# Get top 100 games by players in the last two weeks
|
41
|
+
ss = steamspy.top100in2weeks
|
42
|
+
|
43
|
+
# Get top 100 games by players since March 2009
|
44
|
+
ss = steamspy.top100forever
|
45
|
+
|
46
|
+
# Get top 100 games by owners
|
47
|
+
ss = steamspy.top100owned
|
48
|
+
|
49
|
+
# Get all games with owners data sorted by owners
|
50
|
+
ss = steamspy.all
|
51
|
+
```
|
52
|
+
|
53
|
+
More information about API could be found in the [official website](http://steamspy.com/api.php).
|
54
|
+
|
55
|
+
### License
|
56
|
+
|
57
|
+
The SteamSpy rubygem is released under the MIT license.
|
data/lib/steamspy.rb
ADDED
data/lib/steamspy/api.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
module SteamSpy
|
2
|
+
class Api
|
3
|
+
def initialize
|
4
|
+
@connection = Connection.new unless @connection
|
5
|
+
end
|
6
|
+
|
7
|
+
def appdetails(appid)
|
8
|
+
raise ArgumentError unless appid
|
9
|
+
req = @connection.request("?request=appdetails&appid=#{appid}")
|
10
|
+
Response.new(req.code, JSON.parse(req.body))
|
11
|
+
end
|
12
|
+
|
13
|
+
def genre(genre)
|
14
|
+
raise ArgumentError unless genre
|
15
|
+
genre = genre.gsub!(/\s+/, '+')
|
16
|
+
req = @connection.request("?request=genre&genre=#{genre}")
|
17
|
+
Response.new(req.code, JSON.parse(req.body))
|
18
|
+
end
|
19
|
+
|
20
|
+
def top100in2weeks
|
21
|
+
req = @connection.request("?request=top100in2weeks")
|
22
|
+
Response.new(req.code, JSON.parse(req.body))
|
23
|
+
end
|
24
|
+
|
25
|
+
def top100forever
|
26
|
+
req = @connection.request("?request=top100forever")
|
27
|
+
Response.new(req.code, JSON.parse(req.body))
|
28
|
+
end
|
29
|
+
|
30
|
+
def top100owned
|
31
|
+
req = @connection.request("?request=top100owned")
|
32
|
+
Response.new(req.code, JSON.parse(req.body))
|
33
|
+
end
|
34
|
+
|
35
|
+
def all
|
36
|
+
req = @connection.request("?request=all")
|
37
|
+
Response.new(req.code, JSON.parse(req.body))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module SteamSpy
|
4
|
+
class Connection
|
5
|
+
include HTTParty
|
6
|
+
base_uri 'http://steamspy.com/api.php'
|
7
|
+
|
8
|
+
def request(uri)
|
9
|
+
raise ArgumentError unless uri
|
10
|
+
self.class.get(uri)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Response
|
15
|
+
def initialize(status, data)
|
16
|
+
@status = status
|
17
|
+
@data = data
|
18
|
+
end
|
19
|
+
|
20
|
+
def status
|
21
|
+
@status
|
22
|
+
end
|
23
|
+
|
24
|
+
def data
|
25
|
+
@data
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: steamspy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rolandas Barysas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: httparty
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.13'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.13'
|
55
|
+
description: A Ruby interface to the SteamSpy API
|
56
|
+
email: hello@rbrs.io
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files: []
|
60
|
+
files:
|
61
|
+
- LICENSE
|
62
|
+
- README.md
|
63
|
+
- lib/steamspy.rb
|
64
|
+
- lib/steamspy/api.rb
|
65
|
+
- lib/steamspy/connection.rb
|
66
|
+
- lib/steamspy/version.rb
|
67
|
+
homepage: https://github.com/rbrs/steamspy-ruby
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.4.6
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: SteamSpy Ruby API
|
91
|
+
test_files: []
|