cloud_party 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -1
- data/bin/console +0 -0
- data/bin/setup +0 -0
- data/cloud_party.gemspec +3 -3
- data/lib/cloud_party/config.rb +11 -11
- data/lib/cloud_party/nodes/dns_records.rb +17 -3
- data/lib/cloud_party/nodes/ips.rb +1 -1
- data/lib/cloud_party/nodes/zones.rb +1 -1
- data/lib/cloud_party/responses/zones.rb +1 -1
- data/lib/cloud_party/version.rb +1 -1
- metadata +24 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6c4d23b444985e311c3c54ef8139aba19c9a49ee259f16fe9ba049c4144b700
|
4
|
+
data.tar.gz: 3db7e3106773cf502119ddf3e00329bdf44a3869ca6f9424a433500df4d36863
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5d09d1631529ad0efa7806f4d776300b9e08f9d329e67ee6f7eb15ef46cb7dcc9154700aa3b70735fd0b41ea92d12c9ed7955d6a3ce1f9736c67e2748f48a93
|
7
|
+
data.tar.gz: 5fd676715cc4fa2b6576f5deb5f6347678f31aeda41c2c1edd960adb1f328e9cec781a6ea1161a617ce3a48b9db7a2c6763904df185b18ebaf4654f8b4144aee
|
data/Rakefile
CHANGED
data/bin/console
CHANGED
File without changes
|
data/bin/setup
CHANGED
File without changes
|
data/cloud_party.gemspec
CHANGED
@@ -22,15 +22,15 @@ spec = Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.required_ruby_version = '>= 2'
|
24
24
|
|
25
|
-
s.add_development_dependency 'bundler', '~>
|
25
|
+
s.add_development_dependency 'bundler', '~> 2.5.22'
|
26
26
|
s.add_development_dependency 'codeclimate-test-reporter', '~> 0.6.0'
|
27
|
-
s.add_development_dependency 'debase'
|
28
27
|
s.add_development_dependency 'minitest'
|
29
28
|
s.add_development_dependency 'minitest-reporters', '>= 0.5.0'
|
30
29
|
s.add_development_dependency 'pry', '~> 0.11.3'
|
31
30
|
s.add_development_dependency 'rake', '~> 12.3', '>= 12.3.1'
|
32
|
-
s.add_development_dependency 'ruby-debug-ide', '~> 0.7.0.beta7'
|
33
31
|
s.add_development_dependency 'webmock', '~> 2.1'
|
32
|
+
s.add_development_dependency 'rspec-core', '~> 3.13.0'
|
33
|
+
s.add_development_dependency 'rspec', '~> 3.13.0'
|
34
34
|
|
35
35
|
s.add_runtime_dependency 'app_configuration'
|
36
36
|
s.add_runtime_dependency 'httparty', '~> 0.16.2'
|
data/lib/cloud_party/config.rb
CHANGED
@@ -8,32 +8,32 @@ module CloudParty
|
|
8
8
|
base_local_path Pathname.new(Dir.home).join('.cloud_party/')
|
9
9
|
base_global_path Pathname.new(Etc.sysconfdir).join('cloud_party')
|
10
10
|
use_env_variables true
|
11
|
-
prefix '
|
11
|
+
prefix 'CLOUD_PARTY'
|
12
12
|
end
|
13
13
|
cfcli_config = AppConfiguration.new('config') do
|
14
14
|
base_local_path Pathname.new(Dir.home).join('.cfcli/')
|
15
15
|
base_global_path Pathname.new(Etc.sysconfdir).join('cloudflare_cli')
|
16
16
|
use_env_variables true
|
17
|
-
prefix '
|
17
|
+
prefix 'CFCLI'
|
18
18
|
end
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
@@email = cp_config.email || cfcli_config.email
|
20
|
+
@@api_key = cp_config.api_key || cfcli_config.api_key
|
21
|
+
@@token = cp_config.token || cfcli_config.token
|
22
22
|
end
|
23
23
|
|
24
24
|
# @return [String] the email string
|
25
|
-
def email
|
26
|
-
|
25
|
+
def self.email
|
26
|
+
@@email
|
27
27
|
end
|
28
28
|
|
29
29
|
# @return [String] the api key string
|
30
|
-
def api_key
|
31
|
-
|
30
|
+
def self.api_key
|
31
|
+
@@api_key
|
32
32
|
end
|
33
33
|
|
34
34
|
# @return [String] the cloudflare api token
|
35
|
-
def token
|
36
|
-
|
35
|
+
def self.token
|
36
|
+
@@token
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -45,14 +45,28 @@ module CloudParty
|
|
45
45
|
@options = options
|
46
46
|
end
|
47
47
|
|
48
|
-
def list
|
49
|
-
|
48
|
+
def list(zone)
|
49
|
+
zone_id = self.id_by_name(zone)
|
50
|
+
CloudParty::Responses::DNSRecords.new(:get, '/zones/:id/dns_records', self.class.get("/zones/#{zone_id}/dns_records", @options), @options)
|
50
51
|
end
|
51
52
|
|
52
53
|
def get(id)
|
53
|
-
CloudParty::Responses::DNSRecords.new(:get, '/zones/:id/dns_records', self.class.get("/zones/#{
|
54
|
+
CloudParty::Responses::DNSRecords.new(:get, '/zones/:id/dns_records', self.class.get("/zones/#{zone_id}/dns_records", @options), @options)
|
54
55
|
end
|
55
56
|
|
57
|
+
|
58
|
+
# Add a new DNS record to the specified zone
|
59
|
+
#
|
60
|
+
# @param type [String] DNS record type
|
61
|
+
# @param name [String] DNS record name
|
62
|
+
# @param content [String] DNS record content
|
63
|
+
# @param opts [Hash] Additional options
|
64
|
+
# @option opts [Integer] :ttl Time to live
|
65
|
+
# @option opts [Integer] :priority Priority
|
66
|
+
# @option opts [Boolean] :proxied Whether the record is proxied
|
67
|
+
# @param zone [String] Zone to add DNS record to
|
68
|
+
#
|
69
|
+
# @return [CloudParty::Responses::DNSRecords] DNS records response object
|
56
70
|
def add(type, name, content, opts, zone:)
|
57
71
|
zone_id = nil
|
58
72
|
options = {
|
@@ -8,7 +8,7 @@ module CloudParty
|
|
8
8
|
include CloudParty::Context
|
9
9
|
include HTTParty
|
10
10
|
base_uri 'https://api.cloudflare.com/client/v4'
|
11
|
-
headers 'Authorization' => "Bearer #{CloudParty::Config.token}",
|
11
|
+
headers 'Authorization' => "Bearer #{CloudParty::Config.new.token}",
|
12
12
|
'Content-Type' => 'application/json',
|
13
13
|
'User-Agent' => "CloudParty/#{CloudParty::VERSION}"
|
14
14
|
|
@@ -8,7 +8,7 @@ module CloudParty
|
|
8
8
|
include CloudParty::Context
|
9
9
|
include HTTParty
|
10
10
|
base_uri 'https://api.cloudflare.com/client/v4'
|
11
|
-
headers 'Authorization' => "Bearer #{CloudParty::Config.token}",
|
11
|
+
headers 'Authorization' => "Bearer #{CloudParty::Config.new.token}",
|
12
12
|
'Content-Type' => 'application/json',
|
13
13
|
'User-Agent' => "CloudParty/#{CloudParty::VERSION}"
|
14
14
|
|
@@ -20,7 +20,7 @@ module CloudParty
|
|
20
20
|
unless successful?
|
21
21
|
message = <<~MESSAGE
|
22
22
|
Unable to #{method_name.to_s.upcase} to endpoint:
|
23
|
-
#{endpoint}. Inspect CloudParty::APIError#response
|
23
|
+
#{endpoint}. Inspect/Rescue CloudParty::Errors::APIError#response
|
24
24
|
for further details
|
25
25
|
MESSAGE
|
26
26
|
raise CloudParty::Errors::APIError.new(message, response)
|
data/lib/cloud_party/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloud_party
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ken Spencer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
11
|
+
date: 2024-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.5.22
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.5.22
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: codeclimate-test-reporter
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.6.0
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: debase
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: minitest
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,33 +101,47 @@ dependencies:
|
|
115
101
|
- !ruby/object:Gem::Version
|
116
102
|
version: 12.3.1
|
117
103
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
104
|
+
name: webmock
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '2.1'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '2.1'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rspec-core
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
123
|
+
version: 3.13.0
|
124
124
|
type: :development
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
130
|
+
version: 3.13.0
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
132
|
+
name: rspec
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version:
|
137
|
+
version: 3.13.0
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
144
|
+
version: 3.13.0
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: app_configuration
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|