dnsimple 11.1.0 → 12.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/.github/workflows/ci.yml +10 -5
- data/.github/workflows/release.yml +44 -13
- data/.github/workflows/sync-test-fixtures.yml +1 -1
- data/.rubocop.yml +4 -1
- data/.rubocop_dnsimple.yml +13 -41
- data/.rubocop_todo.yml +4 -9
- data/CHANGELOG.md +285 -183
- data/CONTRIBUTING.md +6 -40
- data/Gemfile +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +49 -40
- data/RELEASING.md +67 -0
- data/dnsimple.gemspec +1 -1
- data/lib/dnsimple/client/accounts.rb +1 -3
- data/lib/dnsimple/client/billing.rb +2 -4
- data/lib/dnsimple/client/certificates.rb +0 -2
- data/lib/dnsimple/client/clients.rb +2 -40
- data/lib/dnsimple/client/contacts.rb +17 -19
- data/lib/dnsimple/client/dns_analytics.rb +2 -4
- data/lib/dnsimple/client/domains.rb +13 -15
- data/lib/dnsimple/client/domains_delegation_signer_records.rb +18 -20
- data/lib/dnsimple/client/domains_dnssec.rb +9 -11
- data/lib/dnsimple/client/domains_email_forwards.rb +18 -20
- data/lib/dnsimple/client/domains_pushes.rb +13 -15
- data/lib/dnsimple/client/identity.rb +4 -9
- data/lib/dnsimple/client/oauth.rb +1 -3
- data/lib/dnsimple/client/registrar.rb +45 -47
- data/lib/dnsimple/client/registrar_auto_renewal.rb +6 -8
- data/lib/dnsimple/client/registrar_delegation.rb +14 -16
- data/lib/dnsimple/client/registrar_registrant_changes.rb +14 -16
- data/lib/dnsimple/client/registrar_transfer_lock.rb +9 -11
- data/lib/dnsimple/client/registrar_whois_privacy.rb +6 -48
- data/lib/dnsimple/client/services.rb +4 -6
- data/lib/dnsimple/client/services_domains.rb +12 -14
- data/lib/dnsimple/client/templates.rb +17 -19
- data/lib/dnsimple/client/templates_domains.rb +4 -6
- data/lib/dnsimple/client/templates_records.rb +18 -20
- data/lib/dnsimple/client/tlds.rb +6 -8
- data/lib/dnsimple/client/vanity_name_servers.rb +0 -2
- data/lib/dnsimple/client/webhooks.rb +11 -13
- data/lib/dnsimple/client/zones.rb +16 -18
- data/lib/dnsimple/client/zones_distributions.rb +4 -6
- data/lib/dnsimple/client/zones_records.rb +29 -31
- data/lib/dnsimple/client.rb +22 -24
- data/lib/dnsimple/default.rb +0 -4
- data/lib/dnsimple/error.rb +0 -6
- data/lib/dnsimple/extra.rb +4 -6
- data/lib/dnsimple/options.rb +1 -7
- data/lib/dnsimple/response.rb +4 -13
- data/lib/dnsimple/struct/account.rb +0 -2
- data/lib/dnsimple/struct/certificate.rb +0 -2
- data/lib/dnsimple/struct/certificate_bundle.rb +0 -2
- data/lib/dnsimple/struct/certificate_purchase.rb +0 -2
- data/lib/dnsimple/struct/certificate_renewal.rb +0 -2
- data/lib/dnsimple/struct/charge.rb +4 -8
- data/lib/dnsimple/struct/collaborator.rb +0 -2
- data/lib/dnsimple/struct/contact.rb +0 -2
- data/lib/dnsimple/struct/delegation_signer_record.rb +0 -2
- data/lib/dnsimple/struct/dns_analytics.rb +0 -2
- data/lib/dnsimple/struct/dnssec.rb +0 -2
- data/lib/dnsimple/struct/domain.rb +0 -2
- data/lib/dnsimple/struct/domain_check.rb +0 -2
- data/lib/dnsimple/struct/domain_premium_price.rb +0 -2
- data/lib/dnsimple/struct/domain_price.rb +0 -2
- data/lib/dnsimple/struct/domain_push.rb +0 -2
- data/lib/dnsimple/struct/domain_registration.rb +0 -2
- data/lib/dnsimple/struct/domain_renewal.rb +0 -2
- data/lib/dnsimple/struct/domain_restore.rb +0 -2
- data/lib/dnsimple/struct/domain_transfer.rb +0 -2
- data/lib/dnsimple/struct/email_forward.rb +0 -2
- data/lib/dnsimple/struct/extended_attribute.rb +0 -4
- data/lib/dnsimple/struct/oauth_token.rb +0 -2
- data/lib/dnsimple/struct/registrant_change.rb +0 -2
- data/lib/dnsimple/struct/registrant_change_check.rb +0 -2
- data/lib/dnsimple/struct/service.rb +0 -4
- data/lib/dnsimple/struct/template.rb +0 -2
- data/lib/dnsimple/struct/template_record.rb +0 -2
- data/lib/dnsimple/struct/tld.rb +0 -2
- data/lib/dnsimple/struct/transfer_lock.rb +0 -2
- data/lib/dnsimple/struct/user.rb +0 -2
- data/lib/dnsimple/struct/vanity_name_server.rb +0 -2
- data/lib/dnsimple/struct/webhook.rb +0 -2
- data/lib/dnsimple/struct/whoami.rb +2 -4
- data/lib/dnsimple/struct/whois_privacy.rb +0 -2
- data/lib/dnsimple/struct/zone.rb +0 -2
- data/lib/dnsimple/struct/zone_distribution.rb +0 -2
- data/lib/dnsimple/struct/zone_file.rb +0 -2
- data/lib/dnsimple/struct/zone_record.rb +0 -2
- data/lib/dnsimple/struct/zone_record_id.rb +0 -2
- data/lib/dnsimple/struct/zone_records_batch_change.rb +0 -2
- data/lib/dnsimple/struct.rb +0 -3
- data/lib/dnsimple/version.rb +1 -3
- data/lib/dnsimple.rb +1 -3
- data/spec/dnsimple/client/client_service_spec.rb +12 -10
- data/spec/dnsimple/client/oauth_spec.rb +6 -6
- data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +0 -82
- data/spec/fixtures.http/acceptPush/success.http +15 -15
- data/spec/fixtures.http/accounts/success-account.http +20 -20
- data/spec/fixtures.http/accounts/success-user.http +21 -21
- data/spec/fixtures.http/activateZoneService/success.http +16 -16
- data/spec/fixtures.http/appliedServices/success.http +19 -19
- data/spec/fixtures.http/applyService/success.http +15 -15
- data/spec/fixtures.http/applyTemplate/success.http +13 -13
- data/spec/fixtures.http/authorizeDomainTransferOut/success.http +13 -13
- data/spec/fixtures.http/badgateway.http +5 -5
- data/spec/fixtures.http/batchChangeZoneRecords/error_400_create_validation_failed.http +16 -16
- data/spec/fixtures.http/batchChangeZoneRecords/error_400_delete_validation_failed.http +3 -3
- data/spec/fixtures.http/batchChangeZoneRecords/error_400_update_validation_failed.http +3 -3
- data/spec/fixtures.http/batchChangeZoneRecords/success.http +16 -16
- data/spec/fixtures.http/cancelDomainTransfer/success.http +17 -17
- data/spec/fixtures.http/changeDomainDelegation/success.http +15 -15
- data/spec/fixtures.http/changeDomainDelegationFromVanity/success.http +15 -15
- data/spec/fixtures.http/changeDomainDelegationToVanity/success.http +17 -17
- data/spec/fixtures.http/checkDomain/success.http +15 -15
- data/spec/fixtures.http/checkRegistrantChange/error-contactnotfound.http +3 -3
- data/spec/fixtures.http/checkRegistrantChange/error-domainnotfound.http +3 -3
- data/spec/fixtures.http/checkRegistrantChange/success.http +15 -15
- data/spec/fixtures.http/checkZoneDistribution/error.http +17 -17
- data/spec/fixtures.http/checkZoneDistribution/failure.http +17 -17
- data/spec/fixtures.http/checkZoneDistribution/success.http +17 -17
- data/spec/fixtures.http/checkZoneRecordDistribution/error.http +17 -17
- data/spec/fixtures.http/checkZoneRecordDistribution/failure.http +17 -17
- data/spec/fixtures.http/checkZoneRecordDistribution/success.http +17 -17
- data/spec/fixtures.http/createContact/created.http +16 -16
- data/spec/fixtures.http/createContact/error-validation-errors.http +15 -15
- data/spec/fixtures.http/createDelegationSignerRecord/created.http +17 -17
- data/spec/fixtures.http/createDelegationSignerRecord/validation-error.http +15 -15
- data/spec/fixtures.http/createDomain/created.http +19 -19
- data/spec/fixtures.http/createEmailForward/created.http +21 -21
- data/spec/fixtures.http/createPrimaryServer/created.http +20 -20
- data/spec/fixtures.http/createRegistrantChange/success.http +14 -14
- data/spec/fixtures.http/createSecondaryZone/created.http +20 -20
- data/spec/fixtures.http/createTemplate/created.http +15 -15
- data/spec/fixtures.http/createTemplateRecord/created.http +16 -16
- data/spec/fixtures.http/createWebhook/created.http +13 -13
- data/spec/fixtures.http/createZoneRecord/created-apex.http +13 -13
- data/spec/fixtures.http/createZoneRecord/created.http +13 -13
- data/spec/fixtures.http/deactivateZoneService/success.http +16 -16
- data/spec/fixtures.http/deleteContact/error-contact-in-use.http +15 -15
- data/spec/fixtures.http/deleteContact/success.http +13 -13
- data/spec/fixtures.http/deleteDelegationSignerRecord/success.http +15 -15
- data/spec/fixtures.http/deleteDomain/success.http +11 -11
- data/spec/fixtures.http/deleteEmailForward/success.http +18 -18
- data/spec/fixtures.http/deleteRegistrantChange/success.http +13 -13
- data/spec/fixtures.http/deleteRegistrantChange/success_async.http +3 -3
- data/spec/fixtures.http/deleteTemplate/success.http +13 -13
- data/spec/fixtures.http/deleteTemplateRecord/success.http +13 -13
- data/spec/fixtures.http/deleteWebhook/success.http +13 -13
- data/spec/fixtures.http/deleteZoneRecord/success.http +11 -11
- data/spec/fixtures.http/disableDnssec/not-enabled.http +15 -15
- data/spec/fixtures.http/disableDnssec/success.http +15 -15
- data/spec/fixtures.http/disableDomainAutoRenewal/success.http +13 -13
- data/spec/fixtures.http/disableDomainTransferLock/success.http +17 -17
- data/spec/fixtures.http/disableVanityNameServers/success.http +15 -15
- data/spec/fixtures.http/disableWhoisPrivacy/success.http +16 -16
- data/spec/fixtures.http/dnsAnalytics/success.http +17 -17
- data/spec/fixtures.http/downloadCertificate/success.http +19 -19
- data/spec/fixtures.http/enableDnssec/success.http +17 -17
- data/spec/fixtures.http/enableDomainAutoRenewal/success.http +13 -13
- data/spec/fixtures.http/enableDomainTransferLock/success.http +17 -17
- data/spec/fixtures.http/enableVanityNameServers/success.http +17 -17
- data/spec/fixtures.http/enableWhoisPrivacy/created.http +16 -16
- data/spec/fixtures.http/enableWhoisPrivacy/success.http +16 -16
- data/spec/fixtures.http/getCertificate/success.http +19 -19
- data/spec/fixtures.http/getCertificatePrivateKey/success.http +20 -20
- data/spec/fixtures.http/getContact/success.http +16 -16
- data/spec/fixtures.http/getDelegationSignerRecord/success.http +17 -17
- data/spec/fixtures.http/getDnssec/success.http +17 -17
- data/spec/fixtures.http/getDomain/success.http +19 -19
- data/spec/fixtures.http/getDomainDelegation/success-empty.http +15 -15
- data/spec/fixtures.http/getDomainDelegation/success.http +15 -15
- data/spec/fixtures.http/getDomainPrices/failure.http +18 -18
- data/spec/fixtures.http/getDomainPrices/success.http +21 -21
- data/spec/fixtures.http/getDomainRegistration/success.http +20 -20
- data/spec/fixtures.http/getDomainRenewal/success.http +20 -20
- data/spec/fixtures.http/getDomainRestore/success.http +22 -22
- data/spec/fixtures.http/getDomainTransfer/success.http +19 -19
- data/spec/fixtures.http/getDomainTransferLock/success.http +17 -17
- data/spec/fixtures.http/getEmailForward/success.http +21 -21
- data/spec/fixtures.http/getPrimaryServer/success.http +20 -20
- data/spec/fixtures.http/getRegistrantChange/success.http +15 -15
- data/spec/fixtures.http/getService/success.http +16 -16
- data/spec/fixtures.http/getTemplate/success.http +15 -15
- data/spec/fixtures.http/getTemplateRecord/success.http +16 -16
- data/spec/fixtures.http/getTld/success.http +20 -20
- data/spec/fixtures.http/getTldExtendedAttributes/success-attributes.http +15 -15
- data/spec/fixtures.http/getTldExtendedAttributes/success-noattributes.http +15 -15
- data/spec/fixtures.http/getTldExtendedAttributes/success.http +15 -15
- data/spec/fixtures.http/getWebhook/success.http +13 -13
- data/spec/fixtures.http/getZone/success.http +16 -16
- data/spec/fixtures.http/getZoneFile/success.http +17 -17
- data/spec/fixtures.http/getZoneRecord/success.http +17 -17
- data/spec/fixtures.http/initiatePush/success.http +17 -17
- data/spec/fixtures.http/issueLetsencryptCertificate/success.http +17 -17
- data/spec/fixtures.http/issueRenewalLetsencryptCertificate/success.http +17 -17
- data/spec/fixtures.http/linkPrimaryServer/success.http +20 -20
- data/spec/fixtures.http/listAccounts/success-account.http +20 -20
- data/spec/fixtures.http/listAccounts/success-user.http +20 -20
- data/spec/fixtures.http/listCertificates/success.http +19 -19
- data/spec/fixtures.http/listCharges/fail-400-bad-filter.http +9 -9
- data/spec/fixtures.http/listCharges/fail-403.http +9 -9
- data/spec/fixtures.http/listCharges/success.http +9 -9
- data/spec/fixtures.http/listContacts/success.http +16 -16
- data/spec/fixtures.http/listDelegationSignerRecords/success.http +17 -17
- data/spec/fixtures.http/listDomains/success.http +19 -19
- data/spec/fixtures.http/listEmailForwards/success.http +13 -13
- data/spec/fixtures.http/listPrimaryServers/success.http +20 -20
- data/spec/fixtures.http/listPushes/success.http +17 -17
- data/spec/fixtures.http/listRegistrantChanges/success.http +15 -15
- data/spec/fixtures.http/listServices/success.http +17 -17
- data/spec/fixtures.http/listTemplateRecords/success.http +16 -16
- data/spec/fixtures.http/listTemplates/success.http +15 -15
- data/spec/fixtures.http/listTlds/success.http +20 -20
- data/spec/fixtures.http/listWebhooks/success.http +13 -13
- data/spec/fixtures.http/listZoneRecords/success.http +17 -17
- data/spec/fixtures.http/listZones/success.http +16 -16
- data/spec/fixtures.http/method-not-allowed.http +8 -8
- data/spec/fixtures.http/notfound-certificate.http +12 -12
- data/spec/fixtures.http/notfound-contact.http +10 -10
- data/spec/fixtures.http/notfound-delegationSignerRecord.http +8 -8
- data/spec/fixtures.http/notfound-domain.http +8 -8
- data/spec/fixtures.http/notfound-domainpush.http +8 -8
- data/spec/fixtures.http/notfound-emailforward.http +8 -8
- data/spec/fixtures.http/notfound-record.http +10 -10
- data/spec/fixtures.http/notfound-template.http +10 -10
- data/spec/fixtures.http/notfound-webhook.http +8 -8
- data/spec/fixtures.http/notfound-whoisprivacy.http +10 -10
- data/spec/fixtures.http/notfound-zone.http +10 -10
- data/spec/fixtures.http/oauthAccessToken/error-invalid-request.http +12 -12
- data/spec/fixtures.http/oauthAccessToken/success.http +16 -16
- data/spec/fixtures.http/pages-1of3.http +12 -12
- data/spec/fixtures.http/pages-2of3.http +12 -12
- data/spec/fixtures.http/pages-3of3.http +12 -12
- data/spec/fixtures.http/purchaseLetsencryptCertificate/success.http +19 -19
- data/spec/fixtures.http/purchaseRenewalLetsencryptCertificate/success.http +19 -19
- data/spec/fixtures.http/registerDomain/error-extended-attributes.http +15 -15
- data/spec/fixtures.http/registerDomain/success.http +20 -20
- data/spec/fixtures.http/rejectPush/success.http +15 -15
- data/spec/fixtures.http/renewDomain/error-tooearly.http +14 -14
- data/spec/fixtures.http/renewDomain/success.http +20 -20
- data/spec/fixtures.http/response.http +12 -12
- data/spec/fixtures.http/restoreDomain/success.http +22 -22
- data/spec/fixtures.http/success-with-malformed-json.http +4 -4
- data/spec/fixtures.http/transferDomain/error-indnsimple.http +13 -13
- data/spec/fixtures.http/transferDomain/error-missing-authcode.http +13 -13
- data/spec/fixtures.http/transferDomain/success.http +20 -20
- data/spec/fixtures.http/unapplyService/success.http +15 -15
- data/spec/fixtures.http/unlinkPrimaryServer/success.http +20 -20
- data/spec/fixtures.http/updateContact/success.http +16 -16
- data/spec/fixtures.http/updateTemplate/success.http +15 -15
- data/spec/fixtures.http/updateZoneNsRecords/success.http +16 -16
- data/spec/fixtures.http/updateZoneRecord/success.http +17 -17
- data/spec/fixtures.http/validation-error.http +15 -15
- data/spec/fixtures.http/whoami/success-account.http +15 -15
- data/spec/fixtures.http/whoami/success-user.http +15 -15
- data/spec/fixtures.http/whoami/success.http +15 -15
- data/spec/support/helpers.rb +0 -2
- metadata +7 -13
- data/lib/dnsimple/struct/whois_privacy_renewal.rb +0 -30
- data/spec/fixtures.http/checkDomainPremiumPrice/error_400_not_a_premium_domain.http +0 -18
- data/spec/fixtures.http/checkDomainPremiumPrice/error_400_tld_not_supported.http +0 -18
- data/spec/fixtures.http/checkDomainPremiumPrice/success.http +0 -20
- data/spec/fixtures.http/getDomainPremiumPrice/failure.http +0 -15
- data/spec/fixtures.http/getDomainPremiumPrice/success.http +0 -20
- data/spec/fixtures.http/getWhoisPrivacy/success.http +0 -16
- data/spec/fixtures.http/renewWhoisPrivacy/success.http +0 -20
- data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-duplicated-order.http +0 -18
- data/spec/fixtures.http/renewWhoisPrivacy/whois-privacy-not-found.http +0 -18
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Dnsimple
|
|
4
4
|
class Client
|
|
5
5
|
module Webhooks
|
|
6
|
-
|
|
7
6
|
# Lists ALL the webhooks in the account.
|
|
8
7
|
#
|
|
9
8
|
# @see https://developer.dnsimple.com/v2/webhooks/#list
|
|
@@ -17,8 +16,8 @@ module Dnsimple
|
|
|
17
16
|
# @example List all webhooks, provide sorting policy
|
|
18
17
|
# client.webhooks.list(1010, sort: "id:asc")
|
|
19
18
|
#
|
|
20
|
-
# @param [Integer]
|
|
21
|
-
# @param [Hash]
|
|
19
|
+
# @param account_id [Integer] the account ID
|
|
20
|
+
# @param options [Hash] the filtering and sorting options
|
|
22
21
|
# @option options [Integer] :page current page (pagination)
|
|
23
22
|
# @option options [Integer] :per_page number of entries to return (pagination)
|
|
24
23
|
# @option options [String] :sort sorting policy
|
|
@@ -36,9 +35,9 @@ module Dnsimple
|
|
|
36
35
|
#
|
|
37
36
|
# @see https://developer.dnsimple.com/v2/webhooks/#create
|
|
38
37
|
#
|
|
39
|
-
# @param [Integer]
|
|
40
|
-
# @param [Hash]
|
|
41
|
-
# @param [Hash]
|
|
38
|
+
# @param account_id [Integer] the account ID
|
|
39
|
+
# @param attributes [Hash]
|
|
40
|
+
# @param options [Hash]
|
|
42
41
|
# @return [Dnsimple::Response<Dnsimple::Struct::Webhook>]
|
|
43
42
|
#
|
|
44
43
|
# @raise [Dnsimple::RequestError]
|
|
@@ -53,9 +52,9 @@ module Dnsimple
|
|
|
53
52
|
#
|
|
54
53
|
# @see https://developer.dnsimple.com/v2/webhooks/#get
|
|
55
54
|
#
|
|
56
|
-
# @param [Integer]
|
|
57
|
-
# @param [#to_s]
|
|
58
|
-
# @param [Hash]
|
|
55
|
+
# @param account_id [Integer] the account ID
|
|
56
|
+
# @param webhook_id [#to_s] The webhook ID
|
|
57
|
+
# @param options [Hash]
|
|
59
58
|
# @return [Dnsimple::Response<Dnsimple::Struct::Webhook>]
|
|
60
59
|
#
|
|
61
60
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -72,9 +71,9 @@ module Dnsimple
|
|
|
72
71
|
#
|
|
73
72
|
# @see https://developer.dnsimple.com/v2/webooks/#delete
|
|
74
73
|
#
|
|
75
|
-
# @param [Integer]
|
|
76
|
-
# @param [#to_s]
|
|
77
|
-
# @param [Hash]
|
|
74
|
+
# @param account_id [Integer] the account ID
|
|
75
|
+
# @param webhook_id [#to_s] The webhook ID
|
|
76
|
+
# @param options [Hash]
|
|
78
77
|
# @return [Dnsimple::Response<nil>]
|
|
79
78
|
#
|
|
80
79
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -84,7 +83,6 @@ module Dnsimple
|
|
|
84
83
|
|
|
85
84
|
Dnsimple::Response.new(response, nil)
|
|
86
85
|
end
|
|
87
|
-
|
|
88
86
|
end
|
|
89
87
|
end
|
|
90
88
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Dnsimple
|
|
4
4
|
class Client
|
|
5
5
|
module Zones
|
|
6
|
-
|
|
7
6
|
# Lists the zones in the account.
|
|
8
7
|
#
|
|
9
8
|
# @see https://developer.dnsimple.com/v2/zones/#list
|
|
@@ -21,8 +20,8 @@ module Dnsimple
|
|
|
21
20
|
# @example List zones, provide filtering policy
|
|
22
21
|
# client.zones.list(1010, "example.com", filter: { name_like: "example" })
|
|
23
22
|
#
|
|
24
|
-
# @param [Integer]
|
|
25
|
-
# @param [Hash]
|
|
23
|
+
# @param account_id [Integer] the account ID
|
|
24
|
+
# @param options [Hash] the filtering and sorting options
|
|
26
25
|
# @option options [Integer] :page current page (pagination)
|
|
27
26
|
# @option options [Integer] :per_page number of entries to return (pagination)
|
|
28
27
|
# @option options [String] :sort sorting policy
|
|
@@ -48,8 +47,8 @@ module Dnsimple
|
|
|
48
47
|
# @see https://developer.dnsimple.com/v2/zones/#list
|
|
49
48
|
# @see #zones
|
|
50
49
|
#
|
|
51
|
-
# @param [Integer]
|
|
52
|
-
# @param [Hash]
|
|
50
|
+
# @param account_id [Integer] the account ID
|
|
51
|
+
# @param options [Hash] the filtering and sorting options
|
|
53
52
|
# @option options [Integer] :page current page (pagination)
|
|
54
53
|
# @option options [Integer] :per_page number of entries to return (pagination)
|
|
55
54
|
# @option options [String] :sort sorting policy
|
|
@@ -65,9 +64,9 @@ module Dnsimple
|
|
|
65
64
|
#
|
|
66
65
|
# @see https://developer.dnsimple.com/v2/zones/#get
|
|
67
66
|
#
|
|
68
|
-
# @param [Integer]
|
|
69
|
-
# @param [#to_s]
|
|
70
|
-
# @param [Hash]
|
|
67
|
+
# @param account_id [Integer] the account ID
|
|
68
|
+
# @param zone_id [#to_s] the zone name
|
|
69
|
+
# @param options [Hash]
|
|
71
70
|
# @return [Dnsimple::Response<Dnsimple::Struct::Zone>]
|
|
72
71
|
#
|
|
73
72
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -82,9 +81,9 @@ module Dnsimple
|
|
|
82
81
|
#
|
|
83
82
|
# @see https://developer.dnsimple.com/v2/zones/#get-file
|
|
84
83
|
#
|
|
85
|
-
# @param [Integer]
|
|
86
|
-
# @param [#to_s]
|
|
87
|
-
# @param [Hash]
|
|
84
|
+
# @param account_id [Integer] the account ID
|
|
85
|
+
# @param zone_name [#to_s] the zone name
|
|
86
|
+
# @param options [Hash]
|
|
88
87
|
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneFile>]
|
|
89
88
|
#
|
|
90
89
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -99,9 +98,9 @@ module Dnsimple
|
|
|
99
98
|
#
|
|
100
99
|
# @see https://developer.dnsimple.com/v2/zones/#activateZoneService
|
|
101
100
|
#
|
|
102
|
-
# @param [#to_s]
|
|
103
|
-
# @param [#to_s]
|
|
104
|
-
# @param [Hash]
|
|
101
|
+
# @param account_id [#to_s] the account ID
|
|
102
|
+
# @param zone_id [#to_s] the zone name
|
|
103
|
+
# @param options [Hash]
|
|
105
104
|
# @return [Dnsimple::Response<Dnsimple::Struct::Zone>]
|
|
106
105
|
#
|
|
107
106
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -116,9 +115,9 @@ module Dnsimple
|
|
|
116
115
|
#
|
|
117
116
|
# @see https://developer.dnsimple.com/v2/zones/#deactivateZoneService
|
|
118
117
|
#
|
|
119
|
-
# @param [#to_s]
|
|
120
|
-
# @param [#to_s]
|
|
121
|
-
# @param [Hash]
|
|
118
|
+
# @param account_id [#to_s] the account ID
|
|
119
|
+
# @param zone_id [#to_s] the zone name
|
|
120
|
+
# @param options [Hash]
|
|
122
121
|
# @return [Dnsimple::Response<Dnsimple::Struct::Zone>]
|
|
123
122
|
#
|
|
124
123
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -128,7 +127,6 @@ module Dnsimple
|
|
|
128
127
|
|
|
129
128
|
Dnsimple::Response.new(response, Struct::Zone.new(response["data"]))
|
|
130
129
|
end
|
|
131
|
-
|
|
132
130
|
end
|
|
133
131
|
end
|
|
134
132
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Dnsimple
|
|
4
4
|
class Client
|
|
5
5
|
module ZonesDistributions
|
|
6
|
-
|
|
7
6
|
# Checks if a zone change is fully distributed to all DNSimple name
|
|
8
7
|
# servers across the globe.
|
|
9
8
|
#
|
|
@@ -30,10 +29,10 @@ module Dnsimple
|
|
|
30
29
|
# @example Get record 123 in zone "example.com"
|
|
31
30
|
# client.zones.zone_record_distribution(1010, "example.com", 123)
|
|
32
31
|
#
|
|
33
|
-
# @param [Integer]
|
|
34
|
-
# @param [String]
|
|
35
|
-
# @param [Integer]
|
|
36
|
-
# @param [Hash]
|
|
32
|
+
# @param account_id [Integer] the account ID
|
|
33
|
+
# @param zone_id [String] the zone name
|
|
34
|
+
# @param record_id [Integer] the record ID
|
|
35
|
+
# @param options [Hash]
|
|
37
36
|
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneDistribution>]
|
|
38
37
|
#
|
|
39
38
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -43,7 +42,6 @@ module Dnsimple
|
|
|
43
42
|
|
|
44
43
|
Dnsimple::Response.new(response, Struct::ZoneDistribution.new(response["data"]))
|
|
45
44
|
end
|
|
46
|
-
|
|
47
45
|
end
|
|
48
46
|
end
|
|
49
47
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Dnsimple
|
|
4
4
|
class Client
|
|
5
5
|
module ZonesRecords
|
|
6
|
-
|
|
7
6
|
# Lists the zone records in the account.
|
|
8
7
|
#
|
|
9
8
|
# @see https://developer.dnsimple.com/v2/zones/records/#listZoneRecords
|
|
@@ -21,9 +20,9 @@ module Dnsimple
|
|
|
21
20
|
# @example List records for the zone "example.com", filtering by 'A' record type
|
|
22
21
|
# client.zones.list_zone_records(1010, "example.com", filter: { type: 'A' })
|
|
23
22
|
#
|
|
24
|
-
# @param [Integer]
|
|
25
|
-
# @param [String]
|
|
26
|
-
# @param [Hash]
|
|
23
|
+
# @param account_id [Integer] the account ID
|
|
24
|
+
# @param zone_id [String] the zone name
|
|
25
|
+
# @param options [Hash] the filtering and sorting options
|
|
27
26
|
# @option options [Integer] :page current page (pagination)
|
|
28
27
|
# @option options [Integer] :per_page number of entries to return (pagination)
|
|
29
28
|
# @option options [String] :sort sorting policy
|
|
@@ -41,21 +40,21 @@ module Dnsimple
|
|
|
41
40
|
|
|
42
41
|
# Lists ALL the zone records in the account.
|
|
43
42
|
#
|
|
44
|
-
# This method is similar to {#
|
|
43
|
+
# This method is similar to {#zone_records}, but instead of returning the results of a specific page
|
|
45
44
|
# it iterates all the pages and returns the entire collection.
|
|
46
45
|
#
|
|
47
46
|
# Please use this method carefully, as fetching the entire collection will increase the number of requests
|
|
48
47
|
# you send to the API server and you may eventually risk to hit the throttle limit.
|
|
49
48
|
#
|
|
50
49
|
# @see https://developer.dnsimple.com/v2/zones/records/#listZoneRecords
|
|
51
|
-
# @see #
|
|
50
|
+
# @see #zone_records
|
|
52
51
|
#
|
|
53
52
|
# @example List all records for the zone "example.com"
|
|
54
53
|
# client.zones.all_zone_records(1010, "example.com")
|
|
55
54
|
#
|
|
56
|
-
# @param [Integer]
|
|
57
|
-
# @param [String]
|
|
58
|
-
# @param [Hash]
|
|
55
|
+
# @param account_id [Integer] the account ID
|
|
56
|
+
# @param zone_id [String] the zone name
|
|
57
|
+
# @param options [Hash] the filtering and sorting options
|
|
59
58
|
# @option options [Integer] :page current page (pagination)
|
|
60
59
|
# @option options [Integer] :per_page number of entries to return (pagination)
|
|
61
60
|
# @option options [String] :sort sorting policy
|
|
@@ -75,10 +74,10 @@ module Dnsimple
|
|
|
75
74
|
# @example Create a URL record in zone "example.com"
|
|
76
75
|
# client.zones.create_zone_record(1010, "example.com", name: "www", type: "url", content: "example.com")
|
|
77
76
|
#
|
|
78
|
-
# @param [Integer]
|
|
79
|
-
# @param [String]
|
|
80
|
-
# @param [Hash]
|
|
81
|
-
# @param [Hash]
|
|
77
|
+
# @param account_id [Integer] the account ID
|
|
78
|
+
# @param zone_id [String] the zone name
|
|
79
|
+
# @param attributes [Hash]
|
|
80
|
+
# @param options [Hash]
|
|
82
81
|
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneRecord>]
|
|
83
82
|
#
|
|
84
83
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -97,10 +96,10 @@ module Dnsimple
|
|
|
97
96
|
# @example Get record 123 in zone "example.com"
|
|
98
97
|
# client.zones.zone_record(1010, "example.com", 123)
|
|
99
98
|
#
|
|
100
|
-
# @param [Integer]
|
|
101
|
-
# @param [String]
|
|
102
|
-
# @param [Integer]
|
|
103
|
-
# @param [Hash]
|
|
99
|
+
# @param account_id [Integer] the account ID
|
|
100
|
+
# @param zone_id [String] the zone name
|
|
101
|
+
# @param record_id [Integer] the record ID
|
|
102
|
+
# @param options [Hash]
|
|
104
103
|
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneRecord>]
|
|
105
104
|
#
|
|
106
105
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -118,11 +117,11 @@ module Dnsimple
|
|
|
118
117
|
# @example Update the TTL to 600 of record 123 in zone "example.com"
|
|
119
118
|
# client.zones.update_zone_record(1010, "example.com", 123, ttl: 600)
|
|
120
119
|
#
|
|
121
|
-
# @param [Integer]
|
|
122
|
-
# @param [String]
|
|
123
|
-
# @param [Integer]
|
|
124
|
-
# @param [Hash]
|
|
125
|
-
# @param [Hash]
|
|
120
|
+
# @param account_id [Integer] the account ID
|
|
121
|
+
# @param zone_id [String] the zone name
|
|
122
|
+
# @param record_id [Integer] the record ID
|
|
123
|
+
# @param attributes [Hash]
|
|
124
|
+
# @param options [Hash]
|
|
126
125
|
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneRecord>]
|
|
127
126
|
#
|
|
128
127
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -142,10 +141,10 @@ module Dnsimple
|
|
|
142
141
|
# @example Delete record 123 in zone "example.com"
|
|
143
142
|
# client.zones.delete_zone_record(1010, "example.com", 123)
|
|
144
143
|
#
|
|
145
|
-
# @param [Integer]
|
|
146
|
-
# @param [String]
|
|
147
|
-
# @param [Integer]
|
|
148
|
-
# @param [Hash]
|
|
144
|
+
# @param account_id [Integer] the account ID
|
|
145
|
+
# @param zone_id [String] the zone name
|
|
146
|
+
# @param record_id [Integer] the record ID
|
|
147
|
+
# @param options [Hash]
|
|
149
148
|
# @return [Dnsimple::Response<nil>]
|
|
150
149
|
#
|
|
151
150
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -163,13 +162,13 @@ module Dnsimple
|
|
|
163
162
|
# @example Create 2 A records in zone "example.com", update 1 record and delete 1 record.
|
|
164
163
|
# client.zones.batch_change_zone_records(1010, "example.com", { creates: [{ type: "A", content: "1.2.3.4", name: "ab" }, { type: "A", content: "2.3.4.5", name: "ab" }], updates: [{ id: 67622534, content: "3.2.3.40", name: "www" } }, deletes: [{ id: 67622509 })
|
|
165
164
|
#
|
|
166
|
-
# @param [Integer]
|
|
167
|
-
# @param [String]
|
|
165
|
+
# @param account_id [Integer] the account ID
|
|
166
|
+
# @param zone_id [String] the zone name
|
|
168
167
|
# @param attributes [Hash] Specifies the record creations and/or updates and/or deletions that should be performed as an atomic batch operation in the zone
|
|
169
168
|
# @option attributes [Array<Hash>] :creates (optional)
|
|
170
169
|
# @option attributes [Array<Hash>] :updates (optional)
|
|
171
170
|
# @option attributes [Array<Hash>] :deletes (optional)
|
|
172
|
-
# @param [Hash]
|
|
171
|
+
# @param options [Hash]
|
|
173
172
|
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneRecordsBatchChange>]
|
|
174
173
|
#
|
|
175
174
|
# @raise [Dnsimple::NotFoundError]
|
|
@@ -186,9 +185,8 @@ module Dnsimple
|
|
|
186
185
|
deletes_data = response["data"]["deletes"] || []
|
|
187
186
|
deletes = deletes_data.map { |r| Struct::ZoneRecordId.new(r) }
|
|
188
187
|
end
|
|
189
|
-
Dnsimple::Response.new(response, Struct::ZoneRecordsBatchChange.new({ creates
|
|
188
|
+
Dnsimple::Response.new(response, Struct::ZoneRecordsBatchChange.new({ creates:, updates:, deletes: }))
|
|
190
189
|
end
|
|
191
|
-
|
|
192
190
|
end
|
|
193
191
|
end
|
|
194
192
|
end
|
data/lib/dnsimple/client.rb
CHANGED
|
@@ -23,7 +23,6 @@ module Dnsimple
|
|
|
23
23
|
#
|
|
24
24
|
# client = Dnsimple::Client.new(base_url: "https://api.sandbox.dnsimple.com", access_token: "abc")
|
|
25
25
|
class Client
|
|
26
|
-
|
|
27
26
|
HEADER_AUTHORIZATION = "Authorization"
|
|
28
27
|
|
|
29
28
|
# @return [String] The current API version.
|
|
@@ -103,8 +102,8 @@ module Dnsimple
|
|
|
103
102
|
|
|
104
103
|
# Make a HTTP GET request.
|
|
105
104
|
#
|
|
106
|
-
# @param [String]
|
|
107
|
-
# @param [Hash]
|
|
105
|
+
# @param path [String] The path, relative to {#base_url}
|
|
106
|
+
# @param options [Hash] The query and header params for the request
|
|
108
107
|
# @return [HTTParty::Response]
|
|
109
108
|
def get(path, options = {})
|
|
110
109
|
execute :get, path, nil, options.to_h
|
|
@@ -112,9 +111,9 @@ module Dnsimple
|
|
|
112
111
|
|
|
113
112
|
# Make a HTTP POST request.
|
|
114
113
|
#
|
|
115
|
-
# @param [String]
|
|
116
|
-
# @param [Hash]
|
|
117
|
-
# @param [Hash]
|
|
114
|
+
# @param path [String] The path, relative to {#base_url}
|
|
115
|
+
# @param data [Hash] The body for the request
|
|
116
|
+
# @param options [Hash] The query and header params for the request
|
|
118
117
|
# @return [HTTParty::Response]
|
|
119
118
|
def post(path, data = nil, options = {})
|
|
120
119
|
execute :post, path, data, options
|
|
@@ -122,9 +121,9 @@ module Dnsimple
|
|
|
122
121
|
|
|
123
122
|
# Make a HTTP PUT request.
|
|
124
123
|
#
|
|
125
|
-
# @param [String]
|
|
126
|
-
# @param [Hash]
|
|
127
|
-
# @param [Hash]
|
|
124
|
+
# @param path [String] The path, relative to {#base_url}
|
|
125
|
+
# @param data [Hash] The body for the request
|
|
126
|
+
# @param options [Hash] The query and header params for the request
|
|
128
127
|
# @return [HTTParty::Response]
|
|
129
128
|
def put(path, data = nil, options = {})
|
|
130
129
|
execute :put, path, data, options
|
|
@@ -132,9 +131,9 @@ module Dnsimple
|
|
|
132
131
|
|
|
133
132
|
# Make a HTTP PATCH request.
|
|
134
133
|
#
|
|
135
|
-
# @param [String]
|
|
136
|
-
# @param [Hash]
|
|
137
|
-
# @param [Hash]
|
|
134
|
+
# @param path [String] The path, relative to {#base_url}
|
|
135
|
+
# @param data [Hash] The body for the request
|
|
136
|
+
# @param options [Hash] The query and header params for the request
|
|
138
137
|
# @return [HTTParty::Response]
|
|
139
138
|
def patch(path, data = nil, options = {})
|
|
140
139
|
execute :patch, path, data, options
|
|
@@ -142,8 +141,8 @@ module Dnsimple
|
|
|
142
141
|
|
|
143
142
|
# Make a HTTP DELETE request.
|
|
144
143
|
#
|
|
145
|
-
# @param [String]
|
|
146
|
-
# @param [Hash]
|
|
144
|
+
# @param path [String] The path, relative to {#base_url}
|
|
145
|
+
# @param options [Hash] The query and header params for the request
|
|
147
146
|
# @return [HTTParty::Response]
|
|
148
147
|
def delete(path, data = nil, options = {})
|
|
149
148
|
execute :delete, path, data, options
|
|
@@ -151,10 +150,10 @@ module Dnsimple
|
|
|
151
150
|
|
|
152
151
|
# Executes a request, validates and returns the response.
|
|
153
152
|
#
|
|
154
|
-
# @param [String]
|
|
155
|
-
# @param [String]
|
|
156
|
-
# @param [Hash]
|
|
157
|
-
# @param [Hash]
|
|
153
|
+
# @param method [String] The HTTP method
|
|
154
|
+
# @param path [String] The path, relative to {#base_url}
|
|
155
|
+
# @param data [Hash] The body for the request
|
|
156
|
+
# @param options [Hash] The query and header params for the request
|
|
158
157
|
# @return [HTTParty::Response]
|
|
159
158
|
# @raise [RequestError]
|
|
160
159
|
# @raise [NotFoundError]
|
|
@@ -183,10 +182,10 @@ module Dnsimple
|
|
|
183
182
|
#
|
|
184
183
|
# Therefore, it's up to the caller to properly handle and validate the response.
|
|
185
184
|
#
|
|
186
|
-
# @param [String]
|
|
187
|
-
# @param [String]
|
|
188
|
-
# @param [Hash]
|
|
189
|
-
# @param [Hash]
|
|
185
|
+
# @param method [String] The HTTP method
|
|
186
|
+
# @param path [String] The path, relative to {#base_url}
|
|
187
|
+
# @param data [Hash] The body for the request
|
|
188
|
+
# @param options [Hash] The query and header params for the request
|
|
190
189
|
# @return [HTTParty::Response]
|
|
191
190
|
def request(method, path, data = nil, options = {})
|
|
192
191
|
request_options = request_options(options)
|
|
@@ -230,7 +229,7 @@ module Dnsimple
|
|
|
230
229
|
|
|
231
230
|
def add_auth_options!(options)
|
|
232
231
|
if password
|
|
233
|
-
options[:basic_auth] = { username
|
|
232
|
+
options[:basic_auth] = { username:, password: }
|
|
234
233
|
elsif access_token
|
|
235
234
|
options[:headers][HEADER_AUTHORIZATION] = "Bearer #{access_token}"
|
|
236
235
|
end
|
|
@@ -262,6 +261,5 @@ module Dnsimple
|
|
|
262
261
|
def content_data(headers, data)
|
|
263
262
|
headers["Content-Type"] == "application/json" ? JSON.dump(data) : data
|
|
264
263
|
end
|
|
265
|
-
|
|
266
264
|
end
|
|
267
265
|
end
|
data/lib/dnsimple/default.rb
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Dnsimple
|
|
4
4
|
# Default configuration options for {Client}
|
|
5
5
|
module Default
|
|
6
|
-
|
|
7
6
|
# Default API endpoint
|
|
8
7
|
BASE_URL = "https://api.dnsimple.com/"
|
|
9
8
|
|
|
@@ -11,7 +10,6 @@ module Dnsimple
|
|
|
11
10
|
USER_AGENT = "dnsimple-ruby/#{VERSION}".freeze
|
|
12
11
|
|
|
13
12
|
class << self
|
|
14
|
-
|
|
15
13
|
# List of configurable keys for {Client}
|
|
16
14
|
# @return [Array] of option keys
|
|
17
15
|
def keys
|
|
@@ -73,8 +71,6 @@ module Dnsimple
|
|
|
73
71
|
def proxy
|
|
74
72
|
ENV.fetch("DNSIMPLE_PROXY", nil)
|
|
75
73
|
end
|
|
76
|
-
|
|
77
74
|
end
|
|
78
|
-
|
|
79
75
|
end
|
|
80
76
|
end
|
data/lib/dnsimple/error.rb
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Dnsimple
|
|
4
|
-
|
|
5
4
|
class Error < StandardError
|
|
6
5
|
end
|
|
7
6
|
|
|
8
7
|
# RequestError is raised when an API request fails for an client, a server error or invalid request information.
|
|
9
8
|
class RequestError < Error
|
|
10
|
-
|
|
11
9
|
attr_reader :http_response
|
|
12
10
|
attr_reader :attribute_errors
|
|
13
11
|
|
|
@@ -38,7 +36,6 @@ module Dnsimple
|
|
|
38
36
|
content_type = http_response.headers["Content-Type"]
|
|
39
37
|
content_type&.start_with?("application/json")
|
|
40
38
|
end
|
|
41
|
-
|
|
42
39
|
end
|
|
43
40
|
|
|
44
41
|
class NotFoundError < RequestError
|
|
@@ -51,7 +48,6 @@ module Dnsimple
|
|
|
51
48
|
end
|
|
52
49
|
|
|
53
50
|
class OAuthInvalidRequestError < Error
|
|
54
|
-
|
|
55
51
|
attr_reader :http_response
|
|
56
52
|
attr_reader :error
|
|
57
53
|
attr_reader :error_description
|
|
@@ -68,7 +64,5 @@ module Dnsimple
|
|
|
68
64
|
def message
|
|
69
65
|
"#{error}: #{error_description}"
|
|
70
66
|
end
|
|
71
|
-
|
|
72
67
|
end
|
|
73
|
-
|
|
74
68
|
end
|
data/lib/dnsimple/extra.rb
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
module Dnsimple
|
|
4
4
|
module Extra
|
|
5
|
-
|
|
6
5
|
# Joins two pieces of URI with a /.
|
|
7
6
|
#
|
|
8
7
|
# @return [String] The joined string.
|
|
@@ -24,8 +23,8 @@ module Dnsimple
|
|
|
24
23
|
# h2 = { b: 250, c: { c1: 200 } }
|
|
25
24
|
# Extra.deep_merge(h1, h2) { |key, this_val, other_val| this_val + other_val }
|
|
26
25
|
# # => { a: 100, b: 450, c: { c1: 300 } }
|
|
27
|
-
def self.deep_merge(this, other, &
|
|
28
|
-
deep_merge!(this.dup, other, &
|
|
26
|
+
def self.deep_merge(this, other, &)
|
|
27
|
+
deep_merge!(this.dup, other, &)
|
|
29
28
|
end
|
|
30
29
|
|
|
31
30
|
# Same as +deep_merge+, but modifies +this+ instead of returning a new hash.
|
|
@@ -49,8 +48,8 @@ module Dnsimple
|
|
|
49
48
|
|
|
50
49
|
# Validates the presence of mandatory attributes.
|
|
51
50
|
#
|
|
52
|
-
# @param [Hash]
|
|
53
|
-
# @param [Array<Symbol>]
|
|
51
|
+
# @param attributes [Hash]
|
|
52
|
+
# @param required [Array<Symbol>]
|
|
54
53
|
# @return [void]
|
|
55
54
|
# @raise [ArgumentError]
|
|
56
55
|
def self.validate_mandatory_attributes(attributes, required)
|
|
@@ -58,6 +57,5 @@ module Dnsimple
|
|
|
58
57
|
attributes&.key?(name) or raise(ArgumentError, ":#{name} is required")
|
|
59
58
|
end
|
|
60
59
|
end
|
|
61
|
-
|
|
62
60
|
end
|
|
63
61
|
end
|
data/lib/dnsimple/options.rb
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Dnsimple
|
|
4
4
|
module Options
|
|
5
|
-
|
|
6
5
|
class Base
|
|
7
|
-
|
|
8
6
|
def initialize(options)
|
|
9
7
|
@options = (options || {}).dup
|
|
10
8
|
end
|
|
@@ -12,11 +10,9 @@ module Dnsimple
|
|
|
12
10
|
def to_h
|
|
13
11
|
@options
|
|
14
12
|
end
|
|
15
|
-
|
|
16
13
|
end
|
|
17
14
|
|
|
18
15
|
class ListOptions < Base
|
|
19
|
-
|
|
20
16
|
def initialize(options)
|
|
21
17
|
super
|
|
22
18
|
_prepare_query
|
|
@@ -52,14 +48,12 @@ module Dnsimple
|
|
|
52
48
|
|
|
53
49
|
def _prepare_groupings
|
|
54
50
|
groupings = @options.delete(:groupings)
|
|
55
|
-
_merge({ groupings:
|
|
51
|
+
_merge({ groupings: }) unless groupings.nil?
|
|
56
52
|
end
|
|
57
53
|
|
|
58
54
|
def _merge(hash)
|
|
59
55
|
@options[:query].merge!(hash)
|
|
60
56
|
end
|
|
61
|
-
|
|
62
57
|
end
|
|
63
|
-
|
|
64
58
|
end
|
|
65
59
|
end
|
data/lib/dnsimple/response.rb
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Dnsimple
|
|
4
|
-
|
|
5
4
|
# The Response represents a response returned by a client request.
|
|
6
5
|
#
|
|
7
6
|
# It wraps the content of the response data, as well other response metadata such as rate-limiting information.
|
|
8
7
|
class Response
|
|
9
|
-
|
|
10
8
|
# @return [HTTParty::Response]
|
|
11
9
|
attr_reader :http_response
|
|
12
10
|
|
|
@@ -26,8 +24,8 @@ module Dnsimple
|
|
|
26
24
|
attr_reader :rate_limit_reset
|
|
27
25
|
|
|
28
26
|
|
|
29
|
-
# @param [HTTParty::Response]
|
|
30
|
-
# @param [Object]
|
|
27
|
+
# @param http_response [HTTParty::Response] the HTTP response
|
|
28
|
+
# @param data [Object] the response data
|
|
31
29
|
def initialize(http_response, data)
|
|
32
30
|
@http_response = http_response
|
|
33
31
|
@data = data
|
|
@@ -36,17 +34,14 @@ module Dnsimple
|
|
|
36
34
|
@rate_limit_remaining = http_response.headers["X-RateLimit-Remaining"].to_i
|
|
37
35
|
@rate_limit_reset = Time.at(http_response.headers["X-RateLimit-Reset"].to_i)
|
|
38
36
|
end
|
|
39
|
-
|
|
40
37
|
end
|
|
41
38
|
|
|
42
39
|
# The CollectionResponse is a specific type of Response where the data is a collection of enumerable objects.
|
|
43
40
|
class CollectionResponse < Response
|
|
44
|
-
|
|
45
41
|
end
|
|
46
42
|
|
|
47
43
|
# The PaginatedResponse is a specific type of Response that also exposes pagination metadata.
|
|
48
44
|
class PaginatedResponse < CollectionResponse
|
|
49
|
-
|
|
50
45
|
# @return [Integer] The current page.
|
|
51
46
|
attr_reader :page
|
|
52
47
|
|
|
@@ -63,8 +58,8 @@ module Dnsimple
|
|
|
63
58
|
# Initializes a new paginated response from the response metadata,
|
|
64
59
|
# and with given collection.
|
|
65
60
|
#
|
|
66
|
-
# @param [Hash]
|
|
67
|
-
# @param [Array]
|
|
61
|
+
# @param http_response [Hash] the HTTP response
|
|
62
|
+
# @param collection [Array] the enumerable collection of records returned in the response data
|
|
68
63
|
def initialize(http_response, collection)
|
|
69
64
|
super
|
|
70
65
|
|
|
@@ -74,11 +69,9 @@ module Dnsimple
|
|
|
74
69
|
@total_entries = pagination["total_entries"]
|
|
75
70
|
@total_pages = pagination["total_pages"]
|
|
76
71
|
end
|
|
77
|
-
|
|
78
72
|
end
|
|
79
73
|
|
|
80
74
|
class PaginatedResponseWithQuery < PaginatedResponse
|
|
81
|
-
|
|
82
75
|
# @return [Hash] A hash containing the query parameters that produced the results in this response
|
|
83
76
|
attr_reader :query
|
|
84
77
|
|
|
@@ -86,7 +79,5 @@ module Dnsimple
|
|
|
86
79
|
super
|
|
87
80
|
@query = http_response["query"]
|
|
88
81
|
end
|
|
89
|
-
|
|
90
82
|
end
|
|
91
|
-
|
|
92
83
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Dnsimple
|
|
4
4
|
module Struct
|
|
5
5
|
class Account < Base
|
|
6
|
-
|
|
7
6
|
# @return [Integer] The account ID in DNSimple.
|
|
8
7
|
attr_accessor :id
|
|
9
8
|
|
|
@@ -12,7 +11,6 @@ module Dnsimple
|
|
|
12
11
|
|
|
13
12
|
# @return [String] The identifier of the plan the account is subscribed to.
|
|
14
13
|
attr_accessor :plan_identifier
|
|
15
|
-
|
|
16
14
|
end
|
|
17
15
|
end
|
|
18
16
|
end
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
module Dnsimple
|
|
4
4
|
module Struct
|
|
5
5
|
class Certificate < Base
|
|
6
|
-
|
|
7
6
|
# @return [Integer] The certificate ID in DNSimple.
|
|
8
7
|
attr_accessor :id
|
|
9
8
|
|
|
@@ -42,7 +41,6 @@ module Dnsimple
|
|
|
42
41
|
|
|
43
42
|
# @return [String] The timestamp when the certificate will expire.
|
|
44
43
|
attr_accessor :expires_at
|
|
45
|
-
|
|
46
44
|
end
|
|
47
45
|
end
|
|
48
46
|
end
|