gamelocker_api 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 418b843e6557d9e7fd0b973050fa2c03b064f53a
4
- data.tar.gz: b8634c8c6add7675aacb95fb210b0439e4a5d05b
3
+ metadata.gz: d0f07d4ead2eb25d125e496142a7b7b0c57761bb
4
+ data.tar.gz: eb651db6e2386a71048f92ee35d3a5ee6c905265
5
5
  SHA512:
6
- metadata.gz: d7a596d17608a48881db6fdeac5e236825b49f032e985c1fad1b8d002bf834aa75463827e9f2c8ada6bbbe72f4b956181dfcb6d136a08ae8c6e31eb5b8fcf576
7
- data.tar.gz: d7ef28ffd8772cdf118cbe8c9bf2d7e03cebf6fda1890424087031e62ae980cd56db39901437edf5627b4cdd6ba09b1dba17797d3ed76502ce94ca92d136e439
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
@@ -1,3 +1,3 @@
1
1
  class GameLockerAPI
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -37,6 +37,10 @@ class GameLockerAPI
37
37
  request("matches", match_params)
38
38
  end
39
39
 
40
+ def telemetry(telemetry_url)
41
+ Telemetry.new(telemetry_url)
42
+ end
43
+
40
44
  # def samples(samples_params = {})
41
45
  # request("samples", samples_params)
42
46
  # end
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.2
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-20 00:00:00.000000000 Z
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client