ruby-lol 0.9.13 → 0.9.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/lib/lol/request.rb +1 -4
- data/lib/lol/version.rb +1 -1
- data/spec/lol/request_spec.rb +3 -5
- 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: 81dabecfe271cb17a25f3533ccd1a34455e93847
|
4
|
+
data.tar.gz: dba729c13e5c7a801bdcd28bd9efc5f089e0c55a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 066470b73875a474f830f944e2f80dbd18b2ecd8025f113ea1b87140b56102c8fec34f1070106237be7f42c4613cf577d2126256b291357f74350b15bf6a1f6d
|
7
|
+
data.tar.gz: 9c5c98ff2490c338924c042b24f8cda09bc475e4ab3d662f35e56512827fd1d1c91c4e10e0d2eb02df391b7b5059696bae82da82d49a00273112cf2158d1655b
|
data/README.md
CHANGED
@@ -22,15 +22,17 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
+
[ Outdated, anyone who wants to contribute to this please do it :) ]
|
26
|
+
|
25
27
|
```ruby
|
26
28
|
require 'lol'
|
27
29
|
|
28
|
-
client = Lol::Client.new "my_api_key", "euw"
|
29
|
-
# => <Lol::Client:
|
30
|
+
client = Lol::Client.new "my_api_key", {region: "euw"}
|
31
|
+
# => <Lol::Client:0x000000020c0b28 @api_key="my_api_key", @region="euw", @cached=false>
|
30
32
|
|
31
33
|
# NEW! You can cache requests using Redis now
|
32
34
|
# ttl defaults to 900
|
33
|
-
client = Lol::Client.new "my_api_key", "euw",
|
35
|
+
client = Lol::Client.new "my_api_key", {region: "euw", redis: "redis://localhost:6379", ttl: 900}
|
34
36
|
|
35
37
|
# Available Requests
|
36
38
|
client.champion
|
@@ -118,6 +120,9 @@ client.static.champion.get(champData: 'lore')
|
|
118
120
|
5. Create new Pull Request
|
119
121
|
|
120
122
|
## Changelog
|
123
|
+
- 0.9.14 Fixed a caching bug
|
124
|
+
- 0.9.13 Updated to latest API versions
|
125
|
+
- 0.9.12 Fixed a caching bug
|
121
126
|
- 0.9.11 Added caching support via REDIS
|
122
127
|
- 0.9.7 Updated LeagueRequest to API v2.3
|
123
128
|
- 0.9.6 Updated SummonerRequest and GameRequest to API v1.3
|
data/lib/lol/request.rb
CHANGED
@@ -55,10 +55,7 @@ module Lol
|
|
55
55
|
raise NotFound.new("404 Not Found") if response.respond_to?(:code) && response.not_found?
|
56
56
|
raise InvalidAPIResponse.new(response["status"]["message"]) if response.is_a?(Hash) && response["status"]
|
57
57
|
|
58
|
-
if cached?
|
59
|
-
store.set clean_url(url), response.to_json
|
60
|
-
store.expire url, ttl
|
61
|
-
end
|
58
|
+
store.setex clean_url(url), ttl, response.to_json if cached?
|
62
59
|
|
63
60
|
response
|
64
61
|
end
|
data/lib/lol/version.rb
CHANGED
data/spec/lol/request_spec.rb
CHANGED
@@ -54,6 +54,8 @@ describe Request do
|
|
54
54
|
context "caching" do
|
55
55
|
before :all do
|
56
56
|
class FakeRedis < Redis
|
57
|
+
attr_reader :store
|
58
|
+
|
57
59
|
def initialize options = {}
|
58
60
|
@store = {}
|
59
61
|
end
|
@@ -62,11 +64,8 @@ describe Request do
|
|
62
64
|
@store[key]
|
63
65
|
end
|
64
66
|
|
65
|
-
def
|
67
|
+
def setex key, ttl, val
|
66
68
|
@store[key] = val
|
67
|
-
end
|
68
|
-
|
69
|
-
def expire key, ttl
|
70
69
|
@store["#{key}:ttl"] = ttl
|
71
70
|
end
|
72
71
|
end
|
@@ -82,7 +81,6 @@ describe Request do
|
|
82
81
|
it "is cached" do
|
83
82
|
expect(request.class).not_to receive(:get)
|
84
83
|
request.perform_request "/foo"
|
85
|
-
|
86
84
|
end
|
87
85
|
|
88
86
|
it "serializes cached responses" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Intini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|