cloudflare_client_rb 4.2.6 → 4.2.7
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.rb +4 -5
- data/lib/cloudflare_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 781fa68d768317105d936c42203e717c9fa760f2
|
4
|
+
data.tar.gz: 4b04969de67f023b90a7054c6638e5f1bd3801f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5adf49cd33d6fc7a8370a7627ffd9f9e9d9d972dd5f5e736c7e9de507b9ff39b6de88adfade73a4f7fd6ab1ab92861676d4d9447bed2d28e953cc23f6c13e59
|
7
|
+
data.tar.gz: c6ff857e320a7708eebdc9b15e7bfa9f0fa261d1ffa51311eed8adb7a2d31220ea15f9199b6e9d2a77472ec1fb01c4fc246aaa4fc301949b23cc3cb48aa9a2bf
|
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)
|
54
|
+
def initialize(auth_key: nil, email: nil, &block)
|
55
55
|
raise('Missing auth_key') if auth_key.nil?
|
56
56
|
raise('missing email') if email.nil?
|
57
|
-
@cf_client ||= build_client(auth_key: auth_key, email: email)
|
57
|
+
@cf_client ||= build_client(auth_key: auth_key, email: email, &block)
|
58
58
|
end
|
59
59
|
|
60
60
|
#TODO: add the time based stuff
|
@@ -131,19 +131,18 @@ class CloudflareClient
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def build_client(params)
|
134
|
-
raise('Missing auth_key') if params[:auth_key].nil?
|
135
|
-
raise('Missing auth email') if params[:email].nil?
|
136
134
|
# we need multipart form encoding for some of these operations
|
137
135
|
client = Faraday.new(url: API_BASE) do |conn|
|
138
136
|
conn.request :multipart
|
139
137
|
conn.request :url_encoded
|
140
138
|
conn.use Middleware::Response::RaiseError
|
141
|
-
conn.adapter :net_http
|
142
139
|
end
|
143
140
|
client.headers['X-Auth-Key'] = params[:auth_key]
|
144
141
|
client.headers['X-Auth-User-Service-Key '] = params[:auth_key] #FIXME, is this always the same?
|
145
142
|
client.headers['X-Auth-Email'] = params[:email]
|
146
143
|
client.headers['Content-Type'] = 'application/json'
|
144
|
+
yield client if block_given?
|
145
|
+
client.adapter :net_http
|
147
146
|
client
|
148
147
|
end
|
149
148
|
|
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.7
|
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: 2019-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: iwaters@zendesk.com
|