dnsimple 4.6.0 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +12 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +9 -13
- data/.rubocop_dnsimple.yml +42 -40
- data/.rubocop_todo.yml +44 -5
- data/.travis.yml +14 -8
- data/CHANGELOG.md +56 -26
- data/CONTRIBUTING.md +43 -0
- data/Gemfile +6 -1
- data/LICENSE.txt +1 -1
- data/README.md +10 -7
- data/dnsimple.gemspec +3 -3
- data/lib/dnsimple.rb +2 -0
- data/lib/dnsimple/client.rb +23 -13
- data/lib/dnsimple/client/accounts.rb +2 -0
- data/lib/dnsimple/client/certificates.rb +2 -0
- data/lib/dnsimple/client/clients.rb +5 -2
- data/lib/dnsimple/client/contacts.rb +2 -0
- data/lib/dnsimple/client/domains.rb +3 -19
- 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 +69 -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 +3 -1
- 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 +12 -10
- data/lib/dnsimple/error.rb +3 -1
- data/lib/dnsimple/extra.rb +4 -2
- data/lib/dnsimple/options.rb +2 -0
- data/lib/dnsimple/response.rb +7 -7
- data/lib/dnsimple/struct.rb +3 -0
- data/lib/dnsimple/struct/account.rb +2 -0
- data/lib/dnsimple/struct/certificate.rb +4 -2
- 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 +4 -3
- data/lib/dnsimple/struct/domain_check.rb +2 -0
- data/lib/dnsimple/struct/domain_premium_price.rb +2 -0
- data/lib/dnsimple/struct/domain_price.rb +24 -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 +35 -33
- data/spec/dnsimple/client/client_service_spec.rb +3 -1
- data/spec/dnsimple/client/contacts_spec.rb +4 -2
- data/spec/dnsimple/client/domains_collaborators_spec.rb +4 -2
- data/spec/dnsimple/client/domains_delegation_signer_records_spec.rb +3 -1
- data/spec/dnsimple/client/domains_dnssec_spec.rb +2 -0
- data/spec/dnsimple/client/domains_email_forwards_spec.rb +10 -8
- data/spec/dnsimple/client/domains_pushes_spec.rb +4 -2
- data/spec/dnsimple/client/domains_spec.rb +16 -41
- 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 +4 -2
- data/spec/dnsimple/client/registrar_spec.rb +116 -4
- data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +2 -0
- data/spec/dnsimple/client/services_domains_spec.rb +4 -4
- data/spec/dnsimple/client/services_spec.rb +3 -3
- data/spec/dnsimple/client/templates_domains_spec.rb +2 -0
- data/spec/dnsimple/client/templates_records_spec.rb +3 -1
- data/spec/dnsimple/client/templates_spec.rb +4 -2
- 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 +3 -1
- data/spec/dnsimple/client/zones_distributions_spec.rb +2 -0
- data/spec/dnsimple/client/zones_records_spec.rb +4 -2
- data/spec/dnsimple/client/zones_spec.rb +3 -1
- data/spec/dnsimple/client_spec.rb +18 -16
- 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 +6 -4
- data/spec/fixtures.http/accounts/success-account.http +0 -1
- data/spec/fixtures.http/accounts/success-user.http +0 -1
- data/spec/fixtures.http/addCollaborator/invite-success.http +0 -1
- data/spec/fixtures.http/addCollaborator/success.http +0 -1
- data/spec/fixtures.http/appliedServices/success.http +0 -1
- data/spec/fixtures.http/cancelDomainTransfer/success.http +18 -0
- data/spec/fixtures.http/changeDomainDelegation/success.http +0 -1
- data/spec/fixtures.http/changeDomainDelegationToVanity/success.http +0 -1
- data/spec/fixtures.http/checkDomain/success.http +0 -1
- data/spec/fixtures.http/checkDomainPremiumPrice/error_400_not_a_premium_domain.http +18 -0
- data/spec/fixtures.http/checkDomainPremiumPrice/error_400_tld_not_supported.http +18 -0
- data/spec/fixtures.http/checkDomainPremiumPrice/success.http +20 -0
- data/spec/fixtures.http/checkZoneDistribution/error.http +0 -1
- data/spec/fixtures.http/checkZoneDistribution/failure.http +0 -1
- data/spec/fixtures.http/checkZoneDistribution/success.http +0 -1
- data/spec/fixtures.http/checkZoneRecordDistribution/error.http +0 -1
- data/spec/fixtures.http/checkZoneRecordDistribution/failure.http +0 -1
- data/spec/fixtures.http/checkZoneRecordDistribution/success.http +0 -1
- data/spec/fixtures.http/createContact/created.http +0 -1
- data/spec/fixtures.http/createDelegationSignerRecord/created.http +0 -1
- data/spec/fixtures.http/createDelegationSignerRecord/validation-error.http +0 -1
- data/spec/fixtures.http/createDomain/created.http +20 -16
- data/spec/fixtures.http/createEmailForward/created.http +21 -17
- data/spec/fixtures.http/createPrimaryServer/created.http +21 -0
- data/spec/fixtures.http/createSecondaryZone/created.http +21 -0
- data/spec/fixtures.http/createTemplate/created.http +0 -1
- data/spec/fixtures.http/createTemplateRecord/created.http +0 -1
- data/spec/fixtures.http/createWebhook/created.http +0 -1
- data/spec/fixtures.http/createZoneRecord/created-apex.http +0 -1
- data/spec/fixtures.http/createZoneRecord/created.http +0 -1
- data/spec/fixtures.http/deleteContact/error-contact-in-use.http +18 -0
- data/spec/fixtures.http/deleteEmailForward/success.http +12 -7
- data/spec/fixtures.http/disableDnssec/not-enabled.http +0 -1
- data/spec/fixtures.http/disableWhoisPrivacy/success.http +0 -1
- data/spec/fixtures.http/downloadCertificate/success.http +0 -1
- data/spec/fixtures.http/enableDnssec/success.http +0 -1
- data/spec/fixtures.http/enableVanityNameServers/success.http +0 -1
- data/spec/fixtures.http/enableWhoisPrivacy/created.http +0 -1
- data/spec/fixtures.http/enableWhoisPrivacy/success.http +0 -1
- data/spec/fixtures.http/getCertificate/success.http +10 -11
- data/spec/fixtures.http/getCertificatePrivateKey/success.http +0 -1
- data/spec/fixtures.http/getContact/success.http +0 -1
- data/spec/fixtures.http/getDelegationSignerRecord/success.http +0 -1
- data/spec/fixtures.http/getDnssec/success.http +0 -1
- data/spec/fixtures.http/getDomain/success.http +13 -9
- data/spec/fixtures.http/getDomainDelegation/success-empty.http +0 -1
- data/spec/fixtures.http/getDomainDelegation/success.http +0 -1
- data/spec/fixtures.http/getDomainPremiumPrice/failure.http +0 -1
- data/spec/fixtures.http/getDomainPremiumPrice/success.http +0 -1
- data/spec/fixtures.http/getDomainPrices/failure.http +19 -0
- data/spec/fixtures.http/getDomainPrices/success.http +21 -0
- data/spec/fixtures.http/getDomainTransfer/success.http +20 -0
- data/spec/fixtures.http/getEmailForward/success.http +14 -10
- data/spec/fixtures.http/getPrimaryServer/success.http +21 -0
- data/spec/fixtures.http/getService/success.http +0 -1
- data/spec/fixtures.http/getTemplate/success.http +0 -1
- data/spec/fixtures.http/getTemplateRecord/success.http +0 -1
- data/spec/fixtures.http/getTld/success.http +0 -1
- data/spec/fixtures.http/getTldExtendedAttributes/success-attributes.http +0 -1
- data/spec/fixtures.http/getTldExtendedAttributes/success-noattributes.http +0 -1
- data/spec/fixtures.http/getTldExtendedAttributes/success.http +0 -1
- data/spec/fixtures.http/getWebhook/success.http +0 -1
- data/spec/fixtures.http/getWhoisPrivacy/success.http +0 -1
- data/spec/fixtures.http/getZone/success.http +0 -1
- data/spec/fixtures.http/getZoneFile/success.http +0 -1
- data/spec/fixtures.http/getZoneRecord/success.http +0 -1
- data/spec/fixtures.http/initiatePush/success.http +0 -1
- data/spec/fixtures.http/issueLetsencryptCertificate/success.http +18 -21
- data/spec/fixtures.http/issueRenewalLetsencryptCertificate/success.http +18 -21
- data/spec/fixtures.http/linkPrimaryServer/success.http +21 -0
- data/spec/fixtures.http/listAccounts/success-account.http +0 -1
- data/spec/fixtures.http/listAccounts/success-user.http +0 -1
- data/spec/fixtures.http/listCertificates/success.http +10 -11
- data/spec/fixtures.http/listCollaborators/success.http +0 -1
- data/spec/fixtures.http/listContacts/success.http +0 -1
- data/spec/fixtures.http/listDelegationSignerRecords/success.http +0 -1
- data/spec/fixtures.http/listDomains/success.http +20 -16
- data/spec/fixtures.http/listEmailForwards/success.http +0 -1
- data/spec/fixtures.http/listPrimaryServers/success.http +21 -0
- data/spec/fixtures.http/listPushes/success.http +0 -1
- data/spec/fixtures.http/listServices/success.http +0 -1
- data/spec/fixtures.http/listTemplateRecords/success.http +0 -1
- data/spec/fixtures.http/listTemplates/success.http +0 -1
- data/spec/fixtures.http/listTlds/success.http +0 -1
- data/spec/fixtures.http/listWebhooks/success.http +0 -1
- data/spec/fixtures.http/listZoneRecords/success.http +0 -1
- data/spec/fixtures.http/listZones/success.http +0 -1
- data/spec/fixtures.http/method-not-allowed.http +0 -1
- data/spec/fixtures.http/notfound-certificate.http +0 -1
- data/spec/fixtures.http/notfound-collaborator.http +0 -1
- data/spec/fixtures.http/notfound-contact.http +0 -1
- data/spec/fixtures.http/notfound-delegationsignerrecord.http +0 -1
- data/spec/fixtures.http/notfound-domain.http +0 -1
- data/spec/fixtures.http/notfound-domainpush.http +0 -1
- data/spec/fixtures.http/notfound-emailforward.http +0 -1
- data/spec/fixtures.http/notfound-record.http +0 -1
- data/spec/fixtures.http/notfound-template.http +0 -1
- data/spec/fixtures.http/notfound-webhook.http +0 -1
- data/spec/fixtures.http/notfound-whoisprivacy.http +0 -1
- data/spec/fixtures.http/notfound-zone.http +0 -1
- data/spec/fixtures.http/oauthAccessToken/error-invalid-request.http +0 -1
- data/spec/fixtures.http/oauthAccessToken/success.http +0 -1
- data/spec/fixtures.http/pages-1of3.http +0 -1
- data/spec/fixtures.http/pages-2of3.http +0 -1
- data/spec/fixtures.http/pages-3of3.http +0 -1
- data/spec/fixtures.http/purchaseLetsencryptCertificate/success.http +20 -21
- data/spec/fixtures.http/purchaseRenewalLetsencryptCertificate/success.http +20 -21
- data/spec/fixtures.http/registerDomain/success.http +1 -2
- data/spec/fixtures.http/renewDomain/error-tooearly.http +0 -1
- data/spec/fixtures.http/renewDomain/success.http +1 -2
- data/spec/fixtures.http/renewWhoisPrivacy/success.http +0 -1
- data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http +1 -2
- data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http +1 -2
- data/spec/fixtures.http/response.http +0 -1
- data/spec/fixtures.http/transferDomain/error-indnsimple.http +0 -1
- data/spec/fixtures.http/transferDomain/error-missing-authcode.http +0 -1
- data/spec/fixtures.http/transferDomain/success.http +1 -2
- data/spec/fixtures.http/unlinkPrimaryServer/success.http +21 -0
- data/spec/fixtures.http/updateContact/success.http +0 -1
- data/spec/fixtures.http/updateTemplate/success.http +0 -1
- data/spec/fixtures.http/updateZoneRecord/success.http +0 -1
- data/spec/fixtures.http/validation-error.http +0 -1
- data/spec/fixtures.http/whoami/success-account.http +0 -1
- data/spec/fixtures.http/whoami/success-user.http +0 -1
- data/spec/fixtures.http/whoami/success.http +0 -1
- data/spec/spec_helper.rb +3 -1
- data/spec/support/helpers.rb +2 -0
- data/spec/support/webmock.rb +2 -0
- metadata +36 -15
- data/.ruby-gemset +0 -1
- data/spec/fixtures.http/resetDomainToken/success.http +0 -17
data/CONTRIBUTING.md
CHANGED
@@ -24,6 +24,49 @@ bundle
|
|
24
24
|
[Run the test suite](#testing) to check everything works as expected.
|
25
25
|
|
26
26
|
|
27
|
+
## Releasing
|
28
|
+
|
29
|
+
The following instructions uses `$VERSION` as a placeholder, where `$VERSION` is a `MAJOR.MINOR.BUGFIX` release such as `1.2.0`.
|
30
|
+
|
31
|
+
1. Set the version in `version.rb`:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
VERSION = "$VERSION"
|
35
|
+
```
|
36
|
+
|
37
|
+
1. Run the test suite and ensure all the tests pass.
|
38
|
+
|
39
|
+
1. Finalize the `## main` section in `CHANGELOG.md` assigning the version.
|
40
|
+
|
41
|
+
1. Commit and push the changes
|
42
|
+
|
43
|
+
```shell
|
44
|
+
git commit -a -m "Release $VERSION"
|
45
|
+
git push origin main
|
46
|
+
```
|
47
|
+
|
48
|
+
1. Wait for CI to complete.
|
49
|
+
|
50
|
+
1. Create a signed tag.
|
51
|
+
|
52
|
+
```shell
|
53
|
+
git tag -a v$VERSION -s -m "Release $VERSION"
|
54
|
+
git push origin --tags
|
55
|
+
```
|
56
|
+
|
57
|
+
1. Build the package.
|
58
|
+
|
59
|
+
```shell
|
60
|
+
rake build
|
61
|
+
```
|
62
|
+
|
63
|
+
1. Release to RubyGems.
|
64
|
+
|
65
|
+
```shell
|
66
|
+
gem push pkg/<filename>
|
67
|
+
```
|
68
|
+
|
69
|
+
|
27
70
|
## Testing
|
28
71
|
|
29
72
|
To run the test suite:
|
data/Gemfile
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
gemspec
|
4
6
|
|
5
7
|
gem 'coveralls', require: false
|
6
|
-
gem 'rubocop', require: false
|
8
|
+
gem 'rubocop', '1.16.0', require: false
|
9
|
+
gem 'rubocop-performance', require: false
|
10
|
+
gem 'rubocop-rake', require: false
|
11
|
+
gem 'rubocop-rspec', require: false
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2010-
|
3
|
+
Copyright (c) 2010-2021 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,8 +2,8 @@
|
|
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.
|
6
|
-
[![Coverage Status](https://img.shields.io/coveralls/dnsimple/dnsimple-ruby.svg)](https://coveralls.io/r/dnsimple/dnsimple-ruby?branch=
|
5
|
+
[![Build Status](https://travis-ci.com/dnsimple/dnsimple-ruby.svg?branch=main)](https://travis-ci.com/dnsimple/dnsimple-ruby)
|
6
|
+
[![Coverage Status](https://img.shields.io/coveralls/dnsimple/dnsimple-ruby.svg)](https://coveralls.io/r/dnsimple/dnsimple-ruby?branch=main)
|
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.
|
@@ -20,7 +20,7 @@ gem install dnsimple
|
|
20
20
|
Or use Bundler and define it as a dependency in your Gemfile:
|
21
21
|
|
22
22
|
```
|
23
|
-
gem 'dnsimple', '~>
|
23
|
+
gem 'dnsimple', '~> 6.0'
|
24
24
|
```
|
25
25
|
|
26
26
|
## Usage
|
@@ -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-2021 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.6"
|
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+.
|
@@ -40,28 +42,36 @@ module Dnsimple
|
|
40
42
|
# @!attribute username
|
41
43
|
# @see https://developer.dnsimple.com/v2/#authentication
|
42
44
|
# @return [String] DNSimple username for Basic Authentication
|
45
|
+
attr_accessor :username
|
46
|
+
|
43
47
|
# @!attribute password
|
44
48
|
# @see https://developer.dnsimple.com/v2/#authentication
|
45
49
|
# @return [String] DNSimple password for Basic Authentication
|
50
|
+
attr_accessor :password
|
51
|
+
|
46
52
|
# @!attribute domain_api_token
|
47
53
|
# @see https://developer.dnsimple.com/v2/#authentication
|
48
54
|
# @return [String] Domain API access token for authentication
|
55
|
+
attr_accessor :domain_api_token
|
56
|
+
|
49
57
|
# @!attribute access_token
|
50
58
|
# @see https://developer.dnsimple.com/v2/#authentication
|
51
59
|
# @return [String] Domain API access token for authentication
|
60
|
+
attr_accessor :access_token
|
61
|
+
|
52
62
|
# @!attribute user_agent
|
53
63
|
# @return [String] Configure User-Agent header for requests.
|
64
|
+
attr_accessor :user_agent
|
65
|
+
|
54
66
|
# @!attribute proxy
|
55
67
|
# @return [String,nil] Configure address:port values for proxy server
|
56
|
-
|
57
|
-
attr_accessor :username, :password, :domain_api_token, :access_token,
|
58
|
-
:user_agent, :proxy
|
68
|
+
attr_accessor :proxy
|
59
69
|
|
60
70
|
|
61
71
|
def initialize(options = {})
|
62
72
|
defaults = Dnsimple::Default.options
|
63
73
|
|
64
|
-
Dnsimple::Default.keys.each do |key|
|
74
|
+
Dnsimple::Default.keys.each do |key| # rubocop:disable Style/HashEachMethods
|
65
75
|
instance_variable_set(:"@#{key}", options[key] || defaults[key])
|
66
76
|
end
|
67
77
|
|
@@ -204,10 +214,10 @@ module Dnsimple
|
|
204
214
|
|
205
215
|
def base_options
|
206
216
|
{
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
217
|
+
format: :json,
|
218
|
+
headers: {
|
219
|
+
"Accept" => "application/json",
|
220
|
+
},
|
211
221
|
}
|
212
222
|
end
|
213
223
|
|
@@ -234,15 +244,15 @@ module Dnsimple
|
|
234
244
|
# dnsimple-ruby/1.0
|
235
245
|
#
|
236
246
|
# If a custom user agent is provided, the final user agent is the combination
|
237
|
-
# of the
|
247
|
+
# of the default user agent prepended by the custom user agent.
|
238
248
|
#
|
239
|
-
# dnsimple-ruby/1.0
|
249
|
+
# customAgentFlag dnsimple-ruby/1.0
|
240
250
|
#
|
241
251
|
def format_user_agent
|
242
252
|
if user_agent.to_s.empty?
|
243
253
|
Dnsimple::Default::USER_AGENT
|
244
254
|
else
|
245
|
-
"#{Dnsimple::Default::USER_AGENT}
|
255
|
+
"#{user_agent} #{Dnsimple::Default::USER_AGENT}"
|
246
256
|
end
|
247
257
|
end
|
248
258
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dnsimple
|
2
4
|
class Client
|
3
5
|
|
@@ -96,14 +98,15 @@ module Dnsimple
|
|
96
98
|
options = args.pop
|
97
99
|
response = nil
|
98
100
|
|
99
|
-
|
101
|
+
loop do
|
100
102
|
current_page += 1
|
101
103
|
query = Extra.deep_merge(options, query: { page: current_page, per_page: 100 })
|
102
104
|
|
103
105
|
response = send(method, *(args + [query]))
|
104
106
|
total_pages ||= response.total_pages
|
105
107
|
collection.concat(response.data)
|
106
|
-
|
108
|
+
break unless current_page < total_pages
|
109
|
+
end
|
107
110
|
|
108
111
|
CollectionResponse.new(response.http_response, collection)
|
109
112
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dnsimple
|
2
4
|
class Client
|
3
5
|
module Domains
|
@@ -14,7 +16,7 @@ module Dnsimple
|
|
14
16
|
# client.domains.list(1010, page: 2)
|
15
17
|
#
|
16
18
|
# @example List domains, provide a sorting policy
|
17
|
-
# client.domains.list(1010, sort: "
|
19
|
+
# client.domains.list(1010, sort: "expiration:asc")
|
18
20
|
#
|
19
21
|
# @example List domains, provide a filtering policy
|
20
22
|
# client.domains.list(1010, filter: { name_like: "example" })
|
@@ -112,24 +114,6 @@ module Dnsimple
|
|
112
114
|
|
113
115
|
Dnsimple::Response.new(response, nil)
|
114
116
|
end
|
115
|
-
|
116
|
-
# Resets the domain token.
|
117
|
-
#
|
118
|
-
# @see https://developer.dnsimple.com/v2/domains/#reset-token
|
119
|
-
#
|
120
|
-
# @param [Integer] account_id the account ID
|
121
|
-
# @param [#to_s] domain_id The domain ID or domain name
|
122
|
-
# @param [Hash] options
|
123
|
-
# @return [Dnsimple::Response<nil>]
|
124
|
-
#
|
125
|
-
# @raise [Dnsimple::NotFoundError]
|
126
|
-
# @raise [Dnsimple::RequestError]
|
127
|
-
def reset_domain_token(account_id, domain_id, options = {})
|
128
|
-
response = client.post(Client.versioned("/%s/domains/%s/token" % [account_id, domain_id]), nil, options)
|
129
|
-
|
130
|
-
Dnsimple::Response.new(response, Struct::Domain.new(response["data"]))
|
131
|
-
end
|
132
|
-
|
133
117
|
end
|
134
118
|
end
|
135
119
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dnsimple
|
2
4
|
class Client
|
3
5
|
module Registrar
|
@@ -40,7 +42,10 @@ module Dnsimple
|
|
40
42
|
# @return [Struct::DomainPremiumPrice]
|
41
43
|
#
|
42
44
|
# @raise [RequestError] When the request fails.
|
45
|
+
#
|
46
|
+
# @deprecated Use {#get_domain_prices} instead of this one as it will soon be removed from the API.
|
43
47
|
def domain_premium_price(account_id, domain_name, options = {})
|
48
|
+
Dnsimple.deprecate("Use {#get_domain_prices} instead of this one as it will soon be removed from the API.")
|
44
49
|
endpoint = Client.versioned("/%s/registrar/domains/%s/premium_price" % [account_id, domain_name])
|
45
50
|
options[:query] = { action: options.delete(:action) } if options.key?(:action)
|
46
51
|
response = client.get(endpoint, options)
|
@@ -48,6 +53,26 @@ module Dnsimple
|
|
48
53
|
Dnsimple::Response.new(response, Struct::DomainPremiumPrice.new(response["data"]))
|
49
54
|
end
|
50
55
|
|
56
|
+
# Get prices for a domain.
|
57
|
+
# @see https://developer.dnsimple.com/v2/registrar/#getDomainPrices
|
58
|
+
#
|
59
|
+
# @example Check prices for example.com:
|
60
|
+
# client.registrar.get_domain_prices(1010, "example.com")
|
61
|
+
#
|
62
|
+
# @param [Integer] account_id the Account id
|
63
|
+
# @param [String] domain_name the domain name to find the prices
|
64
|
+
# @param [Hash] options
|
65
|
+
#
|
66
|
+
# @return [Struct::DomainPrice]
|
67
|
+
#
|
68
|
+
# @raise [RequestError] When the request fails.
|
69
|
+
def get_domain_prices(account_id, domain_name, options = {})
|
70
|
+
endpoint = Client.versioned("/%s/registrar/domains/%s/prices" % [account_id, domain_name])
|
71
|
+
response = client.get(endpoint, options)
|
72
|
+
|
73
|
+
Dnsimple::Response.new(response, Struct::DomainPrice.new(response["data"]))
|
74
|
+
end
|
75
|
+
|
51
76
|
# Registers a domain.
|
52
77
|
#
|
53
78
|
# @see https://developer.dnsimple.com/v2/registrar/#register
|
@@ -114,6 +139,50 @@ module Dnsimple
|
|
114
139
|
Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
|
115
140
|
end
|
116
141
|
|
142
|
+
# Retrieves the details of an existing domain transfer.
|
143
|
+
#
|
144
|
+
# @see https://developer.dnsimple.com/v2/registrar/#getDomainTransfer
|
145
|
+
#
|
146
|
+
# @example Retrieve the transfer 42 for example.com:
|
147
|
+
# client.registrar.get_domain_transfer(1010, "example.com", 42)
|
148
|
+
#
|
149
|
+
# @param [Integer] account_id the account ID
|
150
|
+
# @param [#to_s] domain_name the domain name
|
151
|
+
# @param [Integer] domain_transfer_id the domain transfer ID
|
152
|
+
# @param [Hash] options
|
153
|
+
# @return [Struct::DomainTransfer]
|
154
|
+
#
|
155
|
+
# @raise [NotFoundError] When record is not found.
|
156
|
+
# @raise [RequestError] When the request fails.
|
157
|
+
def get_domain_transfer(account_id, domain_name, domain_transfer_id, options = {})
|
158
|
+
endpoint = Client.versioned("/%s/registrar/domains/%s/transfers/%s" % [account_id, domain_name, domain_transfer_id])
|
159
|
+
response = client.get(endpoint, options)
|
160
|
+
|
161
|
+
Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
|
162
|
+
end
|
163
|
+
|
164
|
+
# Cancels an in progress domain transfer.
|
165
|
+
#
|
166
|
+
# @see https://developer.dnsimple.com/v2/registrar/#cancelDomainTransfer
|
167
|
+
#
|
168
|
+
# @example Cancel the transfer 42 for example.com:
|
169
|
+
# client.registrar.cancel_domain_transfer(1010, "example.com", 42)
|
170
|
+
#
|
171
|
+
# @param [Integer] account_id the account ID
|
172
|
+
# @param [#to_s] domain_name the domain name
|
173
|
+
# @param [Integer] domain_transfer_id the domain transfer ID
|
174
|
+
# @param [Hash] options
|
175
|
+
# @return [Struct::DomainTransfer]
|
176
|
+
#
|
177
|
+
# @raise [NotFoundError] When record is not found.
|
178
|
+
# @raise [RequestError] When the request fails.
|
179
|
+
def cancel_domain_transfer(account_id, domain_name, domain_transfer_id, options = {})
|
180
|
+
endpoint = Client.versioned("/%s/registrar/domains/%s/transfers/%s" % [account_id, domain_name, domain_transfer_id])
|
181
|
+
response = client.delete(endpoint, options)
|
182
|
+
|
183
|
+
Dnsimple::Response.new(response, Struct::DomainTransfer.new(response["data"]))
|
184
|
+
end
|
185
|
+
|
117
186
|
# Requests the transfer of a domain out of DNSimple.
|
118
187
|
#
|
119
188
|
# @see https://developer.dnsimple.com/v2/registrar/#transfer-out
|