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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39fddb3f1c0addcedcbef8edd8068d27a61c1b9b
4
- data.tar.gz: b1a9e540999519ed79670342ea8565650c89da36
3
+ metadata.gz: f59a6c5d0369a061e432e64a881c953565f8f067
4
+ data.tar.gz: 99219811f49f116d5c3fbc48f5a1ed57b658a903
5
5
  SHA512:
6
- metadata.gz: af59fe401beac0b72708736c0ea8274e4d0b51d3b27beb0cb1674793b0d3f4a0c04a16ea7ac3feee528bc9a2548b46084e83bd4b7ebca54278c7613873d73e44
7
- data.tar.gz: 982075cebe8de740f369b3e67063850c632a2914e4417bd9a502627a3de8e9de1c0550667ae755c93cb1f90730f8437ba1c9b32b73590638d647c4d90c26ee07
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:
@@ -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[:headers].present?
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
- @request.body['app_count'] = @request.headers['x-app-rate-limit-count']
10
- @request.body['method_count'] = @request.headers['x-method-rate-limit-count']
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
@@ -1,3 +1,3 @@
1
1
  module Garen
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.0.2'.freeze
3
3
  end
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.1
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-03 00:00:00.000000000 Z
11
+ date: 2017-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport