cloudflare 4.1.1 → 4.1.2

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: 79a8768ecb786ce6c1c3af592c2adbc33156f2cd9148273ce3774e3d5ed74392
4
- data.tar.gz: 19c2bb97be2cb08fb36b538501d816ad968af53a7552564fc9f1a669baddab9a
3
+ metadata.gz: 8cb422d698395ca2c0909d60f756ab939428b1c42807d6b447f83ef10597b12c
4
+ data.tar.gz: 2dd664743a06dba67c963b4b8d1d937403a2cb1df74052a268ca02fde52b4f5b
5
5
  SHA512:
6
- metadata.gz: d2f3272dd96f2c821877ca85dc38e4d692e95bcfe1c54a6141dd72bce16aa6225a06fabf371496724bdda4136271c0c6c3ef5a313713a50189b75ffa6666cbd2
7
- data.tar.gz: 290ebb0294ec423404726303811a44c9c98dcc727716bdf29a2868b0c2938a771a4c6f15a3ed36ef96df54ed3d71c0374f3d87f2694ebc35a6c1cf2a20ad7031
6
+ metadata.gz: 29088d9573a60166b3ca8ac37dd68d80d4e73bf3f522f6f2b704da059088ea84e370d6a7cb063ae393c23dd0ce25f5f4401653b32be07862cb8634fdbaea19db
7
+ data.tar.gz: c60e436e2ae972df5f81a3123d1bef4289cb51023fd7fab90acb0278739db924a9b0b778950bb8c24c8c30ebaa50fbea4d21037ceaff70478219e36e38a71352
data/.gitignore CHANGED
@@ -10,3 +10,5 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ .covered.db
14
+ .env
@@ -4,7 +4,6 @@ cache: bundler
4
4
 
5
5
  matrix:
6
6
  include:
7
- - rvm: 2.3
8
7
  - rvm: 2.4
9
8
  - rvm: 2.5
10
9
  - rvm: 2.6
@@ -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.8.0'
24
+ spec.add_dependency 'async-rest', '~> 0.9.0'
25
25
 
26
26
  spec.add_development_dependency 'async-rspec'
27
27
 
@@ -33,7 +33,7 @@ module Cloudflare
33
33
  end
34
34
 
35
35
  def kv_namespaces
36
- KV::Namespaces.new(@resource.with(path: 'storage/kv/namespaces'))
36
+ self.with(KV::Namespaces, path: 'storage/kv/namespaces')
37
37
  end
38
38
  end
39
39
 
@@ -38,19 +38,19 @@ module Cloudflare
38
38
  headers['X-Auth-Email'] = email
39
39
  end
40
40
 
41
- self.class.new(@resource.with(headers: headers))
41
+ self.with(headers: headers)
42
42
  end
43
43
 
44
44
  def zones
45
- Zones.new(@resource.with(path: 'zones'))
45
+ self.with(Zones, path: 'zones')
46
46
  end
47
47
 
48
48
  def accounts
49
- Accounts.new(@resource.with(path: 'accounts'))
49
+ self.with(Accounts, path: 'accounts')
50
50
  end
51
51
 
52
52
  def user
53
- User.new(@resource.with(path: 'user'))
53
+ self.with(User, path: 'user')
54
54
  end
55
55
  end
56
56
  end
@@ -34,11 +34,12 @@ module Cloudflare
34
34
  @record = record || get.result
35
35
  end
36
36
 
37
- def update_content(content)
37
+ def update_content(content, **options)
38
38
  response = put(
39
39
  type: @record[:type],
40
40
  name: @record[:name],
41
- content: content
41
+ content: content,
42
+ **options
42
43
  )
43
44
 
44
45
  @value = response.result
@@ -56,6 +57,10 @@ module Cloudflare
56
57
  value[:content]
57
58
  end
58
59
 
60
+ def proxied
61
+ value[:proxied]
62
+ end
63
+
59
64
  def to_s
60
65
  "#{@record[:name]} #{@record[:type]} #{@record[:content]}"
61
66
  end
@@ -32,7 +32,7 @@ module Cloudflare
32
32
  end
33
33
 
34
34
  def keys
35
- Keys.new(@resource.with(path: 'keys'))
35
+ self.with(Keys, path: 'keys')
36
36
  end
37
37
 
38
38
  def read_value(name)
@@ -55,7 +55,7 @@ module Cloudflare
55
55
  private
56
56
 
57
57
  def value_representation(name)
58
- Representation.new(@resource.with(path: "values/#{name}"))
58
+ self.with(Representation, path: "values/#{name}")
59
59
  end
60
60
  end
61
61
 
@@ -22,5 +22,5 @@
22
22
  # THE SOFTWARE.
23
23
 
24
24
  module Cloudflare
