garen 1.0.0 → 1.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 +4 -4
- data/.gitignore +1 -0
- data/README.md +124 -1
- data/lib/garen/base.rb +8 -2
- 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: 39fddb3f1c0addcedcbef8edd8068d27a61c1b9b
|
4
|
+
data.tar.gz: b1a9e540999519ed79670342ea8565650c89da36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af59fe401beac0b72708736c0ea8274e4d0b51d3b27beb0cb1674793b0d3f4a0c04a16ea7ac3feee528bc9a2548b46084e83bd4b7ebca54278c7613873d73e44
|
7
|
+
data.tar.gz: 982075cebe8de740f369b3e67063850c632a2914e4417bd9a502627a3de8e9de1c0550667ae755c93cb1f90730f8437ba1c9b32b73590638d647c4d90c26ee07
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[](https://codeclimate.com/github/b4ugh/garen)
|
2
2
|
[](https://codeclimate.com/github/b4ugh/garen/coverage)
|
3
|
+
[](https://codeclimate.com/github/b4ugh/garen)
|
3
4
|
|
4
5
|
# Garen
|
5
6
|
|
@@ -23,7 +24,123 @@ Or install it yourself as:
|
|
23
24
|
|
24
25
|
## Usage
|
25
26
|
|
26
|
-
|
27
|
+
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
|
+
However, if you'd rather pass it through as a parameter each time, that is also fine.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
Garen.configure do |config|
|
32
|
+
config.api_key = 'RGAPI-Whatever-Riot-API-Token-You-Were-Given'
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
To get started, first create a Garen client
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
garen = Garen::Client.new
|
40
|
+
# If you didn't pass in your API key in a config block you would pass it in here
|
41
|
+
garen = Garen::Client.new(api_key: 'RGAPI-Whatever-Riot-API-Token-You-Were-Given')
|
42
|
+
# You may also pass in the service platform too - it defaults to 'na1' but feel free to change
|
43
|
+
garen = Garen::Client.new(service_platform: 'euw1')
|
44
|
+
# You can also pass in a debug parameter for troubleshooting issues, just pass in debug: true
|
45
|
+
```
|
46
|
+
|
47
|
+
You are now free to make API calls using the Garen::Client instance you created.
|
48
|
+
For example, if I wanted to retrieve summoner info for my league account 'Beasley':
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
summoner_info = garen.summoner.by_name('Beasley')
|
52
|
+
```
|
53
|
+
|
54
|
+
You can also pass in optional params into the api calls. For example, if you wanted to get a list of just the free champions this week, you could run:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
f2p_champs = garen.champion.all(freeToPlay: true)
|
58
|
+
```
|
59
|
+
|
60
|
+
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
|
+
|
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
|
+
## Endpoints
|
71
|
+
|
72
|
+
The endpoints currently supported and their corresponding methods are:
|
73
|
+
|
74
|
+
CHAMPION-MASTERY-V3
|
75
|
+
|
76
|
+
.champion_mastery.by_summoner_id(summoner_id)
|
77
|
+
.champion_mastery.by_summoner_and_champion_id(summoner_id, champion_id)
|
78
|
+
.champion_mastery.score_by_summoner_id(summoner_id)
|
79
|
+
|
80
|
+
CHAMPION-V3
|
81
|
+
|
82
|
+
.champion.all
|
83
|
+
.champion.by_champion_id(champion_id)
|
84
|
+
|
85
|
+
LEAGUE-V3
|
86
|
+
|
87
|
+
.league.challenger
|
88
|
+
.league.master
|
89
|
+
.league.by_summoner_id
|
90
|
+
.league.position_by_summoner_id
|
91
|
+
|
92
|
+
LOL-STATIC-DATA-V3
|
93
|
+
|
94
|
+
.static.champions
|
95
|
+
.static.champions_by_id(champion_id)
|
96
|
+
.static.items
|
97
|
+
.static.items_by_id(item_id)
|
98
|
+
.static.language_strings
|
99
|
+
.static.languages
|
100
|
+
.static.maps
|
101
|
+
.static.masteries
|
102
|
+
.static.masteries_by_id(mastery_id)
|
103
|
+
.static.profile_icons
|
104
|
+
.static.realms
|
105
|
+
.static.runes
|
106
|
+
.static.runes_by_id(rune_id)
|
107
|
+
.static.summoner_spells
|
108
|
+
.static.summoner_spells_by_id(summoner_spell_id)
|
109
|
+
.static.version
|
110
|
+
|
111
|
+
LOL-STATUS-V3
|
112
|
+
|
113
|
+
.status.status
|
114
|
+
|
115
|
+
MASTERIES-V3
|
116
|
+
|
117
|
+
.masteries.by_summoner_id(summoner_id)
|
118
|
+
|
119
|
+
MATCH-V3
|
120
|
+
|
121
|
+
.match.by_match_id(match_id)
|
122
|
+
.match.by_account_id(account_id)
|
123
|
+
.match.recent_by_account_id(account_id)
|
124
|
+
.match.timeline_by_match_id(match_id)
|
125
|
+
|
126
|
+
RUNES-V3
|
127
|
+
|
128
|
+
.runes.by_summoner_id(summoner_id)
|
129
|
+
|
130
|
+
SPECTATOR-V3
|
131
|
+
|
132
|
+
.spectator.by_summoner_id(summoner_id) - will return 404 if summoner not in a game
|
133
|
+
.spectator.featured_games
|
134
|
+
|
135
|
+
SUMMONER-V3
|
136
|
+
|
137
|
+
.summoner.by_name(name)
|
138
|
+
.summoner.by_account_id(account_id)
|
139
|
+
.summoner.by_summoner_id(summoner_id)
|
140
|
+
|
141
|
+
### Not Implemented
|
142
|
+
|
143
|
+
Tournaments endpoints.
|
27
144
|
|
28
145
|
## Development
|
29
146
|
|
@@ -33,6 +150,12 @@ After checking out the repo, you can run `rake test` to run the tests. You can a
|
|
33
150
|
|
34
151
|
Bug reports and pull requests are welcome on GitHub at https://github.com/b4ugh/garen.
|
35
152
|
|
153
|
+
1. Fork it ( https://github.com/b4ugh/garen/fork )
|
154
|
+
2. Create your feature branch (git checkout -b my-new-feature)
|
155
|
+
3. Commit your changes (git commit -am 'new stuff!')
|
156
|
+
4. Push to the branch (git push origin my-new-feature)
|
157
|
+
5. Create a new PR (pull request)
|
158
|
+
|
36
159
|
## License
|
37
160
|
|
38
161
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/lib/garen/base.rb
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
class Garen::Base
|
2
2
|
def make_request(conn, endpoint, options)
|
3
|
-
request = conn.get endpoint, options
|
4
|
-
options[:
|
3
|
+
@request = conn.get endpoint, options
|
4
|
+
attach_rate_limits if options[:headers].present?
|
5
|
+
@request.body
|
6
|
+
end
|
7
|
+
|
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']
|
5
11
|
end
|
6
12
|
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.1
|
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-
|
11
|
+
date: 2017-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|