open_weather_client-caching-redis 0.1.0 → 0.1.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38e2abd25f7664ff422a5ba33878270d82a389471fcffac1203240fbc2a2f204
|
4
|
+
data.tar.gz: 8199740c4e96e74c16c26f2e0b5d84ed11847e7dd31e2f4263544de0228d2baa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecf1607460a825a587671cbc55214350d4679483f94064fdbaf99dce087f086026efc35b41de454aba79a40054f6691c35de6f97d00436552554764c3d686c6f
|
7
|
+
data.tar.gz: c019a5034397aed799c6790dd0e228c44be46612a28537cf5bf1c1c9ba55015176aaddce37ea98255a1ebfc0ed8dea1c414e17058f0827f02536137d35c305a9
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,7 @@ This gem provides the redis caching method for [OpenWeatherClient](https://githu
|
|
11
11
|
Add this line to your application's Gemfile:
|
12
12
|
|
13
13
|
```ruby
|
14
|
-
gem 'open_weather_client'
|
14
|
+
gem 'open_weather_client-caching-redis'
|
15
15
|
```
|
16
16
|
|
17
17
|
And then execute:
|
@@ -28,6 +28,9 @@ Configure `OpenWeatherClient` to use redis caching.
|
|
28
28
|
The redis connection can be configured through rails credentials or by manually setting the parameters in configuration.
|
29
29
|
|
30
30
|
```ruby
|
31
|
+
require 'open_weather_client-caching-redis/caching/redis'
|
32
|
+
require 'open_weather_client'
|
33
|
+
|
31
34
|
# OpenWeatherClient initializer
|
32
35
|
OpenWeatherClient.configure do |config|
|
33
36
|
config.caching = OpenWeatherClient::Caching::Redis
|
@@ -35,10 +38,10 @@ OpenWeatherClient.configure do |config|
|
|
35
38
|
config.ttl = 14
|
36
39
|
|
37
40
|
# redis connection configuration
|
38
|
-
config.db = 0
|
39
|
-
config.host = 'localhost'
|
40
|
-
config.password = '123456'
|
41
|
-
config.port = 6379
|
41
|
+
config.db = 0 # default
|
42
|
+
config.host = 'localhost' # default
|
43
|
+
config.password = '123456' # default: nil
|
44
|
+
config.port = 6379 # default
|
42
45
|
end
|
43
46
|
```
|
44
47
|
|
@@ -56,10 +59,12 @@ open_weather_client:
|
|
56
59
|
```
|
57
60
|
|
58
61
|
After configuration of the credentials you can load the settings in your initializer with `#load_from_rails_configuration`.
|
62
|
+
Raises KeyError if redis caching is used but credentials are not set.
|
59
63
|
|
60
64
|
```ruby
|
61
65
|
# OpenWeatherClient initializer
|
62
66
|
OpenWeatherClient.configure do |config|
|
67
|
+
config.caching = OpenWeatherClient::Caching::Redis
|
63
68
|
config.load_from_rails_credentials
|
64
69
|
end
|
65
70
|
```
|
@@ -22,6 +22,9 @@ module OpenWeatherClient
|
|
22
22
|
def initialize
|
23
23
|
old_initialize
|
24
24
|
|
25
|
+
self.db = 0
|
26
|
+
self.host = 'localhost'
|
27
|
+
self.port = 6379
|
25
28
|
self.ttl = 7
|
26
29
|
end
|
27
30
|
|
@@ -30,7 +33,9 @@ module OpenWeatherClient
|
|
30
33
|
def load_from_rails_credentials
|
31
34
|
old_load
|
32
35
|
|
33
|
-
settings = Rails.application.credentials.open_weather_client
|
36
|
+
settings = Rails.application.credentials.open_weather_client![:redis]
|
37
|
+
raise KeyError unless settings
|
38
|
+
|
34
39
|
self.host = settings[:host]
|
35
40
|
self.port = settings[:port]
|
36
41
|
self.db = settings[:db]
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.add_dependency 'open_weather_client', '>= 0.1.
|
32
|
+
spec.add_dependency 'open_weather_client', '>= 0.1.5'
|
33
33
|
spec.add_dependency 'redis', '>= 4.5.0'
|
34
34
|
|
35
35
|
spec.add_development_dependency 'bundler', '>= 1.17'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_weather_client-caching-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Keune
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1.
|
19
|
+
version: 0.1.5
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1.
|
26
|
+
version: 0.1.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|