buttercms-ruby 2.3 → 2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/buttercms/data_store_adapters/redis_ssl.rb +27 -0
- data/lib/buttercms/version.rb +1 -1
- data/lib/buttercms-ruby.rb +7 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66bbe24c7759a4bbf8c026d8f70f42888e71ef2733cfcc0d02917c0e4049231b
|
4
|
+
data.tar.gz: 2bcbeb00f46e7f8e5039528a7c4cda0d84c12eb26b8af4bfcc40495c83ba4783
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb1dab8986628b6a84233d826e1116f2dad712715c0cfd068e796f7ce1b6f8b124bdbe3324e444f3a9ecea33025a1ba22892cf283ebaabcaba3b052c73bc94e2
|
7
|
+
data.tar.gz: 7b3345cad1de8da899afa6e4cd14acc7e3d0bc09f5a19c6a0798ed7b21fd86ef55d8a08b239811cb1c0a6728e05318605aebcee74ee03ee860accce13d67330a
|
data/README.md
CHANGED
@@ -134,6 +134,9 @@ ButterCMS::data_store = :yaml, "/File/Path/For/buttercms.store"
|
|
134
134
|
# Use Redis
|
135
135
|
ButterCMS::data_store = :redis, ENV['REDIS_URL']
|
136
136
|
|
137
|
+
# Use Redis over ssl store
|
138
|
+
ButterCMS.data_store = :redis_ssl, ENV["REDIS_URL"], { ca_file: "/path/to/ca.crt" }
|
139
|
+
|
137
140
|
# Set logger (optional)
|
138
141
|
ButterCMS::logger = MyLogger.new
|
139
142
|
```
|
@@ -0,0 +1,27 @@
|
|
1
|
+
begin
|
2
|
+
require 'redis'
|
3
|
+
rescue LoadError
|
4
|
+
puts "WARNING: redis >= 3.0.0 is required to use the redis data store."
|
5
|
+
raise
|
6
|
+
end
|
7
|
+
|
8
|
+
module ButterCMS
|
9
|
+
module DataStoreAdapters
|
10
|
+
class RedisSSL
|
11
|
+
def initialize(options)
|
12
|
+
redis_url = options.first
|
13
|
+
ssl_params = options.second && Hash[options.second]
|
14
|
+
|
15
|
+
@redis = ::Redis.new(url: redis_url, ssl_params:)
|
16
|
+
end
|
17
|
+
|
18
|
+
def set(key, value)
|
19
|
+
@redis.set(key, value)
|
20
|
+
end
|
21
|
+
|
22
|
+
def get(key)
|
23
|
+
@redis.get(key)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/buttercms/version.rb
CHANGED
data/lib/buttercms-ruby.rb
CHANGED
@@ -59,6 +59,9 @@ module ButterCMS
|
|
59
59
|
when :redis
|
60
60
|
require_relative 'buttercms/data_store_adapters/redis'
|
61
61
|
@data_store = ButterCMS::DataStoreAdapters::Redis.new(options)
|
62
|
+
when :redis_ssl
|
63
|
+
require_relative 'buttercms/data_store_adapters/redis_ssl'
|
64
|
+
@data_store = ButterCMS::DataStoreAdapters::RedisSSL.new(options)
|
62
65
|
else
|
63
66
|
raise ArgumentError.new "Invalid ButterCMS data store #{strategy}"
|
64
67
|
end
|
@@ -132,14 +135,14 @@ module ButterCMS
|
|
132
135
|
|
133
136
|
return JSON.parse(result)
|
134
137
|
end
|
135
|
-
|
138
|
+
|
136
139
|
def self.write_request(path, options = {})
|
137
140
|
raise ArgumentError.new "Please set your write API token" unless write_api_token
|
138
141
|
result = write_api_request(path, options)
|
139
142
|
|
140
143
|
return JSON.parse(result)
|
141
144
|
end
|
142
|
-
|
145
|
+
|
143
146
|
def self.write_api_request(path, options = {})
|
144
147
|
query = options.dup
|
145
148
|
token_for_request = query.delete(:auth_token) || write_api_token
|
@@ -177,9 +180,9 @@ module ButterCMS
|
|
177
180
|
|
178
181
|
response.body
|
179
182
|
end
|
180
|
-
|
183
|
+
|
181
184
|
private
|
182
|
-
|
185
|
+
|
183
186
|
def self.http_options
|
184
187
|
{
|
185
188
|
open_timeout: open_timeout || 2.0,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buttercms-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '2.
|
4
|
+
version: '2.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ButterCMS
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/buttercms/category.rb
|
61
61
|
- lib/buttercms/content.rb
|
62
62
|
- lib/buttercms/data_store_adapters/redis.rb
|
63
|
+
- lib/buttercms/data_store_adapters/redis_ssl.rb
|
63
64
|
- lib/buttercms/data_store_adapters/yaml.rb
|
64
65
|
- lib/buttercms/errors.rb
|
65
66
|
- lib/buttercms/feed.rb
|
@@ -95,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
96
|
- !ruby/object:Gem::Version
|
96
97
|
version: '0'
|
97
98
|
requirements: []
|
98
|
-
rubygems_version: 3.0.3
|
99
|
+
rubygems_version: 3.0.3.1
|
99
100
|
signing_key:
|
100
101
|
specification_version: 4
|
101
102
|
summary: Ruby API client for ButterCMS
|