cloudflare_client_rb 4.2.7 → 4.2.10

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: 781fa68d768317105d936c42203e717c9fa760f2
4
- data.tar.gz: 4b04969de67f023b90a7054c6638e5f1bd3801f7
3
+ metadata.gz: 125802fef0c3221bb92cde156cafd90ded68d591
4
+ data.tar.gz: 627757654b8419bab16194820c5bbc5e4b8d7ba9
5
5
  SHA512:
6
- metadata.gz: a5adf49cd33d6fc7a8370a7627ffd9f9e9d9d972dd5f5e736c7e9de507b9ff39b6de88adfade73a4f7fd6ab1ab92861676d4d9447bed2d28e953cc23f6c13e59
7
- data.tar.gz: c6ff857e320a7708eebdc9b15e7bfa9f0fa261d1ffa51311eed8adb7a2d31220ea15f9199b6e9d2a77472ec1fb01c4fc246aaa4fc301949b23cc3cb48aa9a2bf
6
+ metadata.gz: 60eeece7b3ecd4d5b975415017aac7035c587422bae15fd1cef05a2e217885737dec81645bd221c3c0c4bdeb26f66c0b49798f7ac8a5f4a29a6e1e71800b2178
7
+ data.tar.gz: 1578ee65e475099591342d754ff59f1abb7ea2bb00b56c96b2383fc28aaf3a51fa6957644933e2b770d8f3836ba0b414976a9309a1a07af91adc4c8ed46fb15d
@@ -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
- client.headers['X-Auth-Key'] = params[:auth_key]
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
@@ -1,3 +1,3 @@
1
1
  class CloudflareClient
2
- VERSION = "4.2.7"
2
+ VERSION = "4.2.10"
3
3
  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.7
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: 2019-07-16 00:00:00.000000000 Z
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 License Version 2.0
55
+ - Apache-2.0
56
56
  metadata: {}
57
57
  post_install_message:
58
58
  rdoc_options: []