cloudflare_client_rb 4.2.10 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloudflare_client/namespace/value.rb +26 -0
- data/lib/cloudflare_client/namespace.rb +12 -0
- data/lib/cloudflare_client/version.rb +1 -1
- data/lib/cloudflare_client/zone/custom_hostname_v2.rb +24 -0
- data/lib/cloudflare_client/zone/custom_ssl.rb +1 -1
- data/lib/cloudflare_client.rb +4 -1
- metadata +10 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b750c4cf1d2406e217504fe9cbf195faf7dbc87
|
4
|
+
data.tar.gz: 97a75d61e8d7f758425e3fb0c01d00bcf978f372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b10b81567bd45527a8826e441cfb429158eaca341532d3cff5d1d02c895dea0334ea3e91c7040707cd714cedccc9b71fdae3236f8fefffedf618c538b5966e8b
|
7
|
+
data.tar.gz: 05c0e5b3880770e0291107b7608a4d9bdb18be396404cdd5f720c9ea06fa1c6d94a0b16c9b2ba95dd70271d64fcec649de91c5ce38de09cfef97f248ac5b64cf
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class CloudflareClient::Value < CloudflareClient::Namespace
|
2
|
+
attr_reader :namespace_id
|
3
|
+
|
4
|
+
def initialize(args)
|
5
|
+
@namespace_id = args.delete(:namespace_id)
|
6
|
+
id_check(:namespace_id, namespace_id)
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def write(key:, value:, expiration_ttl: nil, metadata: nil)
|
11
|
+
if expiration_ttl
|
12
|
+
raise RuntimeError, 'expiration_ttl must be an integer' unless expiration_ttl.kind_of?(Integer)
|
13
|
+
end
|
14
|
+
|
15
|
+
data = metadata ? { value: value, metadata: metadata} : value
|
16
|
+
cf_put(path: "/accounts/#{account_id}/storage/kv/namespaces/#{namespace_id}/values/#{key}", data: data, params: {expiration_ttl: expiration_ttl})
|
17
|
+
end
|
18
|
+
|
19
|
+
def read(key:)
|
20
|
+
cf_get(path: "/accounts/#{account_id}/storage/kv/namespaces/#{namespace_id}/values/#{key}", raw: true)
|
21
|
+
end
|
22
|
+
|
23
|
+
def delete(key:)
|
24
|
+
cf_delete(path: "/accounts/#{account_id}/storage/kv/namespaces/#{namespace_id}/values/#{key}")
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CloudflareClient::Namespace < CloudflareClient
|
2
|
+
Dir[File.expand_path('../namespace/*.rb', __FILE__)].each {|f| require f}
|
3
|
+
|
4
|
+
attr_reader :account_id
|
5
|
+
|
6
|
+
def initialize(args)
|
7
|
+
@account_id = args.delete(:account_id)
|
8
|
+
id_check(:account_id, account_id)
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative 'custom_hostname'
|
2
|
+
# https://api.cloudflare.com/#custom-hostname-for-a-zone-list-custom-hostnames
|
3
|
+
class CloudflareClient::Zone::CustomHostnameV2 < CloudflareClient::Zone::CustomHostname
|
4
|
+
|
5
|
+
def create(hostname:, ssl: DEFAULT_SSL_PROPERTIES, custom_metadata: {}, custom_origin_server: nil)
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
9
|
+
def list(hostname: nil, id: nil, page: 1, per_page: 50, order: 'ssl', direction: 'desc', ssl: 0)
|
10
|
+
super
|
11
|
+
end
|
12
|
+
|
13
|
+
def show(id:)
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
def update(id:, ssl: {}, custom_metadata: nil, custom_origin_server: nil)
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def delete(id:)
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
@@ -26,7 +26,7 @@ class CloudflareClient::Zone::CustomSSL < CloudflareClient::Zone::Base
|
|
26
26
|
params = {page: page, per_page: per_page}
|
27
27
|
params[:match] = match
|
28
28
|
params[:direction] = direction
|
29
|
-
cf_get(path: "/zones/#{zone_id}/
|
29
|
+
cf_get(path: "/zones/#{zone_id}/custom_certificates", params: params)
|
30
30
|
end
|
31
31
|
|
32
32
|
##
|
data/lib/cloudflare_client.rb
CHANGED
@@ -180,10 +180,13 @@ class CloudflareClient
|
|
180
180
|
JSON.parse(result.body, symbolize_names: true)
|
181
181
|
end
|
182
182
|
|
183
|
-
def cf_put(path: nil, data: nil)
|
183
|
+
def cf_put(path: nil, data: nil, params: nil)
|
184
184
|
result = @cf_client.put do |request|
|
185
185
|
request.url(API_BASE + path) unless path.nil?
|
186
186
|
request.body = data.to_json unless data.nil?
|
187
|
+
unless params.nil?
|
188
|
+
request.params = params if params.values.any? { |i| !i.nil? }
|
189
|
+
end
|
187
190
|
end
|
188
191
|
JSON.parse(result.body, symbolize_names: true)
|
189
192
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudflare_client_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ian waters
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description:
|
14
14
|
email: iwaters@zendesk.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
@@ -19,6 +19,8 @@ files:
|
|
19
19
|
- lib/cloudflare_client.rb
|
20
20
|
- lib/cloudflare_client/certificate.rb
|
21
21
|
- lib/cloudflare_client/middleware/response/raise_error.rb
|
22
|
+
- lib/cloudflare_client/namespace.rb
|
23
|
+
- lib/cloudflare_client/namespace/value.rb
|
22
24
|
- lib/cloudflare_client/organization.rb
|
23
25
|
- lib/cloudflare_client/organization/access_rule.rb
|
24
26
|
- lib/cloudflare_client/organization/invite.rb
|
@@ -33,6 +35,7 @@ files:
|
|
33
35
|
- lib/cloudflare_client/zone/analytics.rb
|
34
36
|
- lib/cloudflare_client/zone/base.rb
|
35
37
|
- lib/cloudflare_client/zone/custom_hostname.rb
|
38
|
+
- lib/cloudflare_client/zone/custom_hostname_v2.rb
|
36
39
|
- lib/cloudflare_client/zone/custom_page.rb
|
37
40
|
- lib/cloudflare_client/zone/custom_ssl.rb
|
38
41
|
- lib/cloudflare_client/zone/dns.rb
|
@@ -54,7 +57,7 @@ homepage: https://github.com/zendesk/cloudflare_client_rb
|
|
54
57
|
licenses:
|
55
58
|
- Apache-2.0
|
56
59
|
metadata: {}
|
57
|
-
post_install_message:
|
60
|
+
post_install_message:
|
58
61
|
rdoc_options: []
|
59
62
|
require_paths:
|
60
63
|
- lib
|
@@ -69,9 +72,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
72
|
- !ruby/object:Gem::Version
|
70
73
|
version: '0'
|
71
74
|
requirements: []
|
72
|
-
rubyforge_project:
|
75
|
+
rubyforge_project:
|
73
76
|
rubygems_version: 2.6.11
|
74
|
-
signing_key:
|
77
|
+
signing_key:
|
75
78
|
specification_version: 4
|
76
79
|
summary: lightweight cloudflare api client
|
77
80
|
test_files: []
|