dnsimple 2.2.0 → 3.0.0.pre.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +3 -1
- data/CHANGELOG.md +13 -2
- data/CONTRIBUTING.md +35 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +1 -1
- data/README.md +30 -82
- data/dnsimple.gemspec +2 -1
- data/lib/dnsimple.rb +0 -2
- data/lib/dnsimple/client.rb +64 -64
- data/lib/dnsimple/client/clients.rb +82 -58
- data/lib/dnsimple/client/contacts.rb +74 -37
- data/lib/dnsimple/client/domains.rb +82 -28
- data/lib/dnsimple/client/domains_email_forwards.rb +107 -0
- data/lib/dnsimple/client/identity.rb +38 -0
- data/lib/dnsimple/client/oauth.rb +42 -0
- data/lib/dnsimple/client/registrar.rb +64 -72
- data/lib/dnsimple/client/registrar_auto_renewal.rb +41 -0
- data/lib/dnsimple/client/registrar_whois_privacy.rb +74 -0
- data/lib/dnsimple/client/tlds.rb +88 -0
- data/lib/dnsimple/client/webhooks.rb +82 -0
- data/lib/dnsimple/client/zones.rb +68 -0
- data/lib/dnsimple/client/zones_records.rb +127 -0
- data/lib/dnsimple/default.rb +10 -17
- data/lib/dnsimple/error.rb +5 -8
- data/lib/dnsimple/extra.rb +1 -1
- data/lib/dnsimple/response.rb +80 -0
- data/lib/dnsimple/struct.rb +13 -14
- data/lib/dnsimple/struct/account.rb +13 -0
- data/lib/dnsimple/struct/contact.rb +6 -3
- data/lib/dnsimple/struct/domain.rb +10 -10
- data/lib/dnsimple/struct/domain_check.rb +16 -0
- data/lib/dnsimple/struct/email_forward.rb +11 -1
- data/lib/dnsimple/struct/oauth_token.rb +19 -0
- data/lib/dnsimple/struct/record.rb +25 -7
- data/lib/dnsimple/struct/tld.rb +22 -0
- data/lib/dnsimple/struct/user.rb +3 -7
- data/lib/dnsimple/struct/webhook.rb +13 -0
- data/lib/dnsimple/struct/whois_privacy.rb +8 -5
- data/lib/dnsimple/struct/zone.rb +25 -0
- data/lib/dnsimple/version.rb +1 -1
- data/spec/dnsimple/client/client_service_spec.rb +37 -0
- data/spec/dnsimple/client/contacts_spec.rb +108 -78
- data/spec/dnsimple/client/domains_email_forwards_spec.rb +190 -0
- data/spec/dnsimple/client/domains_spec.rb +121 -58
- data/spec/dnsimple/client/identity_spec.rb +56 -0
- data/spec/dnsimple/client/oauth_spec.rb +48 -0
- data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +80 -0
- data/spec/dnsimple/client/registrar_spec.rb +109 -122
- data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +119 -0
- data/spec/dnsimple/client/tlds_spec.rb +139 -0
- data/spec/dnsimple/client/webhooks_spec.rb +142 -0
- data/spec/dnsimple/client/zones_records_spec.rb +277 -0
- data/spec/dnsimple/client/zones_spec.rb +109 -0
- data/spec/dnsimple/client_spec.rb +34 -46
- data/spec/dnsimple/extra_spec.rb +22 -0
- data/spec/{files → fixtures.http}/badgateway.http +14 -14
- data/spec/fixtures.http/checkDomain/success.http +17 -0
- data/spec/fixtures.http/createContact/created.http +17 -0
- data/spec/fixtures.http/createDomain/created.http +16 -0
- data/spec/fixtures.http/createEmailForward/created.http +17 -0
- data/spec/fixtures.http/createWebhook/created.http +17 -0
- data/spec/fixtures.http/createZoneRecord/created.http +17 -0
- data/spec/fixtures.http/deleteContact/success.http +13 -0
- data/spec/fixtures.http/deleteDomain/success.http +13 -0
- data/spec/fixtures.http/deleteEmailForward/success.http +12 -0
- data/spec/fixtures.http/deleteWebhook/success.http +13 -0
- data/spec/fixtures.http/deleteZoneRecord/success.http +13 -0
- data/spec/fixtures.http/disableAutoRenewal/success.http +12 -0
- data/spec/fixtures.http/disableWhoisPrivacy/success.http +17 -0
- data/spec/fixtures.http/enableAutoRenewal/success.http +12 -0
- data/spec/fixtures.http/enableWhoisPrivacy/created.http +17 -0
- data/spec/fixtures.http/enableWhoisPrivacy/success.http +17 -0
- data/spec/fixtures.http/getContact/success.http +17 -0
- data/spec/fixtures.http/getDomain/success.http +16 -0
- data/spec/fixtures.http/getEmailForward/success.http +17 -0
- data/spec/fixtures.http/getTld/success.http +17 -0
- data/spec/fixtures.http/getTldExtendedAttributes/success-noattributes.http +17 -0
- data/spec/fixtures.http/getTldExtendedAttributes/success.http +17 -0
- data/spec/fixtures.http/getWebhook/success.http +17 -0
- data/spec/fixtures.http/getWhoisPrivacy/success.http +17 -0
- data/spec/fixtures.http/getZone/success.http +17 -0
- data/spec/fixtures.http/getZoneRecord/success.http +17 -0
- data/spec/fixtures.http/listContacts/success.http +17 -0
- data/spec/fixtures.http/listDomains/success.http +16 -0
- data/spec/fixtures.http/listEmailForwards/success.http +17 -0
- data/spec/fixtures.http/listTlds/success.http +17 -0
- data/spec/fixtures.http/listWebhooks/success.http +17 -0
- data/spec/fixtures.http/listZoneRecords/success.http +17 -0
- data/spec/fixtures.http/listZones/success.http +17 -0
- data/spec/fixtures.http/notfound-contact.http +12 -0
- data/spec/fixtures.http/notfound-domain.http +12 -0
- data/spec/fixtures.http/notfound-emailforward.http +12 -0
- data/spec/fixtures.http/notfound-record.http +12 -0
- data/spec/fixtures.http/notfound-webhook.http +12 -0
- data/spec/fixtures.http/notfound-zone.http +12 -0
- data/spec/fixtures.http/oauthAccessToken/success.http +17 -0
- data/spec/fixtures.http/pages-1of3.http +16 -0
- data/spec/fixtures.http/pages-2of3.http +16 -0
- data/spec/fixtures.http/pages-3of3.http +16 -0
- data/spec/fixtures.http/registerDomain/success.http +17 -0
- data/spec/fixtures.http/renewDomain/error-tooearly.http +15 -0
- data/spec/fixtures.http/renewDomain/success.http +17 -0
- data/spec/fixtures.http/resetDomainToken/success.http +17 -0
- data/spec/fixtures.http/response.http +16 -0
- data/spec/fixtures.http/transferDomain/error-indnsimple.http +15 -0
- data/spec/fixtures.http/transferDomain/error-missing-authcode.http +15 -0
- data/spec/fixtures.http/transferDomain/success.http +17 -0
- data/spec/fixtures.http/transferDomainOut/success.http +13 -0
- data/spec/fixtures.http/updateContact/success.http +17 -0
- data/spec/fixtures.http/updateZoneRecord/success.http +17 -0
- data/spec/fixtures.http/whoami/success.http +16 -0
- data/spec/fixtures.http/whoami/success_account.http +16 -0
- data/spec/fixtures.http/whoami/success_user.http +16 -0
- data/spec/spec_helper.rb +0 -6
- data/spec/support/helpers.rb +4 -4
- metadata +161 -238
- data/lib/dnsimple/client/certificates.rb +0 -100
- data/lib/dnsimple/client/domains_autorenewal.rb +0 -35
- data/lib/dnsimple/client/domains_forwards.rb +0 -71
- data/lib/dnsimple/client/domains_privacy.rb +0 -35
- data/lib/dnsimple/client/domains_records.rb +0 -90
- data/lib/dnsimple/client/domains_sharing.rb +0 -54
- data/lib/dnsimple/client/domains_zones.rb +0 -22
- data/lib/dnsimple/client/name_servers.rb +0 -71
- data/lib/dnsimple/client/services.rb +0 -37
- data/lib/dnsimple/client/services_domains.rb +0 -68
- data/lib/dnsimple/client/templates.rb +0 -88
- data/lib/dnsimple/client/templates_domains.rb +0 -23
- data/lib/dnsimple/client/templates_records.rb +0 -88
- data/lib/dnsimple/client/users.rb +0 -39
- data/lib/dnsimple/client/vanity_name_servers.rb +0 -39
- data/lib/dnsimple/compatibility.rb +0 -46
- data/lib/dnsimple/struct/certificate.rb +0 -56
- data/lib/dnsimple/struct/membership.rb +0 -22
- data/lib/dnsimple/struct/price.rb +0 -16
- data/lib/dnsimple/struct/service.rb +0 -19
- data/lib/dnsimple/struct/template.rb +0 -19
- data/lib/dnsimple/struct/template_record.rb +0 -24
- data/lib/dnsimple/struct/transfer_order.rb +0 -10
- data/spec/dnsimple/client/certificates_spec.rb +0 -196
- data/spec/dnsimple/client/domains_autorenewals_spec.rb +0 -72
- data/spec/dnsimple/client/domains_forwards_spec.rb +0 -146
- data/spec/dnsimple/client/domains_privacy_spec.rb +0 -74
- data/spec/dnsimple/client/domains_records_spec.rb +0 -191
- data/spec/dnsimple/client/domains_sharing_spec.rb +0 -109
- data/spec/dnsimple/client/domains_zones_spec.rb +0 -40
- data/spec/dnsimple/client/name_servers_spec.rb +0 -131
- data/spec/dnsimple/client/services_domains_spec.rb +0 -101
- data/spec/dnsimple/client/services_spec.rb +0 -69
- data/spec/dnsimple/client/templates_domains_spec.rb +0 -38
- data/spec/dnsimple/client/templates_records_spec.rb +0 -180
- data/spec/dnsimple/client/templates_spec.rb +0 -166
- data/spec/dnsimple/client/users_spec.rb +0 -70
- data/spec/dnsimple/client/vanity_name_servers_spec.rb +0 -61
- data/spec/dnsimple/compatibility_spec.rb +0 -57
- data/spec/files/2fa/error-badtoken.http +0 -22
- data/spec/files/2fa/error-required.http +0 -23
- data/spec/files/2fa/exchange-token.http +0 -22
- data/spec/files/certificates/configure/success.http +0 -19
- data/spec/files/certificates/get/success.http +0 -19
- data/spec/files/certificates/list/success.http +0 -19
- data/spec/files/certificates/notfound.http +0 -19
- data/spec/files/certificates/purchase/success.http +0 -19
- data/spec/files/certificates/submit/success.http +0 -19
- data/spec/files/contacts/contact/success.http +0 -19
- data/spec/files/contacts/contacts/success.http +0 -23
- data/spec/files/contacts/create_contact/badrequest-missingcontact.http +0 -19
- data/spec/files/contacts/create_contact/badrequest-validationerror.http +0 -19
- data/spec/files/contacts/create_contact/created.http +0 -22
- data/spec/files/contacts/delete_contact/success-204.http +0 -18
- data/spec/files/contacts/delete_contact/success.http +0 -19
- data/spec/files/contacts/notfound-contact.http +0 -19
- data/spec/files/contacts/update_contact/success.http +0 -21
- data/spec/files/domains/create_domain/created.http +0 -21
- data/spec/files/domains/create_forward/created.http +0 -22
- data/spec/files/domains/create_membership/success.http +0 -21
- data/spec/files/domains/create_record/created.http +0 -21
- data/spec/files/domains/delete_domain/success-204.http +0 -18
- data/spec/files/domains/delete_domain/success.http +0 -19
- data/spec/files/domains/delete_forward/success.http +0 -17
- data/spec/files/domains/delete_membership/success.http +0 -17
- data/spec/files/domains/delete_record/success-204.http +0 -18
- data/spec/files/domains/delete_record/success.http +0 -19
- data/spec/files/domains/disable_auto_renewal/success.http +0 -21
- data/spec/files/domains/disable_whois_privacy/success.http +0 -21
- data/spec/files/domains/domain/success.http +0 -21
- data/spec/files/domains/domains/success.http +0 -21
- data/spec/files/domains/enable_auto_renewal/success.http +0 -21
- data/spec/files/domains/enable_whois_privacy/success.http +0 -22
- data/spec/files/domains/forward/success.http +0 -21
- data/spec/files/domains/forwards/success.http +0 -21
- data/spec/files/domains/memberships/success.http +0 -21
- data/spec/files/domains/notfound-domain.http +0 -19
- data/spec/files/domains/notfound-forward.http +0 -19
- data/spec/files/domains/notfound-membership.http +0 -19
- data/spec/files/domains/record/success.http +0 -19
- data/spec/files/domains/records/success.http +0 -19
- data/spec/files/domains/update_record/success.http +0 -21
- data/spec/files/domains/zone/success.http +0 -21
- data/spec/files/nameservers/change/success.http +0 -23
- data/spec/files/nameservers/deregister/success.http +0 -17
- data/spec/files/nameservers/name_servers/success.http +0 -23
- data/spec/files/nameservers/notfound-domain.http +0 -19
- data/spec/files/nameservers/register/badrequest-valueerror.http +0 -19
- data/spec/files/nameservers/register/success.http +0 -21
- data/spec/files/nameservers/vanity_name_servers/disabled.http +0 -23
- data/spec/files/nameservers/vanity_name_servers/enabled.http +0 -23
- data/spec/files/registrar/check/available.http +0 -19
- data/spec/files/registrar/check/registered.http +0 -21
- data/spec/files/registrar/extended_attributes/success.http +0 -21
- data/spec/files/registrar/prices/success.http +0 -21
- data/spec/files/registrar/register/badrequest-missingdomain.http +0 -19
- data/spec/files/registrar/register/badrequest-missingregistrant.http +0 -19
- data/spec/files/registrar/register/success.http +0 -21
- data/spec/files/registrar/renew/badrequest-missingrenewal.http +0 -19
- data/spec/files/registrar/renew/badrequest-unable.http +0 -19
- data/spec/files/registrar/renew/success.http +0 -21
- data/spec/files/registrar/transfer/success.http +0 -21
- data/spec/files/services/applied/success.http +0 -21
- data/spec/files/services/apply/success.http +0 -21
- data/spec/files/services/available/success.http +0 -21
- data/spec/files/services/notfound-service.http +0 -19
- data/spec/files/services/service/success.http +0 -21
- data/spec/files/services/services/success.http +0 -21
- data/spec/files/services/unapply/success.http +0 -21
- data/spec/files/subscriptions/subscription/success.http +0 -21
- data/spec/files/templates/apply_template/success.http +0 -21
- data/spec/files/templates/create_template/created.http +0 -22
- data/spec/files/templates/delete_template/success-204.http +0 -21
- data/spec/files/templates/delete_template/success.http +0 -21
- data/spec/files/templates/notfound-template.http +0 -19
- data/spec/files/templates/template/success.http +0 -21
- data/spec/files/templates/templates/success.http +0 -21
- data/spec/files/templates/update_template/success.http +0 -21
- data/spec/files/templates_records/create_record/created.http +0 -22
- data/spec/files/templates_records/delete_record/success-204.http +0 -19
- data/spec/files/templates_records/delete_record/success.http +0 -21
- data/spec/files/templates_records/notfound-template-record.http +0 -19
- data/spec/files/templates_records/record/success.http +0 -21
- data/spec/files/templates_records/records/success.http +0 -21
- data/spec/files/templates_records/update_record/success.http +0 -21
- data/spec/files/users/user/success.http +0 -21
@@ -1,100 +0,0 @@
|
|
1
|
-
module Dnsimple
|
2
|
-
class Client
|
3
|
-
module Certificates
|
4
|
-
|
5
|
-
# Lists the certificates for a domain.
|
6
|
-
#
|
7
|
-
# @see http://developer.dnsimple.com/v1/domains/certificates/#list
|
8
|
-
#
|
9
|
-
# @param [#to_s] domain The domain id or domain name.
|
10
|
-
# @param [Hash] options
|
11
|
-
# @return [Array<Struct::Certificate>]
|
12
|
-
#
|
13
|
-
# @raise [NotFoundError]
|
14
|
-
# @raise [RequestError] When the request fails.
|
15
|
-
def certificates(domain, options = {})
|
16
|
-
response = client.get(Client.versioned("/domains/#{domain}/certificates"), options)
|
17
|
-
|
18
|
-
response.map { |r| Struct::Certificate.new(r["certificate"]) }
|
19
|
-
end
|
20
|
-
alias :list :certificates
|
21
|
-
alias :list_certificates :certificates
|
22
|
-
|
23
|
-
# Gets a certificate for a domain.
|
24
|
-
#
|
25
|
-
# @see http://developer.dnsimple.com/v1/domains/certificates/#get
|
26
|
-
#
|
27
|
-
# @param [#to_s] domain The domain id or domain name.
|
28
|
-
# @param [Fixnum] certificate_id The certificate ID.
|
29
|
-
# @return [Struct::Certificate]
|
30
|
-
#
|
31
|
-
# @raise [NotFoundError]
|
32
|
-
# @raise [RequestError] When the request fails.
|
33
|
-
def certificate(domain, certificate_id, options = {})
|
34
|
-
response = client.get(Client.versioned("/domains/#{domain}/certificates/#{certificate_id}"), options)
|
35
|
-
|
36
|
-
Struct::Certificate.new(response["certificate"])
|
37
|
-
end
|
38
|
-
|
39
|
-
# Purchases a certificate under the given domain with the given name.
|
40
|
-
#
|
41
|
-
# The name will be appended to the domain name, and thus should only be the subdomain part.
|
42
|
-
#
|
43
|
-
# Invoking this method DNSimple will immediately charge
|
44
|
-
# your credit card on file at DNSimple for the full certificate price.
|
45
|
-
#
|
46
|
-
# For wildcard certificates an asterisk must appear in the name.
|
47
|
-
#
|
48
|
-
# @example Purchase a single-hostname certificate
|
49
|
-
# Dnsimple::Certificate.purchase(domain, 'www', contact)
|
50
|
-
#
|
51
|
-
# @example Purchase a wildcard certificate
|
52
|
-
# Dnsimple::Certificate.purchase(domain, '*', contact)
|
53
|
-
#
|
54
|
-
# @param [#to_s] domain The domain id or domain name.
|
55
|
-
# @param [String] name The certificate name.
|
56
|
-
# @param [Fixnum] contact_id The ID of the contact associated to the certificate.
|
57
|
-
# @return [Struct::Certificate]
|
58
|
-
#
|
59
|
-
# @raise [NotFoundError]
|
60
|
-
# @raise [RequestError] When the request fails.
|
61
|
-
def purchase(domain, name, contact_id, options = {})
|
62
|
-
options = Extra.deep_merge(options, { certificate: { name: name, contact_id: contact_id }})
|
63
|
-
response = client.post(Client.versioned("/domains/#{domain}/certificates"), options)
|
64
|
-
|
65
|
-
Struct::Certificate.new(response["certificate"])
|
66
|
-
end
|
67
|
-
|
68
|
-
# Configures a certificate.
|
69
|
-
#
|
70
|
-
# @param [#to_s] domain The domain id or domain name.
|
71
|
-
# @param [Fixnum] certificate_id The certificate ID.
|
72
|
-
# @return [Struct::Certificate]
|
73
|
-
#
|
74
|
-
# @raise [NotFoundError]
|
75
|
-
# @raise [RequestError] When the request fails.
|
76
|
-
def configure(domain, certificate_id, options = {})
|
77
|
-
response = client.put(Client.versioned("/domains/#{domain}/certificates/#{certificate_id}/configure"), options)
|
78
|
-
|
79
|
-
Struct::Certificate.new(response["certificate"])
|
80
|
-
end
|
81
|
-
|
82
|
-
# Submits a certificate for approval.
|
83
|
-
#
|
84
|
-
# @param [#to_s] domain The domain id or domain name.
|
85
|
-
# @param [Fixnum] certificate_id The certificate ID.
|
86
|
-
# @param [Fixnum] email The approver email.
|
87
|
-
#
|
88
|
-
# @return [Struct::Certificate]
|
89
|
-
# @raise [NotFoundError]
|
90
|
-
# @raise [RequestError] When the request fails.
|
91
|
-
def submit(domain, certificate_id, email, options = {})
|
92
|
-
options = options.merge(certificate: { approver_email: email })
|
93
|
-
response = client.put(Client.versioned("/domains/#{domain}/certificates/#{certificate_id}/submit"), options)
|
94
|
-
|
95
|
-
Struct::Certificate.new(response["certificate"])
|
96
|
-
end
|
97
|
-
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Dnsimple
|
2
|
-
class Client
|
3
|
-
module DomainsAutorenewal
|
4
|
-
|
5
|
-
# Enables auto-renewal for a domain.
|
6
|
-
#
|
7
|
-
# @see http://developer.dnsimple.com/v1/registrar/auto-renewal/#enable
|
8
|
-
#
|
9
|
-
# @param [#to_s] domain The domain id or domain name.
|
10
|
-
# @return [Struct::Domain]
|
11
|
-
#
|
12
|
-
# @raise [RequestError] When the request fails.
|
13
|
-
def enable_auto_renewal(domain, options = {})
|
14
|
-
response = client.post(Client.versioned("/domains/#{domain}/auto_renewal"), options)
|
15
|
-
|
16
|
-
Struct::Domain.new(response["domain"])
|
17
|
-
end
|
18
|
-
|
19
|
-
# Disables auto-renewal for a domain.
|
20
|
-
#
|
21
|
-
# @see http://developer.dnsimple.com/v1/registrar/auto-renewal/#disable
|
22
|
-
#
|
23
|
-
# @param [#to_s] domain The domain id or domain name.
|
24
|
-
# @return [Struct::Domain]
|
25
|
-
#
|
26
|
-
# @raise [RequestError] When the request fails.
|
27
|
-
def disable_auto_renewal(domain, options = {})
|
28
|
-
response = client.delete(Client.versioned("/domains/#{domain}/auto_renewal"), options)
|
29
|
-
|
30
|
-
Struct::Domain.new(response["domain"])
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
module Dnsimple
|
2
|
-
class Client
|
3
|
-
module DomainsForwards
|
4
|
-
|
5
|
-
# Lists the email forwards for a domain.
|
6
|
-
#
|
7
|
-
# @see http://developer.dnsimple.com/v1/domains/forwards/#list
|
8
|
-
#
|
9
|
-
# @param [#to_s] domain The domain id or domain name.
|
10
|
-
# @return [Array<Struct::EmailForward>]
|
11
|
-
#
|
12
|
-
# @raise [NotFoundError]
|
13
|
-
# @raise [RequestError] When the request fails.
|
14
|
-
def email_forwards(domain, options = {})
|
15
|
-
response = client.get(Client.versioned("/domains/#{domain}/email_forwards"), options)
|
16
|
-
|
17
|
-
response.map { |r| Struct::EmailForward.new(r["email_forward"]) }
|
18
|
-
end
|
19
|
-
alias :list_email_forwards :email_forwards
|
20
|
-
|
21
|
-
# Creates an email forward for a domain.
|
22
|
-
#
|
23
|
-
# @see http://developer.dnsimple.com/v1/domains/forwards/#create
|
24
|
-
#
|
25
|
-
# @param [#to_s] domain The domain id or domain name.
|
26
|
-
# @param [Hash] attributes
|
27
|
-
# @return [Struct::EmailForward]
|
28
|
-
#
|
29
|
-
# @raise [NotFoundError]
|
30
|
-
# @raise [RequestError] When the request fails.
|
31
|
-
def create_email_forward(domain, attributes = {}, options = {})
|
32
|
-
Extra.validate_mandatory_attributes(attributes, [:from, :to])
|
33
|
-
options = options.merge({ email_forward: attributes })
|
34
|
-
response = client.post(Client.versioned("/domains/#{domain}/email_forwards"), options)
|
35
|
-
|
36
|
-
Struct::EmailForward.new(response["email_forward"])
|
37
|
-
end
|
38
|
-
|
39
|
-
# Gets an email forward for a domain.
|
40
|
-
#
|
41
|
-
# @see http://developer.dnsimple.com/v1/domains/forwards/#get
|
42
|
-
#
|
43
|
-
# @param [#to_s] domain The domain id or domain name.
|
44
|
-
# @param [Fixnum] forward The forward id.
|
45
|
-
# @return [Struct::EmailForward]
|
46
|
-
#
|
47
|
-
# @raise [NotFoundError]
|
48
|
-
# @raise [RequestError] When the request fails.
|
49
|
-
def email_forward(domain, forward, options = {})
|
50
|
-
response = client.get(Client.versioned("/domains/#{domain}/email_forwards/#{forward}"), options)
|
51
|
-
|
52
|
-
Struct::EmailForward.new(response["email_forward"])
|
53
|
-
end
|
54
|
-
|
55
|
-
# Deletes an email forward for a domain.
|
56
|
-
#
|
57
|
-
# @see http://developer.dnsimple.com/v1/domains/forwards/#delete
|
58
|
-
#
|
59
|
-
# @param [#to_s] domain The domain id or domain name.
|
60
|
-
# @param [Fixnum] forward The forward id.
|
61
|
-
# @return [void]
|
62
|
-
#
|
63
|
-
# @raise [NotFoundError]
|
64
|
-
# @raise [RequestError] When the request fails.
|
65
|
-
def delete_email_forward(domain, forward, options = {})
|
66
|
-
client.delete(Client.versioned("/domains/#{domain}/email_forwards/#{forward}"), options)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
module Dnsimple
|
2
|
-
class Client
|
3
|
-
module DomainsPrivacy
|
4
|
-
|
5
|
-
# Enables WHOIS privacy for a domain.
|
6
|
-
#
|
7
|
-
# @see http://developer.dnsimple.com/v1/registrar/privacy/#enable
|
8
|
-
#
|
9
|
-
# @param [#to_s] domain The domain id or domain name.
|
10
|
-
# @return [Struct::WhoisPrivacy]
|
11
|
-
#
|
12
|
-
# @raise [RequestError] When the request fails.
|
13
|
-
def enable_whois_privacy(domain, options = {})
|
14
|
-
response = client.post(Client.versioned("domains/#{domain}/whois_privacy"), options)
|
15
|
-
|
16
|
-
Struct::WhoisPrivacy.new(response["whois_privacy"])
|
17
|
-
end
|
18
|
-
|
19
|
-
# Disables WHOIS privacy for a domain.
|
20
|
-
#
|
21
|
-
# @see http://developer.dnsimple.com/v1/registrar/privacy/#disable
|
22
|
-
#
|
23
|
-
# @param [#to_s] domain The domain id or domain name.
|
24
|
-
# @return [Struct::WhoisPrivacy]
|
25
|
-
#
|
26
|
-
# @raise [RequestError] When the request fails.
|
27
|
-
def disable_whois_privacy(domain, options = {})
|
28
|
-
response = client.delete(Client.versioned("domains/#{domain}/whois_privacy"), options)
|
29
|
-
|
30
|
-
Struct::WhoisPrivacy.new(response["whois_privacy"])
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
module Dnsimple
|
2
|
-
class Client
|
3
|
-
module DomainsRecords
|
4
|
-
|
5
|
-
# Lists the records for a domain.
|
6
|
-
#
|
7
|
-
# @see http://developer.dnsimple.com/v1/domains/records/#list
|
8
|
-
#
|
9
|
-
# @param [#to_s] domain The domain id or domain name.
|
10
|
-
# @param [Hash] options
|
11
|
-
# @return [Array<Struct::Record>]
|
12
|
-
#
|
13
|
-
# @raise [NotFoundError]
|
14
|
-
# @raise [RequestError] When the request fails.
|
15
|
-
def records(domain, options = {})
|
16
|
-
response = client.get(Client.versioned("domains/#{domain}/records"), options)
|
17
|
-
|
18
|
-
response.map { |r| Struct::Record.new(r["record"]) }
|
19
|
-
end
|
20
|
-
alias :list_record :records
|
21
|
-
|
22
|
-
# Creates a record for a domain.
|
23
|
-
#
|
24
|
-
# @see http://developer.dnsimple.com/v1/domains/records/#create
|
25
|
-
#
|
26
|
-
# @param [#to_s] domain The domain id or domain name.
|
27
|
-
# @param [Hash] attributes
|
28
|
-
# @return [Struct::Record]
|
29
|
-
#
|
30
|
-
# @raise [NotFoundError]
|
31
|
-
# @raise [RequestError] When the request fails.
|
32
|
-
def create_record(domain, attributes = {}, options = {})
|
33
|
-
Extra.validate_mandatory_attributes(attributes, [:name, :record_type, :content])
|
34
|
-
options = options.merge({ record: attributes })
|
35
|
-
response = client.post(Client.versioned("domains/#{domain}/records"), options)
|
36
|
-
|
37
|
-
Struct::Record.new(response["record"])
|
38
|
-
end
|
39
|
-
|
40
|
-
# Gets a record for a domain.
|
41
|
-
#
|
42
|
-
# @see http://developer.dnsimple.com/v1/domains/records/#get
|
43
|
-
#
|
44
|
-
# @param [#to_s] domain The domain id or domain name.
|
45
|
-
# @param [Fixnum] record The record id.
|
46
|
-
# @return [Struct::Record]
|
47
|
-
#
|
48
|
-
# @raise [NotFoundError]
|
49
|
-
# @raise [RequestError] When the request fails.
|
50
|
-
def record(domain, record, options = {})
|
51
|
-
response = client.get(Client.versioned("domains/#{domain}/records/#{record}"), options)
|
52
|
-
|
53
|
-
Struct::Record.new(response["record"])
|
54
|
-
end
|
55
|
-
|
56
|
-
# Updates a record for a domain.
|
57
|
-
#
|
58
|
-
# @see http://developer.dnsimple.com/v1/domains/records/#update
|
59
|
-
#
|
60
|
-
# @param [#to_s] domain The domain id or domain name.
|
61
|
-
# @param [Fixnum] record The record id.
|
62
|
-
# @param [Hash] attributes
|
63
|
-
# @return [Struct::Record]
|
64
|
-
#
|
65
|
-
# @raise [NotFoundError]
|
66
|
-
# @raise [RequestError] When the request fails.
|
67
|
-
def update_record(domain, record, attributes = {}, options = {})
|
68
|
-
options = options.merge({ record: attributes })
|
69
|
-
response = client.put(Client.versioned("domains/#{domain}/records/#{record}"), options)
|
70
|
-
|
71
|
-
Struct::Record.new(response["record"])
|
72
|
-
end
|
73
|
-
|
74
|
-
# Deletes a record for a domain.
|
75
|
-
#
|
76
|
-
# @see http://developer.dnsimple.com/v1/domains/records/#delete
|
77
|
-
#
|
78
|
-
# @param [#to_s] domain The domain id or domain name.
|
79
|
-
# @param [Fixnum] record The record id.
|
80
|
-
# @return [void]
|
81
|
-
#
|
82
|
-
# @raise [NotFoundError]
|
83
|
-
# @raise [RequestError] When the request fails.
|
84
|
-
def delete_record(domain, record, options = {})
|
85
|
-
client.delete(Client.versioned("domains/#{domain}/records/#{record}"), options)
|
86
|
-
end
|
87
|
-
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
module Dnsimple
|
2
|
-
class Client
|
3
|
-
module DomainsSharing
|
4
|
-
|
5
|
-
# Lists the memberships.
|
6
|
-
#
|
7
|
-
# @see http://developer.dnsimple.com/v1/domains/sharing/#list
|
8
|
-
#
|
9
|
-
# @param [#to_s] domain The domain id or domain name.
|
10
|
-
# @return [Array<Struct::Membership>]
|
11
|
-
#
|
12
|
-
# @raise [NotFoundError]
|
13
|
-
# @raise [RequestError] When the request fails.
|
14
|
-
def memberships(domain, options = {})
|
15
|
-
response = client.get(Client.versioned("/domains/#{domain}/memberships"), options)
|
16
|
-
|
17
|
-
response.map { |r| Struct::Membership.new(r["membership"]) }
|
18
|
-
end
|
19
|
-
alias :list_memberships :memberships
|
20
|
-
|
21
|
-
# Shares a domain.
|
22
|
-
#
|
23
|
-
# @see http://developer.dnsimple.com/v1/domains/sharing/#create
|
24
|
-
#
|
25
|
-
# @param [#to_s] domain The domain id or domain name.
|
26
|
-
# @param [String] email
|
27
|
-
# @return [Struct::Membership]
|
28
|
-
#
|
29
|
-
# @raise [NotFoundError]
|
30
|
-
# @raise [RequestError] When the request fails.
|
31
|
-
def create_membership(domain, email, options = {})
|
32
|
-
options = options.merge({ membership: { email: email }})
|
33
|
-
response = client.post(Client.versioned("/domains/#{domain}/memberships"), options)
|
34
|
-
|
35
|
-
Struct::Membership.new(response["membership"])
|
36
|
-
end
|
37
|
-
|
38
|
-
# Un-shares a domain.
|
39
|
-
#
|
40
|
-
# @see http://developer.dnsimple.com/v1/domains/sharing/#delete
|
41
|
-
#
|
42
|
-
# @param [#to_s] domain The domain id or domain name.
|
43
|
-
# @param [Fixnum] membership The membership id.
|
44
|
-
# @return [void]
|
45
|
-
#
|
46
|
-
# @raise [NotFoundError]
|
47
|
-
# @raise [RequestError] When the request fails.
|
48
|
-
def delete_membership(domain, membership, options = {})
|
49
|
-
client.delete(Client.versioned("/domains/#{domain}/memberships/#{membership}"), options)
|
50
|
-
end
|
51
|
-
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Dnsimple
|
2
|
-
class Client
|
3
|
-
module DomainsZones
|
4
|
-
|
5
|
-
# Gets a domain zone as zone file.
|
6
|
-
#
|
7
|
-
# @see http://developer.dnsimple.com/v1/domains/zones/#get
|
8
|
-
#
|
9
|
-
# @param [#to_s] domain The domain id or domain name.
|
10
|
-
# @return [String]
|
11
|
-
#
|
12
|
-
# @raise [NotFoundError]
|
13
|
-
# @raise [RequestError] When the request fails.
|
14
|
-
def zone(domain, options = {})
|
15
|
-
response = client.get(Client.versioned("/domains/#{domain}/zone"), options)
|
16
|
-
|
17
|
-
response["zone"]
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,71 +0,0 @@
|
|
1
|
-
module Dnsimple
|
2
|
-
class Client
|
3
|
-
module NameServers
|
4
|
-
|
5
|
-
# Lists the name servers for a domain.
|
6
|
-
#
|
7
|
-
# @see http://developer.dnsimple.com/v1/domains/nameservers/#list
|
8
|
-
#
|
9
|
-
# @param [#to_s] domain The domain id or domain name.
|
10
|
-
# @return [Array<String>] The delegates name servers.
|
11
|
-
#
|
12
|
-
# @raise [NotFoundError]
|
13
|
-
# @raise [RequestError] When the request fails.
|
14
|
-
def name_servers(domain, options = {})
|
15
|
-
response = client.get(Client.versioned("/domains/#{domain}/name_servers"), options)
|
16
|
-
|
17
|
-
response.parsed_response
|
18
|
-
end
|
19
|
-
alias :list :name_servers
|
20
|
-
alias :list_name_servers :name_servers
|
21
|
-
|
22
|
-
# Changes the name servers for a domain.
|
23
|
-
#
|
24
|
-
# @see http://developer.dnsimple.com/v1/domains/nameservers/#change
|
25
|
-
#
|
26
|
-
# @param [#to_s] domain The domain id or domain name.
|
27
|
-
# @param [Array<String>] servers The name server list.
|
28
|
-
# @return [Array<String>] The delegates name servers.
|
29
|
-
#
|
30
|
-
# @raise [NotFoundError]
|
31
|
-
# @raise [RequestError] When the request fails.
|
32
|
-
def change(domain, servers, options = {})
|
33
|
-
servers = servers.inject({}) { |hash, server| hash.merge("ns#{hash.length + 1}" => server) }
|
34
|
-
options = options.merge({ name_servers: servers })
|
35
|
-
response = client.post(Client.versioned("/domains/#{domain}/name_servers"), options)
|
36
|
-
|
37
|
-
response.parsed_response
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
# Registers a name server at the registry.
|
42
|
-
#
|
43
|
-
# @see http://developer.dnsimple.com/v1/nameservers/#register
|
44
|
-
#
|
45
|
-
# @param [#to_s] domain The domain id or domain name.
|
46
|
-
# @param [String] name The hostname to register.
|
47
|
-
# @param [String] ip The hostname IP address.
|
48
|
-
# @return [void]
|
49
|
-
#
|
50
|
-
# @raise [RequestError] When the request fails.
|
51
|
-
def register(domain, name, ip, options = {})
|
52
|
-
options = options.merge({ name_server: { name: name, ip: ip } })
|
53
|
-
client.post(Client.versioned("/domains/#{domain}/registry_name_servers"), options)
|
54
|
-
end
|
55
|
-
|
56
|
-
# De-registers a name server at the registry.
|
57
|
-
#
|
58
|
-
# @see http://developer.dnsimple.com/v1/nameservers/#deregister
|
59
|
-
#
|
60
|
-
# @param [#to_s] domain The domain id or domain name.
|
61
|
-
# @param [String] name The hostname to register.
|
62
|
-
# @return [void]
|
63
|
-
#
|
64
|
-
# @raise [RequestError] When the request fails.
|
65
|
-
def deregister(domain, name, options = {})
|
66
|
-
client.delete(Client.versioned("/domains/#{domain}/registry_name_servers/#{name}"), options)
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|