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 +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +0 -1
- data/cloudflare.gemspec +1 -1
- data/lib/cloudflare/accounts.rb +1 -1
- data/lib/cloudflare/connection.rb +4 -4
- data/lib/cloudflare/dns.rb +7 -2
- data/lib/cloudflare/kv/namespaces.rb +2 -2
- data/lib/cloudflare/version.rb +1 -1
- data/lib/cloudflare/zones.rb +5 -5
- data/spec/cloudflare/custom_hostnames_spec.rb +1 -1
- data/spec/cloudflare/dns_spec.rb +24 -6
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cb422d698395ca2c0909d60f756ab939428b1c42807d6b447f83ef10597b12c
|
4
|
+
data.tar.gz: 2dd664743a06dba67c963b4b8d1d937403a2cb1df74052a268ca02fde52b4f5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29088d9573a60166b3ca8ac37dd68d80d4e73bf3f522f6f2b704da059088ea84e370d6a7cb063ae393c23dd0ce25f5f4401653b32be07862cb8634fdbaea19db
|
7
|
+
data.tar.gz: c60e436e2ae972df5f81a3123d1bef4289cb51023fd7fab90acb0278739db924a9b0b778950bb8c24c8c30ebaa50fbea4d21037ceaff70478219e36e38a71352
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/cloudflare.gemspec
CHANGED
data/lib/cloudflare/accounts.rb
CHANGED
@@ -38,19 +38,19 @@ module Cloudflare
|
|
38
38
|
headers['X-Auth-Email'] = email
|
39
39
|
end
|
40
40
|
|
41
|
-
self.
|
41
|
+
self.with(headers: headers)
|
42
42
|
end
|
43
43
|
|
44
44
|
def zones
|
45
|
-
|
45
|
+
self.with(Zones, path: 'zones')
|
46
46
|
end
|
47
47
|
|
48
48
|
def accounts
|
49
|
-
|
49
|
+
self.with(Accounts, path: 'accounts')
|
50
50
|
end
|
51
51
|
|
52
52
|
def user
|
53
|
-
|
53
|
+
self.with(User, path: 'user')
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
data/lib/cloudflare/dns.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
58
|
+
self.with(Representation, path: "values/#{name}")
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
data/lib/cloudflare/version.rb
CHANGED
data/lib/cloudflare/zones.rb
CHANGED
@@ -33,19 +33,19 @@ require_relative 'logs'
|
|
33
33
|
module Cloudflare
|
34
34
|
class Zone < Representation
|
35
35
|
def custom_hostnames
|
36
|
-
|
36
|
+
self.with(CustomHostnames, path: 'custom_hostnames')
|
37
37
|
end
|
38
38
|
|
39
39
|
def dns_records
|
40
|
-
DNS::Records
|
40
|
+
self.with(DNS::Records, path: 'dns_records')
|
41
41
|
end
|
42
42
|
|
43
43
|
def firewall_rules
|
44
|
-
Firewall::Rules
|
44
|
+
self.with(Firewall::Rules, path: 'firewall/access_rules/rules')
|
45
45
|
end
|
46
46
|
|
47
47
|
def logs
|
48
|
-
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
|
-
|
56
|
+
self.with(Zone, path: 'purge_cache').post(parameters)
|
57
57
|
|
58
58
|
return self
|
59
59
|
end
|
data/spec/cloudflare/dns_spec.rb
CHANGED
@@ -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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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.
|
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-
|
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.
|
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.
|
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.
|
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.
|