dnsimple 4.6.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dependabot/config.yml +9 -0
- data/.rubocop.yml +2 -0
- data/.rubocop_dnsimple.yml +64 -40
- data/.travis.yml +1 -3
- data/CHANGELOG.md +34 -26
- data/CONTRIBUTING.md +37 -0
- data/Gemfile +4 -1
- data/LICENSE.txt +1 -1
- data/README.md +8 -5
- data/dnsimple.gemspec +3 -3
- data/lib/dnsimple.rb +2 -0
- data/lib/dnsimple/client.rb +12 -10
- data/lib/dnsimple/client/accounts.rb +2 -0
- data/lib/dnsimple/client/certificates.rb +2 -0
- data/lib/dnsimple/client/clients.rb +2 -0
- data/lib/dnsimple/client/contacts.rb +2 -0
- data/lib/dnsimple/client/domains.rb +2 -0
- data/lib/dnsimple/client/domains_collaborators.rb +2 -0
- data/lib/dnsimple/client/domains_delegation_signer_records.rb +2 -0
- data/lib/dnsimple/client/domains_dnssec.rb +2 -0
- data/lib/dnsimple/client/domains_email_forwards.rb +2 -0
- data/lib/dnsimple/client/domains_pushes.rb +2 -0
- data/lib/dnsimple/client/identity.rb +2 -0
- data/lib/dnsimple/client/oauth.rb +2 -0
- data/lib/dnsimple/client/registrar.rb +46 -0
- data/lib/dnsimple/client/registrar_auto_renewal.rb +2 -0
- data/lib/dnsimple/client/registrar_delegation.rb +2 -0
- data/lib/dnsimple/client/registrar_whois_privacy.rb +2 -0
- data/lib/dnsimple/client/services.rb +2 -0
- data/lib/dnsimple/client/services_domains.rb +2 -0
- data/lib/dnsimple/client/templates.rb +2 -0
- data/lib/dnsimple/client/templates_domains.rb +2 -0
- data/lib/dnsimple/client/templates_records.rb +2 -0
- data/lib/dnsimple/client/tlds.rb +2 -0
- data/lib/dnsimple/client/vanity_name_servers.rb +12 -10
- data/lib/dnsimple/client/webhooks.rb +2 -0
- data/lib/dnsimple/client/zones.rb +2 -0
- data/lib/dnsimple/client/zones_distributions.rb +2 -0
- data/lib/dnsimple/client/zones_records.rb +2 -0
- data/lib/dnsimple/default.rb +11 -9
- data/lib/dnsimple/error.rb +2 -0
- data/lib/dnsimple/extra.rb +2 -0
- data/lib/dnsimple/options.rb +2 -0
- data/lib/dnsimple/response.rb +6 -4
- data/lib/dnsimple/struct.rb +2 -0
- data/lib/dnsimple/struct/account.rb +2 -0
- data/lib/dnsimple/struct/certificate.rb +2 -0
- data/lib/dnsimple/struct/certificate_bundle.rb +5 -0
- data/lib/dnsimple/struct/certificate_purchase.rb +2 -0
- data/lib/dnsimple/struct/certificate_renewal.rb +2 -0
- data/lib/dnsimple/struct/collaborator.rb +2 -0
- data/lib/dnsimple/struct/contact.rb +2 -0
- data/lib/dnsimple/struct/delegation_signer_record.rb +2 -0
- data/lib/dnsimple/struct/dnssec.rb +2 -0
- data/lib/dnsimple/struct/domain.rb +2 -0
- data/lib/dnsimple/struct/domain_check.rb +2 -0
- data/lib/dnsimple/struct/domain_premium_price.rb +2 -0
- data/lib/dnsimple/struct/domain_push.rb +2 -0
- data/lib/dnsimple/struct/domain_registration.rb +2 -0
- data/lib/dnsimple/struct/domain_renewal.rb +2 -0
- data/lib/dnsimple/struct/domain_transfer.rb +5 -0
- data/lib/dnsimple/struct/email_forward.rb +2 -0
- data/lib/dnsimple/struct/extended_attribute.rb +2 -0
- data/lib/dnsimple/struct/oauth_token.rb +2 -0
- data/lib/dnsimple/struct/service.rb +2 -0
- data/lib/dnsimple/struct/template.rb +2 -0
- data/lib/dnsimple/struct/template_record.rb +2 -0
- data/lib/dnsimple/struct/tld.rb +2 -0
- data/lib/dnsimple/struct/user.rb +2 -0
- data/lib/dnsimple/struct/vanity_name_server.rb +2 -0
- data/lib/dnsimple/struct/webhook.rb +2 -0
- data/lib/dnsimple/struct/whoami.rb +2 -0
- data/lib/dnsimple/struct/whois_privacy.rb +2 -0
- data/lib/dnsimple/struct/whois_privacy_renewal.rb +2 -0
- data/lib/dnsimple/struct/zone.rb +2 -0
- data/lib/dnsimple/struct/zone_distribution.rb +2 -0
- data/lib/dnsimple/struct/zone_file.rb +2 -0
- data/lib/dnsimple/struct/zone_record.rb +2 -0
- data/lib/dnsimple/version.rb +3 -1
- data/spec/dnsimple/client/accounts_spec.rb +2 -0
- data/spec/dnsimple/client/certificates_spec.rb +2 -0
- data/spec/dnsimple/client/client_service_spec.rb +2 -0
- data/spec/dnsimple/client/contacts_spec.rb +2 -0
- data/spec/dnsimple/client/domains_collaborators_spec.rb +2 -0
- data/spec/dnsimple/client/domains_delegation_signer_records_spec.rb +2 -0
- data/spec/dnsimple/client/domains_dnssec_spec.rb +2 -0
- data/spec/dnsimple/client/domains_email_forwards_spec.rb +2 -0
- data/spec/dnsimple/client/domains_pushes_spec.rb +2 -0
- data/spec/dnsimple/client/domains_spec.rb +2 -0
- data/spec/dnsimple/client/identity_spec.rb +2 -0
- data/spec/dnsimple/client/oauth_spec.rb +2 -0
- data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +2 -0
- data/spec/dnsimple/client/registrar_delegation_spec.rb +2 -0
- data/spec/dnsimple/client/registrar_spec.rb +69 -0
- data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +2 -0
- data/spec/dnsimple/client/services_domains_spec.rb +2 -0
- data/spec/dnsimple/client/services_spec.rb +2 -0
- data/spec/dnsimple/client/templates_domains_spec.rb +2 -0
- data/spec/dnsimple/client/templates_records_spec.rb +2 -0
- data/spec/dnsimple/client/templates_spec.rb +2 -0
- data/spec/dnsimple/client/tlds_spec.rb +2 -0
- data/spec/dnsimple/client/vanity_name_servers_spec.rb +2 -0
- data/spec/dnsimple/client/webhooks_spec.rb +2 -0
- data/spec/dnsimple/client/zones_distributions_spec.rb +2 -0
- data/spec/dnsimple/client/zones_records_spec.rb +2 -0
- data/spec/dnsimple/client/zones_spec.rb +2 -0
- data/spec/dnsimple/client_spec.rb +3 -1
- data/spec/dnsimple/extra_spec.rb +2 -0
- data/spec/dnsimple/options/base_spec.rb +2 -0
- data/spec/dnsimple/options/list_options_spec.rb +2 -0
- data/spec/fixtures.http/cancelDomainTransfer/success.http +30 -0
- data/spec/fixtures.http/getDomainTransfer/success.http +30 -0
- data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http +1 -1
- data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http +1 -1
- data/spec/spec_helper.rb +3 -1
- data/spec/support/helpers.rb +2 -0
- data/spec/support/webmock.rb +2 -0
- metadata +11 -13
- data/.ruby-gemset +0 -1
data/Gemfile
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2010-
|
3
|
+
Copyright (c) 2010-2020 DNSimple Corporation
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A Ruby client for the [DNSimple API v2](https://developer.dnsimple.com/v2/).
|
4
4
|
|
5
|
-
[![Build Status](https://travis-ci.
|
5
|
+
[![Build Status](https://travis-ci.com/dnsimple/dnsimple-ruby.svg?branch=master)](https://travis-ci.com/dnsimple/dnsimple-ruby)
|
6
6
|
[![Coverage Status](https://img.shields.io/coveralls/dnsimple/dnsimple-ruby.svg)](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.
|
@@ -77,14 +77,17 @@ You will need to ensure that you are using an access token created in the sandbo
|
|
77
77
|
|
78
78
|
## Setting a custom `User-Agent` header
|
79
79
|
|
80
|
-
You customize the `User-Agent` header for the calls made to the DNSimple API:
|
80
|
+
You can customize the `User-Agent` header for the calls made to the DNSimple API:
|
81
81
|
|
82
82
|
```ruby
|
83
|
-
client = Dnsimple::Client.new(user_agent: "my-app")
|
83
|
+
client = Dnsimple::Client.new(user_agent: "my-app/1.0")
|
84
84
|
```
|
85
85
|
|
86
|
-
The value you provide will be
|
86
|
+
The value you provide will be prepended to the default `User-Agent` the client uses. For example, if you use `my-app/1.0`, the final header value will be `my-app/1.0 dnsimple-ruby/0.14.0` (note that it will vary depending on the client version).
|
87
|
+
|
88
|
+
We recommend to customize the user agent. If you are building a library or integration on top of the official client, customizing the client will help us to understand what is this client used for, and allow to contribute back or get in touch.
|
89
|
+
|
87
90
|
|
88
91
|
## License
|
89
92
|
|
90
|
-
Copyright (c) 2010-
|
93
|
+
Copyright (c) 2010-2020 DNSimple Corporation. This is Free Software distributed under the MIT license.
|
data/dnsimple.gemspec
CHANGED
@@ -5,13 +5,13 @@ require 'dnsimple/version'
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'dnsimple'
|
7
7
|
s.version = Dnsimple::VERSION
|
8
|
-
s.authors = ['
|
9
|
-
s.email = ['
|
8
|
+
s.authors = ['DNSimple']
|
9
|
+
s.email = ['support@dnsimple.com']
|
10
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
|
|
14
|
-
s.required_ruby_version = ">= 2.
|
14
|
+
s.required_ruby_version = ">= 2.4"
|
15
15
|
|
16
16
|
s.require_paths = ['lib']
|
17
17
|
s.files = `git ls-files`.split("\n")
|
data/lib/dnsimple.rb
CHANGED
data/lib/dnsimple/client.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'httparty'
|
2
4
|
require 'dnsimple/extra'
|
3
5
|
require 'dnsimple/struct'
|
@@ -23,10 +25,10 @@ module Dnsimple
|
|
23
25
|
# client = Dnsimple::Client.new(base_url: "https://api.sandbox.dnsimple.com", access_token: "abc")
|
24
26
|
class Client
|
25
27
|
|
26
|
-
HEADER_AUTHORIZATION = "Authorization"
|
28
|
+
HEADER_AUTHORIZATION = "Authorization"
|
27
29
|
|
28
30
|
# @return [String] The current API version.
|
29
|
-
API_VERSION = "v2"
|
31
|
+
API_VERSION = "v2"
|
30
32
|
|
31
33
|
|
32
34
|
# Prepends the correct API version to +path+.
|
@@ -61,7 +63,7 @@ module Dnsimple
|
|
61
63
|
def initialize(options = {})
|
62
64
|
defaults = Dnsimple::Default.options
|
63
65
|
|
64
|
-
Dnsimple::Default.keys.each do |key|
|
66
|
+
Dnsimple::Default.keys.each do |key| # rubocop:disable Style/HashEachMethods
|
65
67
|
instance_variable_set(:"@#{key}", options[key] || defaults[key])
|
66
68
|
end
|
67
69
|
|
@@ -204,10 +206,10 @@ module Dnsimple
|
|
204
206
|
|
205
207
|
def base_options
|
206
208
|
{
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
209
|
+
format: :json,
|
210
|
+
headers: {
|
211
|
+
"Accept" => "application/json",
|
212
|
+
},
|
211
213
|
}
|
212
214
|
end
|
213
215
|
|
@@ -234,15 +236,15 @@ module Dnsimple
|
|
234
236
|
# dnsimple-ruby/1.0
|
235
237
|
#
|
236
238
|
# If a custom user agent is provided, the final user agent is the combination
|
237
|
-
# of the
|
239
|
+
# of the default user agent prepended by the custom user agent.
|
238
240
|
#
|
239
|
-
# dnsimple-ruby/1.0
|
241
|
+
# customAgentFlag dnsimple-ruby/1.0
|
240
242
|
#
|
241
243
|
def format_user_agent
|
242
244
|
if user_agent.to_s.empty?
|
243
245
|
Dnsimple::Default::USER_AGENT
|
244
246
|
else
|
245
|
-
"#{Dnsimple::Default::USER_AGENT}
|
247
|
+
"#{user_agent} #{Dnsimple::Default::USER_AGENT}"
|
246
248
|
end
|
247
249
|
end
|
248
250
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dnsimple
|
2
4
|
class Client
|
3
5
|
module Registrar
|
@@ -114,6 +116,50 @@ module Dnsimple
|
|
114
116
|
Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
|
115
117
|
end
|
116
118
|
|
119
|
+
# Retrieves the details of an existing domain transfer.
|
120
|
+
#
|
121
|
+
# @see https://developer.dnsimple.com/v2/registrar/#getDomainTransfer
|
122
|
+
#
|
123
|
+
# @example Retrieve the transfer 42 for example.com:
|
124
|
+
# client.registrar.get_domain_transfer(1010, "example.com", 42)
|
125
|
+
#
|
126
|
+
# @param [Integer] account_id the account ID
|
127
|
+
# @param [#to_s] domain_name the domain name
|
128
|
+
# @param [Integer] domain_transfer_id the domain transfer ID
|
129
|
+
# @param [Hash] options
|
130
|
+
# @return [Struct::DomainTransfer]
|
131
|
+
#
|
132
|
+
# @raise [NotFoundError] When record is not found.
|
133
|
+
# @raise [RequestError] When the request fails.
|
134
|
+
def get_domain_transfer(account_id, domain_name, domain_transfer_id, options = {})
|
135
|
+
endpoint = Client.versioned("/%s/registrar/domains/%s/transfers/%s" % [account_id, domain_name, domain_transfer_id])
|
136
|
+
response = client.get(endpoint, options)
|
137
|
+
|
138
|
+
Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
|
139
|
+
end
|
140
|
+
|
141
|
+
# Cancels an in progress domain transfer.
|
142
|
+
#
|
143
|
+
# @see https://developer.dnsimple.com/v2/registrar/#cancelDomainTransfer
|
144
|
+
#
|
145
|
+
# @example Cancel the transfer 42 for example.com:
|
146
|
+
# client.registrar.cancel_domain_transfer(1010, "example.com", 42)
|
147
|
+
#
|
148
|
+
# @param [Integer] account_id the account ID
|
149
|
+
# @param [#to_s] domain_name the domain name
|
150
|
+
# @param [Integer] domain_transfer_id the domain transfer ID
|
151
|
+
# @param [Hash] options
|
152
|
+
# @return [Struct::DomainTransfer]
|
153
|
+
#
|
154
|
+
# @raise [NotFoundError] When record is not found.
|
155
|
+
# @raise [RequestError] When the request fails.
|
156
|
+
def cancel_domain_transfer(account_id, domain_name, domain_transfer_id, options = {})
|
157
|
+
endpoint = Client.versioned("/%s/registrar/domains/%s/transfers/%s" % [account_id, domain_name, domain_transfer_id])
|
158
|
+
response = client.delete(endpoint, options)
|
159
|
+
|
160
|
+
Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
|
161
|
+
end
|
162
|
+
|
117
163
|
# Requests the transfer of a domain out of DNSimple.
|
118
164
|
#
|
119
165
|
# @see https://developer.dnsimple.com/v2/registrar/#transfer-out
|
data/lib/dnsimple/client/tlds.rb
CHANGED
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dnsimple
|
2
4
|
class Client
|
3
5
|
module VanityNameServers
|
4
6
|
|
5
7
|
# Enable vanity name servers for the domain.
|
6
8
|
#
|
7
|
-
# @see https://developer.dnsimple.com/v2/vanity/#
|
9
|
+
# @see https://developer.dnsimple.com/v2/vanity/#enableVanityNameServers
|
8
10
|
#
|
9
11
|
# @example Enable vanity name servers for example.com:
|
10
|
-
# client.vanity_name_servers.
|
12
|
+
# client.vanity_name_servers.enable_vanity_name_servers(1010, "example.com")
|
11
13
|
#
|
12
|
-
# @param [Integer]
|
13
|
-
# @param [#to_s]
|
14
|
-
# @param [Hash]
|
14
|
+
# @param account_id [Integer] the account ID
|
15
|
+
# @param domain_name [#to_s] the domain name
|
16
|
+
# @param options [Hash]
|
15
17
|
# @return [Dnsimple::Response<Array>]
|
16
18
|
#
|
17
19
|
# @raise [RequestError] When the request fails.
|
@@ -24,14 +26,14 @@ module Dnsimple
|
|
24
26
|
|
25
27
|
# Disable vanity name servers for the domain.
|
26
28
|
#
|
27
|
-
# @see https://developer.dnsimple.com/v2/vanity/#
|
29
|
+
# @see https://developer.dnsimple.com/v2/vanity/#disableVanityNameServers
|
28
30
|
#
|
29
31
|
# @example Disable vanity name servers for example.com:
|
30
|
-
# client.vanity_name_servers.
|
32
|
+
# client.vanity_name_servers.disable_vanity_name_servers(1010, "example.com")
|
31
33
|
#
|
32
|
-
# @param [Integer]
|
33
|
-
# @param [#to_s]
|
34
|
-
# @param [Hash]
|
34
|
+
# @param account_id [Integer] the account ID
|
35
|
+
# @param domain_name [#to_s] the domain name
|
36
|
+
# @param options [Hash]
|
35
37
|
# @return [Dnsimple::Response<nil>]
|
36
38
|
#
|
37
39
|
# @raise [RequestError] When the request fails.
|
data/lib/dnsimple/default.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dnsimple
|
2
4
|
|
3
5
|
# Default configuration options for {Client}
|
4
6
|
module Default
|
5
7
|
|
6
8
|
# Default API endpoint
|
7
|
-
BASE_URL = "https://api.dnsimple.com/"
|
9
|
+
BASE_URL = "https://api.dnsimple.com/"
|
8
10
|
|
9
11
|
# Default User Agent header
|
10
|
-
USER_AGENT = "dnsimple-ruby/#{VERSION}"
|
12
|
+
USER_AGENT = "dnsimple-ruby/#{VERSION}"
|
11
13
|
|
12
14
|
class << self
|
13
15
|
|
@@ -15,13 +17,13 @@ module Dnsimple
|
|
15
17
|
# @return [Array] of option keys
|
16
18
|
def keys
|
17
19
|
@keys ||= [
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
:base_url,
|
21
|
+
:username,
|
22
|
+
:password,
|
23
|
+
:access_token,
|
24
|
+
:domain_api_token,
|
25
|
+
:user_agent,
|
26
|
+
:proxy,
|
25
27
|
]
|
26
28
|
end
|
27
29
|
|