25
- VERSION = '4.1.1'
25
+ VERSION = '4.1.2'
26
26
  end
@@ -33,19 +33,19 @@ require_relative 'logs'
33
33
  module Cloudflare
34
34
  class Zone < Representation
35
35
  def custom_hostnames
36
- CustomHostnames.new(@resource.with(path: 'custom_hostnames'))
36
+ self.with(CustomHostnames, path: 'custom_hostnames')
37
37
  end
38
38
 
39
39
  def dns_records
40
- DNS::Records.new(@resource.with(path: 'dns_records'))
40
+ self.with(DNS::Records, path: 'dns_records')
41
41
  end
42
42
 
43
43
  def firewall_rules
44
- Firewall::Rules.new(@resource.with(path: 'firewall/access_rules/rules'))
44
+ self.with(Firewall::Rules, path: 'firewall/access_rules/rules')
45
45
  end
46
46
 
47
47
  def logs
48
- Logs::Received.new(@resource.with(path: 'logs/received'))
48
+ self.with(Logs::Received, path: 'logs/received')
49
49
  end
50
50
 
51
51
  DEFAULT_PURGE_CACHE_PARAMS = {
@@ -53,7 +53,7 @@ module Cloudflare
53
53
  }.freeze
54
54
 
55
55
  def purge_cache(parameters = DEFAULT_PURGE_CACHE_PARAMS)
56
- Zone.new(@resource.with(path: 'purge_cache')).post(parameters)
56
+ self.with(Zone, path: 'purge_cache').post(parameters)
57
57
 
58
58
  return self
59
59
  end
@@ -1,5 +1,5 @@
1
1
 
2
- RSpec.describe Cloudflare::CustomHostnames, order: :defined, timeout: 30 do
2
+ RSpec.xdescribe Cloudflare::CustomHostnames, order: :defined, timeout: 30 do
3
3
  include_context Cloudflare::Zone
4
4
 
5
5
  let(:domain) { "www#{ENV['TRAVIS_JOB_ID'] || rand(1..5)}.ourtest.com" }
@@ -6,21 +6,31 @@ RSpec.describe Cloudflare::DNS, order: :defined, timeout: 30 do
6
6
 
7
7
  let(:subdomain) {"www#{ENV['TRAVIS_JOB_ID']}"}
8
8
 
9
- let(:record) {@record = zone.dns_records.create("A", subdomain, "1.2.3.4")}
10
-
11
9
  after do
12
10
  if defined? @record
13
11
  expect(@record.delete).to be_success
14
12
  end
15
13
  end
16
14
 
17
- it "can create dns record" do
18
- expect(record.type).to be == "A"
19
- expect(record.name).to be_start_with subdomain
20
- expect(record.content).to be == "1.2.3.4"
15
+ context "new record" do
16
+ it "can create dns record" do
17
+ @record = zone.dns_records.create("A", subdomain, "1.2.3.4")
18
+ expect(@record.type).to be == "A"
19
+ expect(@record.name).to be_start_with subdomain
20
+ expect(@record.content).to be == "1.2.3.4"
21
+ end
22
+
23
+ it "can create dns record with proxied option" do
24
+ @record = zone.dns_records.create("A", subdomain, "1.2.3.4", proxied: true)
25
+ expect(@record.type).to be == "A"
26
+ expect(@record.name).to be_start_with subdomain
27
+ expect(@record.content).to be == "1.2.3.4"
28
+ expect(@record.proxied).to be_truthy
29
+ end
21
30
  end
22
31
 
23
32
  context "with existing record" do
33
+ let(:record) {@record = zone.dns_records.create("A", subdomain, "1.2.3.4")}
24
34
  it "can update dns content" do
25
35
  record.update_content("4.3.2.1")
26
36
  expect(record.content).to be == "4.3.2.1"
@@ -28,5 +38,13 @@ RSpec.describe Cloudflare::DNS, order: :defined, timeout: 30 do
28
38
  fetched_record = zone.dns_records.find_by_name(record.name)
29
39
  expect(fetched_record.content).to be == record.content
30
40
  end
41
+
42
+ it "can update dns content with proxied option" do
43
+ record.update_content("4.3.2.1", proxied: true)
44
+ expect(record.proxied).to be_truthy
45
+
46
+ fetched_record = zone.dns_records.find_by_name(record.name)
47
+ expect(fetched_record.proxied).to be_truthy
48
+ end
31
49
  end
32
50
  end
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.1
4
+ version: 4.1.2
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-21 00:00:00.000000000 Z
12
+ date: 2019-06-27 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.8.0
20
+ version: 0.9.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.8.0
27
+ version: 0.9.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: async-rspec
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.0.2
157
+ rubygems_version: 3.0.3
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: A Ruby wrapper for the Cloudflare API.