cloudflare_client_rb 4.2.7 → 4.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cloudflare_client.rb +14 -8
- data/lib/cloudflare_client/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 125802fef0c3221bb92cde156cafd90ded68d591
|
4
|
+
data.tar.gz: 627757654b8419bab16194820c5bbc5e4b8d7ba9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60eeece7b3ecd4d5b975415017aac7035c587422bae15fd1cef05a2e217885737dec81645bd221c3c0c4bdeb26f66c0b49798f7ac8a5f4a29a6e1e71800b2178
|
7
|
+
data.tar.gz: 1578ee65e475099591342d754ff59f1abb7ea2bb00b56c96b2383fc28aaf3a51fa6957644933e2b770d8f3836ba0b414976a9309a1a07af91adc4c8ed46fb15d
|
data/lib/cloudflare_client.rb
CHANGED
@@ -51,10 +51,10 @@ class CloudflareClient
|
|
51
51
|
websockets
|
52
52
|
].freeze
|
53
53
|
|
54
|
-
def initialize(auth_key: nil, email: nil, &block)
|
55
|
-
raise('Missing auth_key') if auth_key.nil?
|
56
|
-
raise('missing email') if email.nil?
|
57
|
-
@cf_client ||= build_client(auth_key: auth_key, email: email, &block)
|
54
|
+
def initialize(auth_key: nil, email: nil, auth_token: nil, &block)
|
55
|
+
raise('Missing auth_key or auth_token') if auth_key.nil? && auth_token.nil?
|
56
|
+
raise('missing email') if email.nil? && !auth_key.nil?
|
57
|
+
@cf_client ||= build_client(auth_key: auth_key, email: email, auth_token: auth_token, &block)
|
58
58
|
end
|
59
59
|
|
60
60
|
#TODO: add the time based stuff
|
@@ -137,10 +137,16 @@ class CloudflareClient
|
|
137
137
|
conn.request :url_encoded
|
138
138
|
conn.use Middleware::Response::RaiseError
|
139
139
|
end
|
140
|
-
|
141
|
-
client.headers['X-Auth-User-Service-Key '] = params[:auth_key] #FIXME, is this always the same?
|
142
|
-
client.headers['X-Auth-Email'] = params[:email]
|
140
|
+
|
143
141
|
client.headers['Content-Type'] = 'application/json'
|
142
|
+
if params[:auth_token]
|
143
|
+
client.headers['Authorization'] = "Bearer #{params[:auth_token]}"
|
144
|
+
else
|
145
|
+
client.headers['X-Auth-Key'] = params[:auth_key]
|
146
|
+
client.headers['X-Auth-User-Service-Key '] = params[:auth_key] #FIXME, is this always the same?
|
147
|
+
client.headers['X-Auth-Email'] = params[:email]
|
148
|
+
end
|
149
|
+
|
144
150
|
yield client if block_given?
|
145
151
|
client.adapter :net_http
|
146
152
|
client
|
@@ -203,4 +209,4 @@ class CloudflareClient
|
|
203
209
|
return false unless POSSIBLE_API_SETTINGS.include?(name)
|
204
210
|
true
|
205
211
|
end
|
206
|
-
end
|
212
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudflare_client_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ian waters
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: iwaters@zendesk.com
|
@@ -52,7 +52,7 @@ files:
|
|
52
52
|
- lib/cloudflare_client/zone/subscription.rb
|
53
53
|
homepage: https://github.com/zendesk/cloudflare_client_rb
|
54
54
|
licenses:
|
55
|
-
- Apache
|
55
|
+
- Apache-2.0
|
56
56
|
metadata: {}
|
57
57
|
post_install_message:
|
58
58
|
rdoc_options: []
|