dnsimple 3.1.0 → 4.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/.rubocop.yml +5 -0
- data/.rubocop_dnsimple.yml +24 -18
- data/CHANGELOG.md +17 -5
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +0 -1
- data/README.md +14 -3
- data/dnsimple.gemspec +1 -1
- data/lib/dnsimple/client.rb +5 -5
- data/lib/dnsimple/client/certificates.rb +89 -0
- data/lib/dnsimple/client/clients.rb +37 -0
- data/lib/dnsimple/client/collaborators.rb +76 -0
- data/lib/dnsimple/client/domains_pushes.rb +97 -0
- data/lib/dnsimple/client/registrar.rb +2 -2
- data/lib/dnsimple/client/registrar_delegation.rb +42 -0
- data/lib/dnsimple/client/services_domains.rb +82 -0
- data/lib/dnsimple/client/templates.rb +0 -5
- data/lib/dnsimple/client/templates_domains.rb +29 -0
- data/lib/dnsimple/client/vanity_name_servers.rb +47 -0
- data/lib/dnsimple/client/zones.rb +17 -0
- data/lib/dnsimple/client/zones_records.rb +9 -9
- data/lib/dnsimple/struct.rb +6 -1
- data/lib/dnsimple/struct/certificate.rb +37 -0
- data/lib/dnsimple/struct/certificate_bundle.rb +24 -0
- data/lib/dnsimple/struct/collaborator.rb +34 -0
- data/lib/dnsimple/struct/domain_push.rb +28 -0
- data/lib/dnsimple/struct/tld.rb +12 -0
- data/lib/dnsimple/struct/zone_file.rb +10 -0
- data/lib/dnsimple/struct/{record.rb → zone_record.rb} +4 -1
- data/lib/dnsimple/version.rb +1 -1
- data/spec/dnsimple/client/accounts_spec.rb +1 -1
- data/spec/dnsimple/client/certificates_spec.rb +206 -0
- data/spec/dnsimple/client/collaborators_spec.rb +162 -0
- data/spec/dnsimple/client/contacts_spec.rb +5 -5
- data/spec/dnsimple/client/domains_email_forwards_spec.rb +5 -5
- data/spec/dnsimple/client/domains_pushes_spec.rb +162 -0
- data/spec/dnsimple/client/domains_spec.rb +6 -6
- data/spec/dnsimple/client/registrar_delegation_spec.rb +51 -0
- data/spec/dnsimple/client/registrar_spec.rb +6 -6
- data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +4 -4
- data/spec/dnsimple/client/services_domains_spec.rb +115 -0
- data/spec/dnsimple/client/services_spec.rb +1 -1
- data/spec/dnsimple/client/templates_domains_spec.rb +32 -0
- data/spec/dnsimple/client/templates_records_spec.rb +1 -1
- data/spec/dnsimple/client/templates_spec.rb +25 -1
- data/spec/dnsimple/client/tlds_spec.rb +8 -4
- data/spec/dnsimple/client/vanity_name_servers_spec.rb +54 -0
- data/spec/dnsimple/client/webhooks_spec.rb +2 -2
- data/spec/dnsimple/client/zones_records_spec.rb +34 -23
- data/spec/dnsimple/client/zones_spec.rb +40 -4
- data/spec/fixtures.http/acceptPush/success.http +17 -0
- data/spec/fixtures.http/addCollaborator/invite-success.http +21 -0
- data/spec/fixtures.http/addCollaborator/success.http +21 -0
- data/spec/fixtures.http/appliedServices/success.http +21 -0
- data/spec/fixtures.http/applyService/created.http +17 -0
- data/spec/fixtures.http/applyTemplate/success.http +13 -0
- data/spec/fixtures.http/changeDomainDelegationFromVanity/success.http +17 -0
- data/spec/fixtures.http/changeDomainDelegationToVanity/success.http +21 -0
- data/spec/fixtures.http/createZoneRecord/created.http +13 -9
- data/spec/fixtures.http/disableVanityNameServers/success.http +17 -0
- data/spec/fixtures.http/downloadCertificate/success.http +21 -0
- data/spec/fixtures.http/enableVanityNameServers/success.http +21 -0
- data/spec/fixtures.http/getCertificate/success.http +21 -0
- data/spec/fixtures.http/getCertificatePrivateKey/success.http +21 -0
- data/spec/fixtures.http/getTld/success.http +13 -9
- data/spec/fixtures.http/getZoneFile/success.http +21 -0
- data/spec/fixtures.http/getZoneRecord/success.http +13 -9
- data/spec/fixtures.http/initiatePush/success.http +21 -0
- data/spec/fixtures.http/{accounts → listAccounts}/success-account.http +0 -0
- data/spec/fixtures.http/{accounts → listAccounts}/success-user.http +0 -0
- data/spec/fixtures.http/listCertificates/success.http +21 -0
- data/spec/fixtures.http/listCollaborators/success.http +21 -0
- data/spec/fixtures.http/listPushes/success.http +21 -0
- data/spec/fixtures.http/listTlds/success.http +13 -9
- data/spec/fixtures.http/listZoneRecords/success.http +13 -9
- data/spec/fixtures.http/notfound-certificate.http +16 -0
- data/spec/fixtures.http/notfound-collaborator.http +16 -0
- data/spec/fixtures.http/notfound-contact.http +1 -1
- data/spec/fixtures.http/notfound-domainpush.http +12 -0
- data/spec/fixtures.http/rejectPush/success.http +17 -0
- data/spec/fixtures.http/removeCollaborator/success.http +17 -0
- data/spec/fixtures.http/unapplyService/success.http +17 -0
- data/spec/fixtures.http/updateZoneRecord/success.http +13 -9
- metadata +80 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfd2d022a76ad12b6b4259ce10a2f349c618a31f
|
|
4
|
+
data.tar.gz: 30bb0e50b7d8ed4662c113c70a84c584ae1d9a55
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45b87521f74759ff510845caa7f3b661ce80af3d40aecaa962655296b07b5fab90ceb358e3f180a0a5f736105faadcb38a55078771961073303f496838a5d219
|
|
7
|
+
data.tar.gz: 364c11eb5e67241ff9123e67fa4ce5af26358c8d03eee7f5692b480cf882f56b155144f1c853f92b4b9072a97b69ed55f0fcb9792bb4b7448dd66830c0185b36
|
data/.rubocop.yml
CHANGED
|
@@ -11,3 +11,8 @@ Lint/Loop:
|
|
|
11
11
|
# It doesn't seem to work as expected.
|
|
12
12
|
Style/IfUnlessModifier:
|
|
13
13
|
Enabled: false
|
|
14
|
+
|
|
15
|
+
# This rule suggest to use safe navigation (&.) operator which was introduced
|
|
16
|
+
# with Ruby 2.3. Because we are supporting Ruby 2.0+ we can't use this operator.
|
|
17
|
+
Style/SafeNavigation:
|
|
18
|
+
Enabled: false
|
data/.rubocop_dnsimple.yml
CHANGED
|
@@ -23,19 +23,6 @@ Metrics/AbcSize:
|
|
|
23
23
|
- 'spec/**/*_spec.rb'
|
|
24
24
|
- 'test/**/*_test.rb'
|
|
25
25
|
|
|
26
|
-
# For the same reason of EndAlignment, aligning with the case may have a bad impact
|
|
27
|
-
# on a case after a very long variable.
|
|
28
|
-
#
|
|
29
|
-
# invoice_error_message = case error
|
|
30
|
-
# when 1 == 1
|
|
31
|
-
# do_something
|
|
32
|
-
# else
|
|
33
|
-
# do_else
|
|
34
|
-
# end
|
|
35
|
-
#
|
|
36
|
-
Style/CaseIndentation:
|
|
37
|
-
IndentWhenRelativeTo: end
|
|
38
|
-
|
|
39
26
|
# [codesmell]
|
|
40
27
|
Metrics/ClassLength:
|
|
41
28
|
Enabled: false
|
|
@@ -44,27 +31,27 @@ Metrics/ClassLength:
|
|
|
44
31
|
- 'test/**/*_test.rb'
|
|
45
32
|
|
|
46
33
|
# [codesmell]
|
|
47
|
-
Metrics/
|
|
34
|
+
Metrics/LineLength:
|
|
48
35
|
Enabled: false
|
|
49
36
|
Exclude:
|
|
50
37
|
- 'spec/**/*_spec.rb'
|
|
51
38
|
- 'test/**/*_test.rb'
|
|
52
|
-
Max:
|
|
39
|
+
Max: 100
|
|
53
40
|
|
|
54
41
|
# [codesmell]
|
|
55
|
-
Metrics/
|
|
42
|
+
Metrics/MethodLength:
|
|
56
43
|
Enabled: false
|
|
57
44
|
Exclude:
|
|
58
45
|
- 'spec/**/*_spec.rb'
|
|
59
46
|
- 'test/**/*_test.rb'
|
|
47
|
+
Max: 10
|
|
60
48
|
|
|
61
49
|
# [codesmell]
|
|
62
|
-
Metrics/
|
|
50
|
+
Metrics/ModuleLength:
|
|
63
51
|
Enabled: false
|
|
64
52
|
Exclude:
|
|
65
53
|
- 'spec/**/*_spec.rb'
|
|
66
54
|
- 'test/**/*_test.rb'
|
|
67
|
-
Max: 100
|
|
68
55
|
|
|
69
56
|
# [codesmell]
|
|
70
57
|
# I don't really get the point of this cop.
|
|
@@ -90,6 +77,19 @@ Style/BlockDelimiters:
|
|
|
90
77
|
Style/BracesAroundHashParameters:
|
|
91
78
|
EnforcedStyle: context_dependent
|
|
92
79
|
|
|
80
|
+
# For the same reason of EndAlignment, aligning with the case may have a bad impact
|
|
81
|
+
# on a case after a very long variable.
|
|
82
|
+
#
|
|
83
|
+
# invoice_error_message = case error
|
|
84
|
+
# when 1 == 1
|
|
85
|
+
# do_something
|
|
86
|
+
# else
|
|
87
|
+
# do_else
|
|
88
|
+
# end
|
|
89
|
+
#
|
|
90
|
+
Style/CaseIndentation:
|
|
91
|
+
IndentWhenRelativeTo: end
|
|
92
|
+
|
|
93
93
|
# I was a big fan of leading, but trailing seems to be more commonly adopted.
|
|
94
94
|
# At least at the time being.
|
|
95
95
|
Style/DotPosition:
|
|
@@ -131,6 +131,12 @@ Style/FormatString:
|
|
|
131
131
|
Style/FirstParameterIndentation:
|
|
132
132
|
IndentationWidth: 4
|
|
133
133
|
|
|
134
|
+
# We don't support frozen strings.
|
|
135
|
+
# This is an experimental feature and we don't know if it will be shipped with
|
|
136
|
+
# Ruby 3.0 or not.
|
|
137
|
+
Style/FrozenStringLiteralComment:
|
|
138
|
+
Enabled: false
|
|
139
|
+
|
|
134
140
|
# Prefer the latest Hash syntax
|
|
135
141
|
Style/HashSyntax:
|
|
136
142
|
Exclude:
|
data/CHANGELOG.md
CHANGED
|
@@ -3,20 +3,32 @@
|
|
|
3
3
|
This project uses [Semantic Versioning 2.0.0](http://semver.org/).
|
|
4
4
|
|
|
5
5
|
|
|
6
|
+
#### 4.0.0
|
|
7
|
+
|
|
8
|
+
- NEW: Added domain collaborators support (GH-137).
|
|
9
|
+
- NEW: Added regions support for zone records (GH-135, GH-139).
|
|
10
|
+
- NEW: Added domain services support (GH-122).
|
|
11
|
+
- NEW: Added domain templates support (GH-125).
|
|
12
|
+
- NEW: Added zone file support (GH-124).
|
|
13
|
+
- NEW: Added certificate support (GH-123).
|
|
14
|
+
- NEW: Added domain delegation support (GH-120).
|
|
15
|
+
- NEW: Added domain push support (GH-127).
|
|
16
|
+
- NEW: Added vanity name server support (GH-121).
|
|
17
|
+
|
|
18
|
+
- CHANGED: Record struct renamed to ZoneRecord (GH-117).
|
|
19
|
+
- CHANGED: Updated Tld payload (GH-133, GH-129).
|
|
20
|
+
- CHANGED: Renamed registrar `auth_info` into `auth_code` (GH-136).
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
#### 3.1.0
|
|
7
24
|
|
|
8
25
|
- NEW: Added accounts support (GH-113).
|
|
9
|
-
|
|
10
26
|
- NEW: Added sorting and filtering support (GH-112).
|
|
11
|
-
|
|
12
27
|
- NEW: Added template record support (GH-104).
|
|
13
28
|
|
|
14
29
|
- CHANGED: Pagination params must be passed as top level options. Previously they were passed inside `:query` options (GH-116).
|
|
15
|
-
|
|
16
30
|
- CHANGED: Authentication credentials presence is no longer validated on the client as it was causing an error getting the access token (GH-74 and GH-102).
|
|
17
|
-
|
|
18
31
|
- CHANGED: Setting a custom user-agent no longer overrides the origina user-agent (GH-105).
|
|
19
|
-
|
|
20
32
|
- CHANGED: Updated client to use Contact#email (GH-108).
|
|
21
33
|
|
|
22
34
|
- REMOVED: Removed support for wildcard accounts (GH-107).
|
data/CONTRIBUTING.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Clone the repository and move into it:
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
$ git clone git@github.com:
|
|
8
|
+
$ git clone git@github.com:dnsimple/dnsimple-ruby.git
|
|
9
9
|
$ cd dnsimple-ruby
|
|
10
10
|
```
|
|
11
11
|
|
|
@@ -31,5 +31,5 @@ $ rake
|
|
|
31
31
|
|
|
32
32
|
Submit unit tests for your changes. You can test your changes on your machine by [running the test suite](#testing).
|
|
33
33
|
|
|
34
|
-
When you submit a PR, tests will also be run on the continuous integration environment [through Travis](https://travis-ci.org/
|
|
34
|
+
When you submit a PR, tests will also be run on the continuous integration environment [through Travis](https://travis-ci.org/dnsimple/dnsimple-ruby).
|
|
35
35
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A Ruby client for the [DNSimple API v2](https://developer.dnsimple.com/v2/).
|
|
4
4
|
|
|
5
|
-
[](https://travis-ci.org/dnsimple/dnsimple-ruby)
|
|
6
|
+
[](https://coveralls.io/r/dnsimple/dnsimple-ruby?branch=master)
|
|
7
7
|
|
|
8
8
|
[DNSimple](https://dnsimple.com/) provides DNS hosting and domain registration that is simple and friendly.
|
|
9
9
|
We provide a full API and an easy-to-use web interface so you can get your domain registered and set up with a minimal amount of effort.
|
|
@@ -11,7 +11,7 @@ We provide a full API and an easy-to-use web interface so you can get your domai
|
|
|
11
11
|
|
|
12
12
|
## :warning: Beta Warning
|
|
13
13
|
|
|
14
|
-
This branch targets the development of the API client for the [DNSimple API v2](https://developer.dnsimple.com/v2/). If you are looking for the stable version of the client for [DNSimple API v1](https://developer.dnsimple.com/v1/) then use the [`master-v1`](https://github.com/
|
|
14
|
+
This branch targets the development of the API client for the [DNSimple API v2](https://developer.dnsimple.com/v2/). If you are looking for the stable version of the client for [DNSimple API v1](https://developer.dnsimple.com/v1/) then use the [`master-v1`](https://github.com/dnsimple/dnsimple-ruby/tree/master-v1) branch.
|
|
15
15
|
|
|
16
16
|
This library is currently in beta version, the methods and the implementation should be considered a work-in-progress. Changes in the method naming, method signatures, public or internal APIs may happen during the beta period.
|
|
17
17
|
|
|
@@ -68,6 +68,17 @@ puts response.data
|
|
|
68
68
|
|
|
69
69
|
For the full library documentation visit http://rubydoc.info/gems/dnsimple
|
|
70
70
|
|
|
71
|
+
## Sandbox Usage
|
|
72
|
+
|
|
73
|
+
If you would like to test the [DNSimple sandbox environment](https://developer.dnsimple.com/sandbox/) then pass the `base_url` named argument when you construct the client. For example:
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
require 'dnsimple'
|
|
77
|
+
|
|
78
|
+
client = Dnsimple::Client.new(base_url: "https://api.sandbox.dnsimple.com", access_token: "a1b2c3")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
You will need to ensure that you are using an access token created in the sandbox environment. Production tokens will *not* work in the sandbox environment.
|
|
71
82
|
|
|
72
83
|
## License
|
|
73
84
|
|
data/dnsimple.gemspec
CHANGED
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
|
7
7
|
s.version = Dnsimple::VERSION
|
|
8
8
|
s.authors = ['Anthony Eden', 'Simone Carletti', 'Javier Acero', 'Joseph Caudle', 'Luca Guidi']
|
|
9
9
|
s.email = ['anthony.eden@dnsimple.com', 'simone.carletti@dnsimple.com', 'javier.acero@dnsimple.com', 'joseph.caudle@dnsimple.com', 'luca.guidi@dnsimple.com']
|
|
10
|
-
s.homepage = 'https://github.com/
|
|
10
|
+
s.homepage = 'https://github.com/dnsimple/dnsimple-ruby'
|
|
11
11
|
s.summary = 'The DNSimple API client for Ruby'
|
|
12
12
|
s.description = 'The DNSimple API client for Ruby.'
|
|
13
13
|
|
data/lib/dnsimple/client.rb
CHANGED
|
@@ -185,11 +185,11 @@ module Dnsimple
|
|
|
185
185
|
end
|
|
186
186
|
|
|
187
187
|
def add_proxy_options!(options)
|
|
188
|
-
if proxy
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
188
|
+
return if proxy.nil?
|
|
189
|
+
|
|
190
|
+
address, port = proxy.split(":")
|
|
191
|
+
options[:http_proxyaddr] = address
|
|
192
|
+
options[:http_proxyport] = port
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
def add_auth_options!(options)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
module Dnsimple
|
|
2
|
+
class Client
|
|
3
|
+
module Certificates
|
|
4
|
+
|
|
5
|
+
# Lists the certificates associated to the domain.
|
|
6
|
+
#
|
|
7
|
+
# @see https://developer.dnsimple.com/v2/domains/certificates/#list
|
|
8
|
+
# @see #all_certificates
|
|
9
|
+
#
|
|
10
|
+
# @example List certificates in the first page
|
|
11
|
+
# client.certificates.list(1010, "example.com")
|
|
12
|
+
#
|
|
13
|
+
# @example List certificates, provide a specific page
|
|
14
|
+
# client.certificates.list(1010, "example.com", page: 2)
|
|
15
|
+
#
|
|
16
|
+
# @example List certificates, provide a sorting policy
|
|
17
|
+
# client.certificates.list(1010, "example.com", sort: "email:asc")
|
|
18
|
+
#
|
|
19
|
+
# @param [Fixnum] account_id the account ID
|
|
20
|
+
# @param [#to_s] domain_name the domain name
|
|
21
|
+
# @param [Hash] options the filtering and sorting options
|
|
22
|
+
# @option options [Integer] :page current page (pagination)
|
|
23
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
|
24
|
+
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Certificate>]
|
|
25
|
+
#
|
|
26
|
+
# @raise [Dnsimple::RequestError]
|
|
27
|
+
def certificates(account_id, domain_name, options = {})
|
|
28
|
+
response = client.get(Client.versioned("/%s/domains/%s/certificates" % [account_id, domain_name]), Options::ListOptions.new(options))
|
|
29
|
+
|
|
30
|
+
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Certificate.new(r) })
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Gets a certificate associated to the domain.
|
|
34
|
+
#
|
|
35
|
+
# @see https://developer.dnsimple.com/v2/domains/certificates/#get
|
|
36
|
+
#
|
|
37
|
+
# @param [Fixnum] account_id the account ID
|
|
38
|
+
# @param [#to_s] domain_id the domain ID or domain name
|
|
39
|
+
# @param [Fixnum] certificate_id the certificate ID
|
|
40
|
+
# @param [Hash] options
|
|
41
|
+
# @return [Dnsimple::Response<Dnsimple::Struct::Certificate>]
|
|
42
|
+
#
|
|
43
|
+
# @raise [Dnsimple::NotFoundError]
|
|
44
|
+
# @raise [Dnsimple::RequestError]
|
|
45
|
+
def certificate(account_id, domain_id, certificate_id, options = {})
|
|
46
|
+
response = client.get(Client.versioned("/%s/domains/%s/certificates/%s" % [account_id, domain_id, certificate_id]), options)
|
|
47
|
+
|
|
48
|
+
Dnsimple::Response.new(response, Struct::Certificate.new(response["data"]))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Downloads a certificate associated to the domain.
|
|
52
|
+
#
|
|
53
|
+
# @see https://developer.dnsimple.com/v2/domains/certificates/#download
|
|
54
|
+
#
|
|
55
|
+
# @param [Fixnum] account_id the account ID
|
|
56
|
+
# @param [#to_s] domain_id the domain ID or domain name
|
|
57
|
+
# @param [Fixnum] certificate_id the certificate ID
|
|
58
|
+
# @param [Hash] options
|
|
59
|
+
# @return [Dnsimple::Response<Dnsimple::Struct::CertificateBundle>]
|
|
60
|
+
#
|
|
61
|
+
# @raise [Dnsimple::NotFoundError]
|
|
62
|
+
# @raise [Dnsimple::RequestError]
|
|
63
|
+
def download_certificate(account_id, domain_id, certificate_id, options = {})
|
|
64
|
+
response = client.get(Client.versioned("/%s/domains/%s/certificates/%s/download" % [account_id, domain_id, certificate_id]), options)
|
|
65
|
+
|
|
66
|
+
Dnsimple::Response.new(response, Struct::CertificateBundle.new(response["data"]))
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Get certificate private key associated to the domain.
|
|
70
|
+
#
|
|
71
|
+
# @see https://developer.dnsimple.com/v2/domains/certificates/#get-private-key
|
|
72
|
+
#
|
|
73
|
+
# @param [Fixnum] account_id the account ID
|
|
74
|
+
# @param [#to_s] domain_id the domain ID or domain name
|
|
75
|
+
# @param [Fixnum] certificate_id the certificate ID
|
|
76
|
+
# @param [Hash] options
|
|
77
|
+
# @return [Dnsimple::Response<Dnsimple::Struct::CertificateBundle>]
|
|
78
|
+
#
|
|
79
|
+
# @raise [Dnsimple::NotFoundError]
|
|
80
|
+
# @raise [Dnsimple::RequestError]
|
|
81
|
+
def certificate_private_key(account_id, domain_id, certificate_id, options = {})
|
|
82
|
+
response = client.get(Client.versioned("/%s/domains/%s/certificates/%s/private_key" % [account_id, domain_id, certificate_id]), options)
|
|
83
|
+
|
|
84
|
+
Dnsimple::Response.new(response, Struct::CertificateBundle.new(response["data"]))
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
@@ -6,6 +6,11 @@ module Dnsimple
|
|
|
6
6
|
@services[:accounts] ||= Client::AccountsService.new(self)
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
+
# @return [Dnsimple::Client::CertificatesService] The certificate-related API proxy.
|
|
10
|
+
def certificates
|
|
11
|
+
@services[:certificates] ||= Client::CertificatesService.new(self)
|
|
12
|
+
end
|
|
13
|
+
|
|
9
14
|
# @return [Dnsimple::Client::ContactsService] The contact-related API proxy.
|
|
10
15
|
def contacts
|
|
11
16
|
@services[:contacts] ||= Client::ContactsService.new(self)
|
|
@@ -16,6 +21,11 @@ module Dnsimple
|
|
|
16
21
|
@services[:domains] ||= Client::DomainsService.new(self)
|
|
17
22
|
end
|
|
18
23
|
|
|
24
|
+
# @return [Dnsimple::Client::DomainServicesService] The domain-services-related API proxy.
|
|
25
|
+
def domain_services
|
|
26
|
+
@services[:domains] ||= Client::DomainServicesService.new(self)
|
|
27
|
+
end
|
|
28
|
+
|
|
19
29
|
# @return [Dnsimple::Client::IdentityService] The identity-related API proxy.
|
|
20
30
|
def identity
|
|
21
31
|
@services[:auth] ||= Client::IdentityService.new(self)
|
|
@@ -46,6 +56,11 @@ module Dnsimple
|
|
|
46
56
|
@services[:tlds] ||= Client::TldsService.new(self)
|
|
47
57
|
end
|
|
48
58
|
|
|
59
|
+
# @return [Dnsimple::Client::VanityNameServersService] The vanity-name-server-related API proxy.
|
|
60
|
+
def vanity_name_servers
|
|
61
|
+
@services[:vanity_name_servers] ||= Client::VanityNameServersService.new(self)
|
|
62
|
+
end
|
|
63
|
+
|
|
49
64
|
# @return [Dnsimple::Client::ZonesService] The zone-related API proxy.
|
|
50
65
|
def zones
|
|
51
66
|
@services[:zones] ||= Client::ZonesService.new(self)
|
|
@@ -103,6 +118,13 @@ module Dnsimple
|
|
|
103
118
|
end
|
|
104
119
|
|
|
105
120
|
|
|
121
|
+
require_relative 'certificates'
|
|
122
|
+
|
|
123
|
+
class CertificatesService < ClientService
|
|
124
|
+
include Client::Certificates
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
|
|
106
128
|
require_relative 'contacts'
|
|
107
129
|
|
|
108
130
|
class ContactsService < ClientService
|
|
@@ -112,10 +134,14 @@ module Dnsimple
|
|
|
112
134
|
|
|
113
135
|
require_relative 'domains'
|
|
114
136
|
require_relative 'domains_email_forwards'
|
|
137
|
+
require_relative 'domains_pushes'
|
|
138
|
+
require_relative 'collaborators'
|
|
115
139
|
|
|
116
140
|
class DomainsService < ClientService
|
|
117
141
|
include Client::Domains
|
|
118
142
|
include Client::DomainsEmailForwards
|
|
143
|
+
include Client::DomainsPushes
|
|
144
|
+
include Client::Collaborators
|
|
119
145
|
end
|
|
120
146
|
|
|
121
147
|
|
|
@@ -147,17 +173,21 @@ module Dnsimple
|
|
|
147
173
|
|
|
148
174
|
|
|
149
175
|
require_relative 'services'
|
|
176
|
+
require_relative 'services_domains'
|
|
150
177
|
|
|
151
178
|
class ServicesService < ClientService
|
|
152
179
|
include Client::Services
|
|
180
|
+
include Client::ServicesDomains
|
|
153
181
|
end
|
|
154
182
|
|
|
155
183
|
|
|
156
184
|
require_relative 'templates'
|
|
185
|
+
require_relative 'templates_domains'
|
|
157
186
|
require_relative 'templates_records'
|
|
158
187
|
|
|
159
188
|
class TemplatesService < ClientService
|
|
160
189
|
include Client::Templates
|
|
190
|
+
include Client::TemplatesDomains
|
|
161
191
|
include Client::TemplatesRecords
|
|
162
192
|
end
|
|
163
193
|
|
|
@@ -169,6 +199,13 @@ module Dnsimple
|
|
|
169
199
|
end
|
|
170
200
|
|
|
171
201
|
|
|
202
|
+
require_relative 'vanity_name_servers'
|
|
203
|
+
|
|
204
|
+
class VanityNameServersService < ClientService
|
|
205
|
+
include Client::VanityNameServers
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
|
|
172
209
|
require_relative 'zones'
|
|
173
210
|
require_relative 'zones_records'
|
|
174
211
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module Dnsimple
|
|
2
|
+
class Client
|
|
3
|
+
module Collaborators
|
|
4
|
+
|
|
5
|
+
# Lists the collaborators for a domain.
|
|
6
|
+
#
|
|
7
|
+
# @see https://developer.dnsimple.com/v2/domains/collaborators/#list
|
|
8
|
+
#
|
|
9
|
+
# @example List collaborators in the first page
|
|
10
|
+
# client.domains.collaborators(1010, "example.com")
|
|
11
|
+
#
|
|
12
|
+
# @example List collaborators, provide a specific page
|
|
13
|
+
# client.domains.collaborators(1010, "example.com", page: 2)
|
|
14
|
+
#
|
|
15
|
+
# @param [Fixnum] account_id the account ID
|
|
16
|
+
# @param [#to_s] domain_id the domain ID or name
|
|
17
|
+
# @param [Hash] request options
|
|
18
|
+
# @option options [Integer] :page current page (pagination)
|
|
19
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
|
20
|
+
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Collaborator>]
|
|
21
|
+
#
|
|
22
|
+
# @raise [Dnsimple::RequestError]
|
|
23
|
+
def collaborators(account_id, domain_id, options = {})
|
|
24
|
+
response = client.get(Client.versioned("/%s/domains/%s/collaborators" % [account_id, domain_id]), Options::ListOptions.new(options))
|
|
25
|
+
|
|
26
|
+
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Collaborator.new(r) })
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Add a collaborator to the domain.
|
|
30
|
+
#
|
|
31
|
+
# @see https://developer.dnsimple.com/v2/domains/collaborators/#add
|
|
32
|
+
#
|
|
33
|
+
# @example Add collaborator
|
|
34
|
+
# client.domains.add_collaborator(1010, "example.com", email: "user@example.com")
|
|
35
|
+
#
|
|
36
|
+
# @param [Fixnum] account_id the account ID
|
|
37
|
+
# @param [#to_s] domain_id the domain ID or name
|
|
38
|
+
# @param [Hash] user attributes
|
|
39
|
+
# @param attributes [String] :email user email (mandatory)
|
|
40
|
+
# @param [Hash] request options
|
|
41
|
+
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Collaborator>]
|
|
42
|
+
#
|
|
43
|
+
# @raise [Dnsimple::RequestError]
|
|
44
|
+
def add_collaborator(account_id, domain_id, attributes, options = {})
|
|
45
|
+
Extra.validate_mandatory_attributes(attributes, [:email])
|
|
46
|
+
response = client.post(Client.versioned("/%s/domains/%s/collaborators" % [account_id, domain_id]), attributes, options)
|
|
47
|
+
|
|
48
|
+
Dnsimple::Response.new(response, Struct::Collaborator.new(response["data"]))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Removes a collaborator from the domain.
|
|
52
|
+
#
|
|
53
|
+
# WARNING: this cannot be undone.
|
|
54
|
+
#
|
|
55
|
+
# @see https://developer.dnsimple.com/v2/domains/collaborators/#remove
|
|
56
|
+
#
|
|
57
|
+
# @example Remove collaborator
|
|
58
|
+
# client.domains.remove_collaborator(1010, "example.com", 999)
|
|
59
|
+
#
|
|
60
|
+
# @param [Fixnum] account_id the account ID
|
|
61
|
+
# @param [#to_s] domain_id the domain ID or name
|
|
62
|
+
# @param [#to_s] contact_id the contact ID
|
|
63
|
+
# @param [Hash] request options
|
|
64
|
+
# @return [Dnsimple::Response<nil>]
|
|
65
|
+
#
|
|
66
|
+
# @raise [Dnsimple::NotFoundError]
|
|
67
|
+
# @raise [Dnsimple::RequestError]
|
|
68
|
+
def remove_collaborator(account_id, domain_id, contact_id, options = {})
|
|
69
|
+
response = client.delete(Client.versioned("/%s/domains/%s/collaborators/%s" % [account_id, domain_id, contact_id]), options)
|
|
70
|
+
|
|
71
|
+
Dnsimple::Response.new(response, nil)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|