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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ffd5b226840f8386cc5a9175ddf3bc28f9ea922
4
- data.tar.gz: d99d3ce407b1c6c29f25faf9a7c8feced241946a
3
+ metadata.gz: 781fa68d768317105d936c42203e717c9fa760f2
4
+ data.tar.gz: 4b04969de67f023b90a7054c6638e5f1bd3801f7
5
5
  SHA512:
6
- metadata.gz: d445e426b1a43213715d37eefa523a9f0cfb3ec3d879b29d113edb0ee7f8de09d9d63ebb3e4a230352ead28d1cb708e08475ad3d0a04a038066bfe7efd4c529c
7
- data.tar.gz: 3a231764876cb57935050e191c8678209a9b77711cb5c0084b197a9d90217f01cad2c190e06ba959e8d7741637fbe5571ab944be6c9ab58978ec3a8c0db309e1
6
+ metadata.gz: a5adf49cd33d6fc7a8370a7627ffd9f9e9d9d972dd5f5e736c7e9de507b9ff39b6de88adfade73a4f7fd6ab1ab92861676d4d9447bed2d28e953cc23f6c13e59
7
+ data.tar.gz: c6ff857e320a7708eebdc9b15e7bfa9f0fa261d1ffa51311eed8adb7a2d31220ea15f9199b6e9d2a77472ec1fb01c4fc246aaa4fc301949b23cc3cb48aa9a2bf
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  class CloudflareClient
2
- VERSION = "4.2.6"
2
+ VERSION = "4.2.7"
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.6
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: 2018-06-27 00:00:00.000000000 Z
11
+ date: 2019-07-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: iwaters@zendesk.com