gamelocker_api 0.1.2 → 0.1.3
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 +4 -4
- data/README.md +35 -3
- data/lib/gamelocker_api/telemetry.rb +3 -1
- data/lib/gamelocker_api/version.rb +1 -1
- data/lib/gamelocker_api.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0f07d4ead2eb25d125e496142a7b7b0c57761bb
|
4
|
+
data.tar.gz: eb651db6e2386a71048f92ee35d3a5ee6c905265
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed5baee98622eb312d264499ca5393a87531182980ec4420d3ffc221555f4b864656d9306648814c30936b147fcf7f5519b018350811a10f02892e197b451a5e
|
7
|
+
data.tar.gz: a5441298514266ece5c5a585ba433787a267fca8f2210af0d6f249697448fd09179d87ee265216f2c69d91ea79ae4499b56e68a50b203ae752cb837e7b1a0beb
|
data/README.md
CHANGED
@@ -19,14 +19,46 @@ Or install it yourself as:
|
|
19
19
|
$ gem install gamelocker_api
|
20
20
|
|
21
21
|
## Usage
|
22
|
-
|
23
|
-
TODO: Write usage instructions here
|
22
|
+
Get player(s) by In-game name
|
24
23
|
```ruby
|
25
24
|
# Api Key and Region
|
26
25
|
api = GameLockerAPI.new("API_KEY", "na")
|
27
|
-
response = api.players("Cyberarm")
|
26
|
+
response = api.players("Cyberarm") # method :players always returns an Array
|
27
|
+
p response.first # => GameLockerAPI::Player
|
28
|
+
```
|
29
|
+
Get player by UUID
|
30
|
+
```ruby
|
31
|
+
response = api.player("6168b9ca-e7c8-11e6-812b-06388a2f2ea7")
|
28
32
|
p response # => GameLockerAPI::Player
|
29
33
|
```
|
34
|
+
Get matches
|
35
|
+
```ruby
|
36
|
+
response = api.matches
|
37
|
+
p response # => [GameLockerAPI::Match, GameLockerAPI::Match]
|
38
|
+
```
|
39
|
+
Get matches with players that have In-game names
|
40
|
+
```ruby
|
41
|
+
response = api.matches({"filter[playerNames]" => "Cyberarm"}) # Note: Will only return the last 3 hours of matches by default, see https://developer.vainglorygame.com/docs#get-a-collection-of-matches
|
42
|
+
p response # => [GameLockerAPI::Match, GameLockerAPI::Match]
|
43
|
+
```
|
44
|
+
Get a match
|
45
|
+
```ruby
|
46
|
+
match = api.match("0bf53e9a-268f-11e7-9456-063bc004098b")
|
47
|
+
p match # => GameLockerAPI::Match
|
48
|
+
```
|
49
|
+
Get telemetry
|
50
|
+
```ruby
|
51
|
+
response = api.telemetry(match.telemetry_url)
|
52
|
+
p response # => [GameLockerAPI::Telemetry::Event, GameLockerAPI::Telemetry::Event]
|
53
|
+
```
|
54
|
+
Check if you're being rate limited
|
55
|
+
```ruby
|
56
|
+
response.headers[:x_ratelimit_remaining] # => 9
|
57
|
+
```
|
58
|
+
## Supports
|
59
|
+
* Telemetry
|
60
|
+
* Player(s)
|
61
|
+
* Match(s)
|
30
62
|
|
31
63
|
## Development
|
32
64
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
@@ -6,11 +6,13 @@ class GameLockerAPI
|
|
6
6
|
@events = []
|
7
7
|
response = RestClient.get(telemetry_url)
|
8
8
|
parse(response.body)
|
9
|
+
|
10
|
+
return self
|
9
11
|
end
|
10
12
|
|
11
13
|
def parse(json)
|
12
14
|
Oj.load(json).each do |event|
|
13
|
-
@events << Event.new(event['time'], event['type'], event['payload'])
|
15
|
+
@events << Event.new(Time.parse(event['time']), event['type'], event['payload'])
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
data/lib/gamelocker_api.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gamelocker_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyberarm
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|