cloudflare 4.1.2 → 4.1.3

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
  SHA256:
3
- metadata.gz: 8cb422d698395ca2c0909d60f756ab939428b1c42807d6b447f83ef10597b12c
4
- data.tar.gz: 2dd664743a06dba67c963b4b8d1d937403a2cb1df74052a268ca02fde52b4f5b
3
+ metadata.gz: 626ea2f798763660de19bc89189844304761b3db0c7db35f7bf8db5910844df6
4
+ data.tar.gz: 206a3f3f19a7b0db41371f63a151b3e626fd2686f02b9f4bd7118d612bc48c06
5
5
  SHA512:
6
- metadata.gz: 29088d9573a60166b3ca8ac37dd68d80d4e73bf3f522f6f2b704da059088ea84e370d6a7cb063ae393c23dd0ce25f5f4401653b32be07862cb8634fdbaea19db
7
- data.tar.gz: c60e436e2ae972df5f81a3123d1bef4289cb51023fd7fab90acb0278739db924a9b0b778950bb8c24c8c30ebaa50fbea4d21037ceaff70478219e36e38a71352
6
+ metadata.gz: 67914afda228ba0a5a1d3ce5e51ef38e7c7ccf38a69015d8b82408f620f48a32874ba008f5172915300826c2c461c115d029bf8ac8862547c486952d623f918e
7
+ data.tar.gz: 8ec079ac0dd5de6bfa9d74db9a0ff987579bb37b2a93b52ef2ba3265dfa543b1898c1b898045065ab561645082f360f6d5471d38f81707d51f8c465f5cde3370
@@ -2,6 +2,11 @@ language: ruby
2
2
  dist: xenial
3
3
  cache: bundler
4
4
 
5
+ addons:
6
+ apt:
7
+ packages:
8
+ - squid
9
+
5
10
  matrix:
6
11
  include:
7
12
  - rvm: 2.4
@@ -13,6 +18,9 @@ matrix:
13
18
  env: JRUBY_OPTS="--debug -X+O"
14
19
  - rvm: truffleruby
15
20
  - rvm: ruby-head
21
+ - rvm: 2.6
22
+ env: CLOUDFLARE_PROXY=http://localhost:3128
23
+ before_script: sudo service squid start
16
24
  allow_failures:
17
25
  - rvm: ruby-head
18
26
  - rvm: jruby-head
data/Gemfile CHANGED
@@ -5,6 +5,8 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in cloudflare.gemspec
6
6
  gemspec
7
7
 
8
+ gem 'async-http', '~> 0.48', '>= 0.48.2'
9
+
8
10
  group :development do
9
11
  gem 'pry'
10
12
  gem 'pry-coolline'
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.required_ruby_version = '>= 2.0.0'
23
23
 
24
- spec.add_dependency 'async-rest', '~> 0.9.0'
24
+ spec.add_dependency 'async-rest', '~> 0.10.0'
25
25
 
26
26
  spec.add_development_dependency 'async-rspec'
27
27
 
@@ -25,10 +25,10 @@ require 'async'
25
25
  require_relative 'cloudflare/connection'
26
26
 
27
27
  module Cloudflare
28
- DEFAULT_URL = 'https://api.cloudflare.com/client/v4'
28
+ DEFAULT_ENDPOINT = Async::HTTP::Endpoint.parse('https://api.cloudflare.com/client/v4')
29
29
 
30
- def self.connect(key: nil, email: nil)
31
- representation = Connection.for(DEFAULT_URL)
30
+ def self.connect(endpoint = DEFAULT_ENDPOINT, key: nil, email: nil)
31
+ representation = Connection.for(endpoint)
32
32
 
33
33
  if key
34
34
  representation = representation.authenticated(key, email)
@@ -37,7 +37,7 @@ module Cloudflare
37
37
  page += 1
38
38
 
39
39
  # Was this the last page?
40
- break if zones.value.count < per_page
40
+ break if zones.value.size < per_page
41
41
  end
42
42
  end
43
43
 
@@ -21,6 +21,8 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  require 'async/rspec'
24
+ require 'async/http/proxy'
25
+
24
26
  require_relative '../../cloudflare'
25
27
 
26
28
  module Cloudflare
@@ -35,10 +37,20 @@ module Cloudflare
35
37
  let(:email) {ENV['CLOUDFLARE_EMAIL']}
36
38
  let(:key) {ENV['CLOUDFLARE_KEY']}
37
39
 
38
- let(:connection) {@connection = Cloudflare.connect(key: key, email: email)}
40
+ let(:connection) do
41
+ if proxy_url = ENV['CLOUDFLARE_PROXY']
42
+ proxy_endpoint = Async::HTTP::Endpoint.parse(proxy_url)
43
+ @client = Async::HTTP::Client.new(proxy_endpoint)
44
+ @connection = Cloudflare.connect(@client.proxied_endpoint(DEFAULT_ENDPOINT), key: key, email: email)
45
+ else
46
+ @client = nil
47
+ @connection = Cloudflare.connect(key: key, email: email)
48
+ end
49
+ end
39
50
 
40
51
  after do
41
52
  @connection&.close
53
+ @client&.close
42
54
  end
43
55
  end
44
56
  end
@@ -22,5 +22,5 @@
22
22
  # THE SOFTWARE.
23
23
 
24
24
  module Cloudflare
25
- VERSION = '4.1.2'
25
+ VERSION = '4.1.3'
26
26
  end
@@ -72,7 +72,7 @@ RSpec.configure do |config|
72
72
  end
73
73
  account.kv_namespaces.to_a
74
74
  rescue Cloudflare::RequestError => e
75
- if e.message.include?('your account is not permitted')
75
+ if e.message.include?('your account is not entitled')
76
76
  puts 'Disabling KV specs due to no access'
77
77
  disabled_specs[:kv_spec] = true
78
78
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudflare
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.2
4
+ version: 4.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Prokop
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-06-27 00:00:00.000000000 Z
12
+ date: 2019-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: async-rest
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.9.0
20
+ version: 0.10.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.9.0
27
+ version: 0.10.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: async-rspec
30
30
  requirement: !ruby/object:Gem::Requirement