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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 006de251c4e277db5f622c9a32b88bdf79f8d958
4
- data.tar.gz: ec86dcb6c1b7dcd8f86f4bfbe0de26c229ca36f4
3
+ metadata.gz: 81dabecfe271cb17a25f3533ccd1a34455e93847
4
+ data.tar.gz: dba729c13e5c7a801bdcd28bd9efc5f089e0c55a
5
5
  SHA512:
6
- metadata.gz: ebf690e5492bb56291144b7b46af261e0ac916dc68f4645e69fa3b7cf911d0d64567eb07aec2b95f04493d35d9cf7e1d69ddb4a8bd1a55e4b19dbd3ac0bc3d01
7
- data.tar.gz: 8a63a55a1d9b5793576718d8f5019a1071cf74da00cc14c81a71a5e8ea4c33258bcfb00cf293eb60dde86363d77d622f058394c377e9f0509b0cc7cf9ad3395c
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:0x007fd09d1abb00 @api_key="my_api_key", @region="euw">
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", {redis: "redis://localhost:6379", ttl: 900}
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
@@ -1,3 +1,3 @@
1
1
  module Lol
2
- VERSION = "0.9.13"
2
+ VERSION = "0.9.14"
3
3
  end
@@ -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 set key, val
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.13
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-02 00:00:00.000000000 Z
11
+ date: 2014-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler