fog-dnsimple 2.1.0 → 3.0.0
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/CHANGELOG.md +11 -6
- data/Gemfile +9 -2
- data/LICENSE.txt +1 -1
- data/README.md +25 -26
- data/lib/fog/bin/dnsimple.rb +42 -21
- data/lib/fog/dnsimple/dns.rb +47 -40
- data/lib/fog/dnsimple/models/dns/record.rb +5 -5
- data/lib/fog/dnsimple/models/dns/records.rb +5 -5
- data/lib/fog/dnsimple/models/dns/zone.rb +3 -3
- data/lib/fog/dnsimple/models/dns/zones.rb +3 -3
- data/lib/fog/dnsimple/requests/dns/create_domain.rb +3 -12
- data/lib/fog/dnsimple/requests/dns/create_record.rb +4 -14
- data/lib/fog/dnsimple/requests/dns/delete_domain.rb +3 -8
- data/lib/fog/dnsimple/requests/dns/delete_record.rb +3 -7
- data/lib/fog/dnsimple/requests/dns/get_domain.rb +3 -7
- data/lib/fog/dnsimple/requests/dns/get_record.rb +3 -7
- data/lib/fog/dnsimple/requests/dns/list_all_domains.rb +2 -2
- data/lib/fog/dnsimple/requests/dns/list_all_records.rb +2 -2
- data/lib/fog/dnsimple/requests/dns/list_domains.rb +3 -8
- data/lib/fog/dnsimple/requests/dns/list_records.rb +3 -8
- data/lib/fog/dnsimple/requests/dns/update_record.rb +3 -10
- data/lib/fog/dnsimple/version.rb +1 -1
- data/lib/fog/dnsimple.rb +2 -0
- metadata +24 -92
- data/.gitignore +0 -9
- data/.ruby-gemset +0 -1
- data/.travis.yml +0 -22
- data/Rakefile +0 -13
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/fog-dnsimple.gemspec +0 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 823036363818ab3ec842ea8ccefa3e07af9491587275c388897a00393fa3d4af
|
|
4
|
+
data.tar.gz: 9feb86908b986414ac18650a56435eae0cc6327824494eac901b523a0f59886c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1fec9f2a935a5ceb6867c0ecffb49be3fedd46704ee0864b30ba0d96f9589eb04e35a9603c30008e8310aacd186f31a3bfa3cd813bdcac891a1d8bf83981e851
|
|
7
|
+
data.tar.gz: 44f31c656c473ae7ad26fcb62dcb0850a5c69a42f4ce3f4323d966150a696d7b47af2d5e1191429c92a9b20429fa429ffbb539bd3d8ab3c2abeb10b51da6381d
|
data/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
#### Release 3.0.0
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
- FIXED: Record requests use the zone name instead of the zone ID (#7, #11)
|
|
6
|
+
- CHANGED: Minimum Ruby version is now 3.2 (#9)
|
|
7
|
+
- CHANGED: Moved CI from Travis to GitHub Actions (#9)
|
|
8
|
+
- CHANGED: Minimum fog-core version is now 2.5 (#10)
|
|
9
|
+
- CHANGED: The service class is now `Fog::Dnsimple::DNS`. `Fog::DNS::Dnsimple` remains as an alias (#10)
|
|
10
|
+
- CHANGED: Requests use the dnsimple-ruby client instead of a custom HTTP connection (#11)
|
|
11
|
+
- CHANGED: Removed `Real#reload` and the public `Real#request`. From `connection_options`, only the proxy is used (#11)
|
|
5
12
|
|
|
6
|
-
|
|
13
|
+
#### Release 2.1.0
|
|
7
14
|
|
|
15
|
+
- NEW: Added ability to fetch all (non-paginated) domains and records (#4, #6)
|
|
8
16
|
- FIXED: Added missing "minimum Ruby version" in Gemspec
|
|
9
|
-
|
|
10
|
-
- CHANGED: Replaced Shindo with Minitest (GH-5)
|
|
11
|
-
|
|
17
|
+
- CHANGED: Replaced Shindo with Minitest (#5)
|
|
12
18
|
|
|
13
19
|
#### Release 2.0.0
|
|
14
20
|
|
|
@@ -20,7 +26,6 @@ In order to use API v2 you need an API v2 Oauth token, and the accound ID. The a
|
|
|
20
26
|
https://dnsimple.com/a/1234/domains/example.com
|
|
21
27
|
-> 1234
|
|
22
28
|
|
|
23
|
-
|
|
24
29
|
#### Release 1.0.0
|
|
25
30
|
|
|
26
31
|
Initial version, extracted from `fog`.
|
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2009-2016 https://github.com/fog/fog/blob/master/CONTRIBUTORS.md
|
|
4
|
-
Copyright (c) 2016-
|
|
4
|
+
Copyright (c) 2016-2026 DNSimple Corporation
|
|
5
5
|
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
|
@@ -1,51 +1,45 @@
|
|
|
1
1
|
# Fog::Dnsimple
|
|
2
2
|
|
|
3
|
-
[
|
|
9
|
-
and it is compatible with the legacy implementation bundled with the `fog` gem.
|
|
3
|
+
[](https://github.com/fog/fog-dnsimple/actions/workflows/ci.yml)
|
|
10
4
|
|
|
5
|
+
This library is the [DNSimple](https://dnsimple.com/) provider for [fog](https://github.com/fog/fog). It uses the [DNSimple API](https://developer.dnsimple.com/) through the [dnsimple-ruby](https://github.com/dnsimple/dnsimple-ruby) client.
|
|
11
6
|
|
|
12
7
|
## Installation
|
|
13
8
|
|
|
14
9
|
Add this line to your application's Gemfile:
|
|
15
10
|
|
|
16
11
|
```ruby
|
|
17
|
-
gem
|
|
12
|
+
gem "fog-dnsimple"
|
|
18
13
|
```
|
|
19
14
|
|
|
20
15
|
And then execute:
|
|
21
16
|
|
|
22
|
-
```
|
|
23
|
-
bundle
|
|
17
|
+
```bash
|
|
18
|
+
bundle install
|
|
24
19
|
```
|
|
25
20
|
|
|
26
21
|
Or install it yourself as:
|
|
27
22
|
|
|
28
|
-
```
|
|
23
|
+
```bash
|
|
29
24
|
gem install fog-dnsimple
|
|
30
25
|
```
|
|
31
26
|
|
|
32
|
-
|
|
33
27
|
## Usage
|
|
34
28
|
|
|
35
29
|
Initialize a `Fog::DNS` object using the DNSimple provider.
|
|
36
30
|
|
|
37
31
|
```ruby
|
|
38
|
-
dns = Fog::DNS.new(
|
|
32
|
+
dns = Fog::DNS.new(
|
|
39
33
|
provider: "DNSimple",
|
|
40
34
|
dnsimple_token: "YOUR_API_TOKEN",
|
|
41
35
|
dnsimple_account: "YOUR_ACCOUNT_ID",
|
|
42
|
-
|
|
36
|
+
)
|
|
43
37
|
```
|
|
44
38
|
|
|
45
|
-
- `YOUR_API_TOKEN`:
|
|
46
|
-
- `YOUR_ACCOUNT_ID`:
|
|
39
|
+
- `YOUR_API_TOKEN`: the API access token. You can create it from your account page: Account > Access Tokens > Account access tokens.
|
|
40
|
+
- `YOUR_ACCOUNT_ID`: the numeric account ID. It is the number after `/a` in the account URL. For instance, if the account page is `https://dnsimple.com/a/1234/domains`, the account ID is `1234`.
|
|
47
41
|
|
|
48
|
-
|
|
42
|
+
You can then use it like other fog DNS providers.
|
|
49
43
|
|
|
50
44
|
```ruby
|
|
51
45
|
zone = dns.zones.create(
|
|
@@ -58,19 +52,24 @@ record = zone.records.create(
|
|
|
58
52
|
)
|
|
59
53
|
```
|
|
60
54
|
|
|
61
|
-
The following
|
|
55
|
+
The following options are also supported:
|
|
62
56
|
|
|
63
57
|
```ruby
|
|
64
|
-
dns = Fog::DNS.new(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
58
|
+
dns = Fog::DNS.new(
|
|
59
|
+
provider: "DNSimple",
|
|
60
|
+
dnsimple_token: "YOUR_API_TOKEN",
|
|
61
|
+
dnsimple_account: "YOUR_ACCOUNT_ID",
|
|
62
|
+
# A different base URL, for example the Sandbox URL
|
|
63
|
+
dnsimple_url: "https://api.sandbox.dnsimple.com",
|
|
64
|
+
# An HTTP proxy
|
|
65
|
+
connection_options: { proxy: "http://proxy.example.com:8080" },
|
|
66
|
+
)
|
|
68
67
|
```
|
|
69
68
|
|
|
70
69
|
## Contributing
|
|
71
70
|
|
|
72
|
-
1. Fork it (
|
|
73
|
-
2. Create your feature branch (`git
|
|
74
|
-
3. Commit your changes (`git commit -am
|
|
71
|
+
1. Fork it (https://github.com/fog/fog-dnsimple/fork)
|
|
72
|
+
2. Create your feature branch (`git switch -c my-new-feature`)
|
|
73
|
+
3. Commit your changes (`git commit -am "Add some feature"`)
|
|
75
74
|
4. Push to the branch (`git push origin my-new-feature`)
|
|
76
|
-
5. Create new Pull Request
|
|
75
|
+
5. Create a new Pull Request
|
data/lib/fog/bin/dnsimple.rb
CHANGED
|
@@ -1,28 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
module Fog
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class Bin < Fog::Bin
|
|
4
|
+
class << self
|
|
5
|
+
def class_for(key)
|
|
6
|
+
case key
|
|
7
|
+
when :dns
|
|
8
|
+
Fog::Dnsimple::DNS
|
|
9
|
+
else
|
|
10
|
+
raise ArgumentError, "Unrecognized service: #{key}"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
def [](service)
|
|
15
|
+
@@connections ||= Hash.new do |hash, key|
|
|
16
|
+
hash[key] = case key
|
|
17
|
+
when :dns
|
|
18
|
+
Fog::DNS.new(provider: "Dnsimple")
|
|
19
|
+
else
|
|
20
|
+
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
@@connections[service]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def services
|
|
27
|
+
Fog::Dnsimple.services
|
|
19
28
|
end
|
|
20
29
|
end
|
|
21
|
-
@@connections[service]
|
|
22
30
|
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
# fog finds the provider bin at the top-level Dnsimple constant, but the dnsimple gem owns that module.
|
|
35
|
+
# Thus the module sends the bin methods to Fog::Dnsimple::Bin.
|
|
36
|
+
module Dnsimple
|
|
37
|
+
def self.method_missing(name, *args, &block)
|
|
38
|
+
bin_method?(name) ? Fog::Dnsimple::Bin.public_send(name, *args, &block) : super
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.respond_to_missing?(name, include_private = false)
|
|
42
|
+
bin_method?(name) || super
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.bin_method?(name)
|
|
46
|
+
Fog::Dnsimple::Bin.singleton_methods.include?(name.to_sym)
|
|
27
47
|
end
|
|
48
|
+
private_class_method :bin_method?
|
|
28
49
|
end
|
data/lib/fog/dnsimple/dns.rb
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
require "fog/core"
|
|
2
|
-
require
|
|
2
|
+
# dnsimple-ruby uses JSON but does not require it.
|
|
3
|
+
require "json"
|
|
4
|
+
require "dnsimple"
|
|
3
5
|
|
|
4
6
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
7
|
+
module Dnsimple
|
|
8
|
+
class DNS < Fog::Service
|
|
7
9
|
recognizes :dnsimple_token, :dnsimple_account, :dnsimple_url
|
|
8
10
|
|
|
9
11
|
model_path 'fog/dnsimple/models/dns'
|
|
@@ -57,53 +59,55 @@ module Fog
|
|
|
57
59
|
@dnsimple_token = options[:dnsimple_token]
|
|
58
60
|
@dnsimple_account = options[:dnsimple_account]
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
options[:
|
|
63
|
-
options
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
connection_options = options[:connection_options] || {}
|
|
68
|
-
connection_options[:headers] ||= {}
|
|
69
|
-
connection_options[:headers]["User-Agent"] = "#{Fog::Core::Connection.user_agents} fog-dnsimple/#{Fog::Dnsimple::VERSION}"
|
|
70
|
-
|
|
71
|
-
host = options[:host] || "api.dnsimple.com"
|
|
72
|
-
persistent = options[:persistent] || false
|
|
73
|
-
port = options[:port] || 443
|
|
74
|
-
scheme = options[:scheme] || "https"
|
|
75
|
-
@connection = Fog::Core::Connection.new("#{scheme}://#{host}:#{port}", persistent, connection_options)
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def reload
|
|
79
|
-
@connection.reset
|
|
62
|
+
@client = ::Dnsimple::Client.new(
|
|
63
|
+
access_token: @dnsimple_token,
|
|
64
|
+
base_url: options[:dnsimple_url],
|
|
65
|
+
proxy: proxy_address(options.dig(:connection_options, :proxy)),
|
|
66
|
+
user_agent: "#{Fog::Core::Connection.user_agents} fog-dnsimple/#{Fog::Dnsimple::VERSION}"
|
|
67
|
+
)
|
|
80
68
|
end
|
|
81
69
|
|
|
82
|
-
|
|
83
|
-
params[:headers] ||= {}
|
|
70
|
+
private
|
|
84
71
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
72
|
+
# Converts the dnsimple-ruby result and errors to Excon types.
|
|
73
|
+
def request
|
|
74
|
+
unless @dnsimple_token && @dnsimple_account
|
|
88
75
|
raise ArgumentError.new("Insufficient credentials to properly authenticate!")
|
|
89
76
|
end
|
|
90
|
-
params[:headers].merge!(
|
|
91
|
-
"Accept" => "application/json",
|
|
92
|
-
"Content-Type" => "application/json"
|
|
93
|
-
)
|
|
94
77
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
78
|
+
http_response = yield(@client).http_response
|
|
79
|
+
excon_response(http_response, http_response.parsed_response || "")
|
|
80
|
+
rescue ::Dnsimple::RequestError => e
|
|
81
|
+
raise Excon::Error.status_error({}, excon_response(e.http_response, e.http_response.body.to_s))
|
|
82
|
+
rescue ::Dnsimple::AuthenticationFailed => e
|
|
83
|
+
raise Excon::Error.status_error({}, Excon::Response.new(status: 401, body: JSON.dump("message" => e.message)))
|
|
84
|
+
rescue Timeout::Error => e
|
|
85
|
+
raise Excon::Error::Timeout, e.message
|
|
86
|
+
rescue SocketError, SystemCallError, IOError, OpenSSL::SSL::SSLError => e
|
|
87
|
+
raise Excon::Error::Socket.new(e)
|
|
88
|
+
rescue JSON::ParserError => e
|
|
89
|
+
raise Excon::Error::ResponseParse, e.message
|
|
90
|
+
end
|
|
99
91
|
|
|
100
|
-
|
|
101
|
-
|
|
92
|
+
# Converts an Excon proxy (URL or Hash) to the "host:port" form of dnsimple-ruby.
|
|
93
|
+
def proxy_address(proxy)
|
|
94
|
+
case proxy
|
|
95
|
+
when String
|
|
96
|
+
uri = URI.parse(proxy)
|
|
97
|
+
"#{uri.host}:#{uri.port}"
|
|
98
|
+
when Hash
|
|
99
|
+
"#{proxy[:host]}:#{proxy[:port]}"
|
|
102
100
|
end
|
|
103
|
-
response
|
|
104
101
|
end
|
|
105
102
|
|
|
106
|
-
|
|
103
|
+
# Excon errors carry the raw body, and successful responses carry the parsed JSON.
|
|
104
|
+
def excon_response(http_response, body)
|
|
105
|
+
Excon::Response.new(
|
|
106
|
+
status: http_response.code,
|
|
107
|
+
headers: http_response.response.each_header.to_h,
|
|
108
|
+
body: body
|
|
109
|
+
)
|
|
110
|
+
end
|
|
107
111
|
|
|
108
112
|
def paginate(query: {})
|
|
109
113
|
current_page = 0
|
|
@@ -131,4 +135,7 @@ module Fog
|
|
|
131
135
|
end
|
|
132
136
|
end
|
|
133
137
|
end
|
|
138
|
+
|
|
139
|
+
# Keeps the constant from the service::provider format for compatibility.
|
|
140
|
+
DNS::Dnsimple = Dnsimple::DNS
|
|
134
141
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
require 'fog/core/model'
|
|
2
2
|
|
|
3
3
|
module Fog
|
|
4
|
-
module
|
|
5
|
-
class
|
|
4
|
+
module Dnsimple
|
|
5
|
+
class DNS
|
|
6
6
|
class Record < Fog::Model
|
|
7
7
|
identity :id
|
|
8
8
|
|
|
@@ -20,7 +20,7 @@ module Fog
|
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def destroy
|
|
23
|
-
service.delete_record(zone.
|
|
23
|
+
service.delete_record(zone.domain, identity)
|
|
24
24
|
true
|
|
25
25
|
end
|
|
26
26
|
|
|
@@ -35,12 +35,12 @@ module Fog
|
|
|
35
35
|
|
|
36
36
|
# decide whether its a new record or update of an existing
|
|
37
37
|
if id.nil?
|
|
38
|
-
data = service.create_record(zone.
|
|
38
|
+
data = service.create_record(zone.domain, name, type, value, options)
|
|
39
39
|
else
|
|
40
40
|
options[:name] = name if name
|
|
41
41
|
options[:content] = value if value
|
|
42
42
|
options[:type] = type if type
|
|
43
|
-
data = service.update_record(zone.
|
|
43
|
+
data = service.update_record(zone.domain, id, options)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
merge_attributes(data.body["data"])
|
|
@@ -2,23 +2,23 @@ require 'fog/core/collection'
|
|
|
2
2
|
require 'fog/dnsimple/models/dns/record'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Dnsimple
|
|
6
|
+
class DNS
|
|
7
7
|
class Records < Fog::Collection
|
|
8
8
|
attribute :zone
|
|
9
9
|
|
|
10
|
-
model Fog::DNS::
|
|
10
|
+
model Fog::Dnsimple::DNS::Record
|
|
11
11
|
|
|
12
12
|
def all
|
|
13
13
|
requires :zone
|
|
14
14
|
clear
|
|
15
|
-
data = service.list_records(zone.
|
|
15
|
+
data = service.list_records(zone.domain).body["data"]
|
|
16
16
|
load(data)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def get(record_id)
|
|
20
20
|
requires :zone
|
|
21
|
-
data = service.get_record(zone.
|
|
21
|
+
data = service.get_record(zone.domain, record_id).body["data"]
|
|
22
22
|
new(data)
|
|
23
23
|
rescue Excon::Errors::NotFound
|
|
24
24
|
nil
|
|
@@ -2,8 +2,8 @@ require 'fog/core/model'
|
|
|
2
2
|
require 'fog/dnsimple/models/dns/records'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Dnsimple
|
|
6
|
+
class DNS
|
|
7
7
|
class Zone < Fog::Model
|
|
8
8
|
identity :id
|
|
9
9
|
|
|
@@ -18,7 +18,7 @@ module Fog
|
|
|
18
18
|
|
|
19
19
|
def records
|
|
20
20
|
@records ||= begin
|
|
21
|
-
Fog::DNS::
|
|
21
|
+
Fog::Dnsimple::DNS::Records.new(
|
|
22
22
|
:zone => self,
|
|
23
23
|
:service => service
|
|
24
24
|
)
|
|
@@ -2,10 +2,10 @@ require 'fog/core/collection'
|
|
|
2
2
|
require 'fog/dnsimple/models/dns/zone'
|
|
3
3
|
|
|
4
4
|
module Fog
|
|
5
|
-
module
|
|
6
|
-
class
|
|
5
|
+
module Dnsimple
|
|
6
|
+
class DNS
|
|
7
7
|
class Zones < Fog::Collection
|
|
8
|
-
model Fog::DNS::
|
|
8
|
+
model Fog::Dnsimple::DNS::Zone
|
|
9
9
|
|
|
10
10
|
def all
|
|
11
11
|
clear
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Fog
|
|
2
|
-
module
|
|
3
|
-
class
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class DNS
|
|
4
4
|
class Real
|
|
5
5
|
# Create a single domain in DNSimple in your account.
|
|
6
6
|
#
|
|
@@ -12,16 +12,7 @@ module Fog
|
|
|
12
12
|
# * body<~Hash>:
|
|
13
13
|
# * "data"<~Hash> The representation of the domain.
|
|
14
14
|
def create_domain(zone_name)
|
|
15
|
-
|
|
16
|
-
"name" => zone_name
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
request(
|
|
20
|
-
body: Fog::JSON.encode(body),
|
|
21
|
-
expects: 201,
|
|
22
|
-
method: "POST",
|
|
23
|
-
path: "/#{@dnsimple_account}/domains"
|
|
24
|
-
)
|
|
15
|
+
request { |client| client.domains.create_domain(@dnsimple_account, name: zone_name) }
|
|
25
16
|
end
|
|
26
17
|
end
|
|
27
18
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Fog
|
|
2
|
-
module
|
|
3
|
-
class
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class DNS
|
|
4
4
|
class Real
|
|
5
5
|
# Create a new host in the specified zone
|
|
6
6
|
#
|
|
@@ -18,19 +18,9 @@ module Fog
|
|
|
18
18
|
# * body<~Hash>:
|
|
19
19
|
# * 'record'<~Hash> The representation of the record.
|
|
20
20
|
def create_record(zone_name, name, type, content, options = {})
|
|
21
|
-
|
|
22
|
-
"name" => name,
|
|
23
|
-
"type" => type,
|
|
24
|
-
"content" => content
|
|
25
|
-
}
|
|
26
|
-
body.merge!(options)
|
|
21
|
+
attributes = { name: name, type: type, content: content }.merge(options)
|
|
27
22
|
|
|
28
|
-
request(
|
|
29
|
-
body: Fog::JSON.encode(body),
|
|
30
|
-
expects: 201,
|
|
31
|
-
method: "POST",
|
|
32
|
-
path: "/#{@dnsimple_account}/zones/#{zone_name}/records"
|
|
33
|
-
)
|
|
23
|
+
request { |client| client.zones.create_zone_record(@dnsimple_account, zone_name, attributes) }
|
|
34
24
|
end
|
|
35
25
|
end
|
|
36
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Fog
|
|
2
|
-
module
|
|
3
|
-
class
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class DNS
|
|
4
4
|
class Real
|
|
5
5
|
# Delete the given domain from your account. You may use
|
|
6
6
|
# either the domain ID or the domain name.
|
|
@@ -9,15 +9,10 @@ module Fog
|
|
|
9
9
|
# DNSimple this will not delete the domain from the registry.
|
|
10
10
|
#
|
|
11
11
|
# ==== Parameters
|
|
12
|
-
# * account_id<~String> - the account the domain belong to
|
|
13
12
|
# * zone_name<~String> - zone name
|
|
14
13
|
#
|
|
15
14
|
def delete_domain(zone_name)
|
|
16
|
-
request(
|
|
17
|
-
expects: 204,
|
|
18
|
-
method: "DELETE",
|
|
19
|
-
path: "/#{@dnsimple_account}/domains/#{zone_name}"
|
|
20
|
-
)
|
|
15
|
+
request { |client| client.domains.delete_domain(@dnsimple_account, zone_name) }
|
|
21
16
|
end
|
|
22
17
|
end
|
|
23
18
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Fog
|
|
2
|
-
module
|
|
3
|
-
class
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class DNS
|
|
4
4
|
class Real
|
|
5
5
|
# Delete the record with the given ID for the given domain.
|
|
6
6
|
#
|
|
@@ -8,11 +8,7 @@ module Fog
|
|
|
8
8
|
# * zone_name<~String> - zone name
|
|
9
9
|
# * record_id<~String>
|
|
10
10
|
def delete_record(zone_name, record_id)
|
|
11
|
-
request(
|
|
12
|
-
expects: 204,
|
|
13
|
-
method: "DELETE",
|
|
14
|
-
path: "/#{@dnsimple_account}/zones/#{zone_name}/records/#{record_id}"
|
|
15
|
-
)
|
|
11
|
+
request { |client| client.zones.delete_zone_record(@dnsimple_account, zone_name, record_id) }
|
|
16
12
|
end
|
|
17
13
|
end
|
|
18
14
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Fog
|
|
2
|
-
module
|
|
3
|
-
class
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class DNS
|
|
4
4
|
class Real
|
|
5
5
|
# Get the details for a specific domain in your account. You
|
|
6
6
|
# may pass either the domain numeric ID or the domain name
|
|
@@ -14,11 +14,7 @@ module Fog
|
|
|
14
14
|
# * body<~Hash>:
|
|
15
15
|
# * "data"<~Hash> The representation of the domain.
|
|
16
16
|
def get_domain(zone_name)
|
|
17
|
-
request(
|
|
18
|
-
expects: 200,
|
|
19
|
-
method: "GET",
|
|
20
|
-
path: "/#{@dnsimple_account}/domains/#{zone_name}"
|
|
21
|
-
)
|
|
17
|
+
request { |client| client.domains.domain(@dnsimple_account, zone_name) }
|
|
22
18
|
end
|
|
23
19
|
end
|
|
24
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Fog
|
|
2
|
-
module
|
|
3
|
-
class
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class DNS
|
|
4
4
|
class Real
|
|
5
5
|
# Gets record from given domain.
|
|
6
6
|
#
|
|
@@ -13,11 +13,7 @@ module Fog
|
|
|
13
13
|
# * body<~Hash>:
|
|
14
14
|
# * "data"<~Hash> The representation of the record.
|
|
15
15
|
def get_record(zone_name, record_id)
|
|
16
|
-
request(
|
|
17
|
-
expects: 200,
|
|
18
|
-
method: "GET",
|
|
19
|
-
path: "/#{@dnsimple_account}/zones/#{zone_name}/records/#{record_id}"
|
|
20
|
-
)
|
|
16
|
+
request { |client| client.zones.zone_record(@dnsimple_account, zone_name, record_id) }
|
|
21
17
|
end
|
|
22
18
|
end
|
|
23
19
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Fog
|
|
2
|
-
module
|
|
3
|
-
class
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class DNS
|
|
4
4
|
class Real
|
|
5
5
|
# Get the paginated list of domains in the account.
|
|
6
6
|
#
|
|
@@ -10,12 +10,7 @@ module Fog
|
|
|
10
10
|
# @param query [Hash]
|
|
11
11
|
# @return [Excon::Response]
|
|
12
12
|
def list_domains(query: {})
|
|
13
|
-
request(
|
|
14
|
-
expects: 200,
|
|
15
|
-
method: "GET",
|
|
16
|
-
path: "/#{@dnsimple_account}/domains",
|
|
17
|
-
query: query
|
|
18
|
-
)
|
|
13
|
+
request { |client| client.domains.list_domains(@dnsimple_account, query: query) }
|
|
19
14
|
end
|
|
20
15
|
end
|
|
21
16
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Fog
|
|
2
|
-
module
|
|
3
|
-
class
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class DNS
|
|
4
4
|
class Real
|
|
5
5
|
# Get the paginated list of records for the specific zone.
|
|
6
6
|
#
|
|
@@ -11,12 +11,7 @@ module Fog
|
|
|
11
11
|
# @param query [Hash]
|
|
12
12
|
# @return [Excon::Response]
|
|
13
13
|
def list_records(zone_name, query: {})
|
|
14
|
-
request(
|
|
15
|
-
expects: 200,
|
|
16
|
-
method: "GET",
|
|
17
|
-
path: "/#{@dnsimple_account}/zones/#{zone_name}/records",
|
|
18
|
-
query: query
|
|
19
|
-
)
|
|
14
|
+
request { |client| client.zones.list_zone_records(@dnsimple_account, zone_name, query: query) }
|
|
20
15
|
end
|
|
21
16
|
end
|
|
22
17
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module Fog
|
|
2
|
-
module
|
|
3
|
-
class
|
|
2
|
+
module Dnsimple
|
|
3
|
+
class DNS
|
|
4
4
|
class Real
|
|
5
5
|
# Update the given record for the given domain.
|
|
6
6
|
#
|
|
@@ -18,14 +18,7 @@ module Fog
|
|
|
18
18
|
# * body<~Hash>:
|
|
19
19
|
# * "data"<~Hash> The representation of the record.
|
|
20
20
|
def update_record(zone_name, record_id, options)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
request(
|
|
24
|
-
body: Fog::JSON.encode(body),
|
|
25
|
-
expects: 200,
|
|
26
|
-
method: "PATCH",
|
|
27
|
-
path: "/#{@dnsimple_account}/zones/#{zone_name}/records/#{record_id}"
|
|
28
|
-
)
|
|
21
|
+
request { |client| client.zones.update_zone_record(@dnsimple_account, zone_name, record_id, options) }
|
|
29
22
|
end
|
|
30
23
|
end
|
|
31
24
|
|
data/lib/fog/dnsimple/version.rb
CHANGED
data/lib/fog/dnsimple.rb
CHANGED
metadata
CHANGED
|
@@ -1,125 +1,55 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fog-dnsimple
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 3.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Simone Carletti
|
|
8
|
-
|
|
9
|
-
bindir: exe
|
|
8
|
+
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: dnsimple
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
20
|
-
type: :
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.12'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: rake
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '12.0'
|
|
34
|
-
type: :development
|
|
18
|
+
version: '13.0'
|
|
19
|
+
type: :runtime
|
|
35
20
|
prerelease: false
|
|
36
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
22
|
requirements:
|
|
38
23
|
- - "~>"
|
|
39
24
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
41
|
-
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: minitest
|
|
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
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: minitest-reporters
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - ">="
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
25
|
+
version: '13.0'
|
|
69
26
|
- !ruby/object:Gem::Dependency
|
|
70
27
|
name: fog-core
|
|
71
28
|
requirement: !ruby/object:Gem::Requirement
|
|
72
29
|
requirements:
|
|
73
|
-
- - "
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '1.38'
|
|
76
|
-
- - "<"
|
|
77
|
-
- !ruby/object:Gem::Version
|
|
78
|
-
version: '3'
|
|
79
|
-
type: :runtime
|
|
80
|
-
prerelease: false
|
|
81
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
82
|
-
requirements:
|
|
83
|
-
- - ">="
|
|
84
|
-
- !ruby/object:Gem::Version
|
|
85
|
-
version: '1.38'
|
|
86
|
-
- - "<"
|
|
87
|
-
- !ruby/object:Gem::Version
|
|
88
|
-
version: '3'
|
|
89
|
-
- !ruby/object:Gem::Dependency
|
|
90
|
-
name: fog-json
|
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
|
92
|
-
requirements:
|
|
93
|
-
- - ">="
|
|
30
|
+
- - "~>"
|
|
94
31
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '
|
|
32
|
+
version: '2.5'
|
|
96
33
|
type: :runtime
|
|
97
34
|
prerelease: false
|
|
98
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
36
|
requirements:
|
|
100
|
-
- - "
|
|
37
|
+
- - "~>"
|
|
101
38
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
103
|
-
description:
|
|
104
|
-
|
|
105
|
-
to use the DNSimple in applications.
|
|
39
|
+
version: '2.5'
|
|
40
|
+
description: This library can be used as a module for `fog` or as standalone provider
|
|
41
|
+
to use the DNSimple in applications.
|
|
106
42
|
email:
|
|
107
|
-
-
|
|
43
|
+
- code@simonecarletti.com
|
|
108
44
|
executables: []
|
|
109
45
|
extensions: []
|
|
110
|
-
extra_rdoc_files:
|
|
46
|
+
extra_rdoc_files:
|
|
47
|
+
- LICENSE.txt
|
|
111
48
|
files:
|
|
112
|
-
- ".gitignore"
|
|
113
|
-
- ".ruby-gemset"
|
|
114
|
-
- ".travis.yml"
|
|
115
49
|
- CHANGELOG.md
|
|
116
50
|
- Gemfile
|
|
117
51
|
- LICENSE.txt
|
|
118
52
|
- README.md
|
|
119
|
-
- Rakefile
|
|
120
|
-
- bin/console
|
|
121
|
-
- bin/setup
|
|
122
|
-
- fog-dnsimple.gemspec
|
|
123
53
|
- lib/fog/bin/dnsimple.rb
|
|
124
54
|
- lib/fog/dnsimple.rb
|
|
125
55
|
- lib/fog/dnsimple/dns.rb
|
|
@@ -142,8 +72,12 @@ files:
|
|
|
142
72
|
homepage: https://github.com/fog/fog-dnsimple
|
|
143
73
|
licenses:
|
|
144
74
|
- MIT
|
|
145
|
-
metadata:
|
|
146
|
-
|
|
75
|
+
metadata:
|
|
76
|
+
bug_tracker_uri: https://github.com/fog/fog-dnsimple/issues
|
|
77
|
+
changelog_uri: https://github.com/fog/fog-dnsimple/blob/main/CHANGELOG.md
|
|
78
|
+
documentation_uri: https://rubydoc.info/gems/fog-dnsimple/3.0.0
|
|
79
|
+
homepage_uri: https://github.com/fog/fog-dnsimple
|
|
80
|
+
source_code_uri: https://github.com/fog/fog-dnsimple/tree/v3.0.0
|
|
147
81
|
rdoc_options: []
|
|
148
82
|
require_paths:
|
|
149
83
|
- lib
|
|
@@ -151,16 +85,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
151
85
|
requirements:
|
|
152
86
|
- - ">="
|
|
153
87
|
- !ruby/object:Gem::Version
|
|
154
|
-
version: '2
|
|
88
|
+
version: '3.2'
|
|
155
89
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
90
|
requirements:
|
|
157
91
|
- - ">="
|
|
158
92
|
- !ruby/object:Gem::Version
|
|
159
93
|
version: '0'
|
|
160
94
|
requirements: []
|
|
161
|
-
|
|
162
|
-
rubygems_version: 2.7.3
|
|
163
|
-
signing_key:
|
|
95
|
+
rubygems_version: 3.6.9
|
|
164
96
|
specification_version: 4
|
|
165
97
|
summary: Module for the 'fog' gem to support DNSimple.
|
|
166
98
|
test_files: []
|
data/.gitignore
DELETED
data/.ruby-gemset
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
fog-dnsimple
|
data/.travis.yml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
|
|
3
|
-
rvm:
|
|
4
|
-
- 2.1
|
|
5
|
-
- 2.2
|
|
6
|
-
- 2.3
|
|
7
|
-
- 2.4
|
|
8
|
-
- 2.5
|
|
9
|
-
- ruby-head
|
|
10
|
-
- jruby-head
|
|
11
|
-
|
|
12
|
-
before_install:
|
|
13
|
-
- rvm get latest
|
|
14
|
-
- gem install bundler
|
|
15
|
-
|
|
16
|
-
matrix:
|
|
17
|
-
allow_failures:
|
|
18
|
-
- rvm: jruby-head
|
|
19
|
-
|
|
20
|
-
notifications:
|
|
21
|
-
slack:
|
|
22
|
-
secure: "iqBpU3PYNS+7GiZAJ0jjVTJoLyyeG1Aub7gXQxRhLAQVUWTgnQdgbFXkAG4YpUn4PGDveky4So6GpumG8sLb+7D2HEqCfGwZ0u/UuVSglm+ain0iX18rwGGnLMoyAti7Gln8uQmGE6hT8eN6Bjkr05RKMUnQtIrGPO4vokJQh2gRcbesgRlWiIX+pn6xIVk7gVX5fGo6UgCSZDIq0mgOc4Sodubalu7BE0zTx+N0eOjE/58FkqWYvJUX+njcdphFoLC+RAsIAedjh7ZJTwuKItGuVhxhJqiXBc8lVDK0e+1Ipff2nNJvBxriniCXJTpAzDBamJG1cn47ecdan0DiKtUrHFbKYzODDPwDTOJsh/AO2dLZwi65PAxvmit/VhTaQj5394JLtxrCTMOic04GGkrXez+d360kAQAQmxsbJR2vRe/3vLTj8WBzabh4zq3R1dPXiAhSYSY7CfKfCY5zMEeAPsr4C/NSKTdk77Ddoq8GoguLZOc3ew5VJe5FyRJMEGnWPDMbCF4XIc6vd3LSRvQXyAgpF3Zvo8JkIGeiQhhTNT3yxvo08hPR2sWcC8cidRMwulCIsWIebCwIebYUd9XfJKzng4GJP8gvdbxbNnaHfsip98mTPYZqiQbuvZsxD99o5ovJp8meaXsTkXOK1Sbw4wWTNeYZQ0gnjb5+P6Y="
|
data/Rakefile
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
require "bundler/gem_tasks"
|
|
2
|
-
|
|
3
|
-
task :default => :test
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
require "rake/testtask"
|
|
7
|
-
|
|
8
|
-
Rake::TestTask.new(:test) do |t|
|
|
9
|
-
t.libs = %w( lib test )
|
|
10
|
-
t.pattern = "test/**/*_test.rb"
|
|
11
|
-
t.verbose = !ENV["VERBOSE"].nil?
|
|
12
|
-
t.warning = !ENV["WARNING"].nil?
|
|
13
|
-
end
|
data/bin/console
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
|
|
3
|
-
require "bundler/setup"
|
|
4
|
-
require "fog/dnsimple"
|
|
5
|
-
|
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
-
|
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
-
# require "pry"
|
|
11
|
-
# Pry.start
|
|
12
|
-
|
|
13
|
-
require "irb"
|
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/fog-dnsimple.gemspec
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
lib = File.expand_path('../lib', __FILE__)
|
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
-
require 'fog/dnsimple/version'
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = "fog-dnsimple"
|
|
7
|
-
spec.version = Fog::Dnsimple::VERSION
|
|
8
|
-
spec.authors = ["Simone Carletti"]
|
|
9
|
-
spec.email = ["weppos@weppos.net"]
|
|
10
|
-
|
|
11
|
-
spec.summary = %q{Module for the 'fog' gem to support DNSimple.}
|
|
12
|
-
spec.description = %q{This library can be used as a module for `fog` or as standalone provider
|
|
13
|
-
to use the DNSimple in applications.}
|
|
14
|
-
spec.homepage = "https://github.com/fog/fog-dnsimple"
|
|
15
|
-
spec.license = "MIT"
|
|
16
|
-
|
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
18
|
-
spec.bindir = "exe"
|
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
|
-
spec.require_paths = ["lib"]
|
|
21
|
-
|
|
22
|
-
spec.required_ruby_version = ">= 2.1"
|
|
23
|
-
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.12"
|
|
25
|
-
spec.add_development_dependency "rake", "~> 12.0"
|
|
26
|
-
spec.add_development_dependency "minitest"
|
|
27
|
-
spec.add_development_dependency "minitest-reporters"
|
|
28
|
-
|
|
29
|
-
spec.add_dependency "fog-core", ">= 1.38", "< 3"
|
|
30
|
-
spec.add_dependency "fog-json"
|
|
31
|
-
end
|