garen 1.0.1 → 1.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 +4 -4
- data/README.md +20 -8
- data/lib/garen/base.rb +7 -3
- data/lib/garen/version.rb +1 -1
- 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: f59a6c5d0369a061e432e64a881c953565f8f067
|
4
|
+
data.tar.gz: 99219811f49f116d5c3fbc48f5a1ed57b658a903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25e0a3874864c4451b042eec3768348abc92ee3fbf403b983da868dbffe405ca2ecda6208cc2014f8d6f563b5b7d193ac925ef13b00b9fc486a6516478353abe
|
7
|
+
data.tar.gz: 6cbc7a7434df88c950e12feee97fcc25b6d96ecd912a6aeae4647a4bf9557810f570fc60bb3847b780bc6e198240b29945dde6459cf7aa95917374340bac07af
|
data/README.md
CHANGED
@@ -24,6 +24,26 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
+
# Latest Updates
|
28
|
+
|
29
|
+
I have updated the way that rate limits are returned in the response. If you pass in the parameter 'return_rate_limits' and set it to true, it will return both the app and method limit counts. The response back from your API call will include a response hash of the api response from riot, and a rate_limit hash with the app and method counts included in.
|
30
|
+
|
31
|
+
See below:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
summoner = garen.summoner.by_name('Beasley', return_rate_limits: true)
|
35
|
+
# returns
|
36
|
+
"#<Hashie::Mash rate_limit=#<Hashie::Mash app_count=\"3:120,3:1\" method_count=\"1:10,1:600\"> response=#<Hashie::Rash account_id=36072798 id=22332661 name=\"Beasley\" profile_icon_id=20
|
37
|
+
95 revision_date=1503543762000 summoner_level=30>>"
|
38
|
+
# so you could call for example:
|
39
|
+
summoner.response.name
|
40
|
+
# this will give you 'Beasley' from the example above.
|
41
|
+
summoner.rate_limit.app_count
|
42
|
+
# this will give you '3:120,3:1' from the example above.
|
43
|
+
```
|
44
|
+
|
45
|
+
# How to Use:
|
46
|
+
|
27
47
|
You can begin by adding a config block to your application to set your Riot API-Key, instead of having to pass it through every call as a parameter.
|
28
48
|
However, if you'd rather pass it through as a parameter each time, that is also fine.
|
29
49
|
|
@@ -59,14 +79,6 @@ f2p_champs = garen.champion.all(freeToPlay: true)
|
|
59
79
|
|
60
80
|
Just look at the documentation on Riot's API - https://developer.riotgames.com/api-methods/ - for all the different query arguments you can pass in.
|
61
81
|
|
62
|
-
In addition, if you pass in the parameter 'headers' and set it to true, it will return both the app and method limit counts as party of the response body.
|
63
|
-
|
64
|
-
```ruby
|
65
|
-
summoner = garen.summoner.by_name('Beasley', headers: true)
|
66
|
-
# returns
|
67
|
-
<Hashie::Rash ... app_count="1:120,1:1" method_count="1:10,1:600" ...>
|
68
|
-
```
|
69
|
-
|
70
82
|
## Endpoints
|
71
83
|
|
72
84
|
The endpoints currently supported and their corresponding methods are:
|
data/lib/garen/base.rb
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
class Garen::Base
|
2
2
|
def make_request(conn, endpoint, options)
|
3
3
|
@request = conn.get endpoint, options
|
4
|
-
attach_rate_limits if options[:
|
4
|
+
return attach_rate_limits if options[:return_rate_limits].present?
|
5
5
|
@request.body
|
6
6
|
end
|
7
7
|
|
8
8
|
def attach_rate_limits
|
9
|
-
|
10
|
-
|
9
|
+
body = {}
|
10
|
+
body[:response] = @request.body
|
11
|
+
body[:rate_limit] = {}
|
12
|
+
body[:rate_limit][:app_count] = @request.headers['x-app-rate-limit-count'].to_s
|
13
|
+
body[:rate_limit][:method_count] = @request.headers['x-method-rate-limit-count'].to_s
|
14
|
+
Hashie::Mash.new body
|
11
15
|
end
|
12
16
|
end
|
data/lib/garen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Baugh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|