dnsimple 3.1.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -0
- data/.rubocop_dnsimple.yml +24 -18
- data/CHANGELOG.md +17 -5
- data/CONTRIBUTING.md +2 -2
- data/Gemfile +0 -1
- data/README.md +14 -3
- data/dnsimple.gemspec +1 -1
- data/lib/dnsimple/client.rb +5 -5
- data/lib/dnsimple/client/certificates.rb +89 -0
- data/lib/dnsimple/client/clients.rb +37 -0
- data/lib/dnsimple/client/collaborators.rb +76 -0
- data/lib/dnsimple/client/domains_pushes.rb +97 -0
- data/lib/dnsimple/client/registrar.rb +2 -2
- data/lib/dnsimple/client/registrar_delegation.rb +42 -0
- data/lib/dnsimple/client/services_domains.rb +82 -0
- data/lib/dnsimple/client/templates.rb +0 -5
- data/lib/dnsimple/client/templates_domains.rb +29 -0
- data/lib/dnsimple/client/vanity_name_servers.rb +47 -0
- data/lib/dnsimple/client/zones.rb +17 -0
- data/lib/dnsimple/client/zones_records.rb +9 -9
- data/lib/dnsimple/struct.rb +6 -1
- data/lib/dnsimple/struct/certificate.rb +37 -0
- data/lib/dnsimple/struct/certificate_bundle.rb +24 -0
- data/lib/dnsimple/struct/collaborator.rb +34 -0
- data/lib/dnsimple/struct/domain_push.rb +28 -0
- data/lib/dnsimple/struct/tld.rb +12 -0
- data/lib/dnsimple/struct/zone_file.rb +10 -0
- data/lib/dnsimple/struct/{record.rb → zone_record.rb} +4 -1
- data/lib/dnsimple/version.rb +1 -1
- data/spec/dnsimple/client/accounts_spec.rb +1 -1
- data/spec/dnsimple/client/certificates_spec.rb +206 -0
- data/spec/dnsimple/client/collaborators_spec.rb +162 -0
- data/spec/dnsimple/client/contacts_spec.rb +5 -5
- data/spec/dnsimple/client/domains_email_forwards_spec.rb +5 -5
- data/spec/dnsimple/client/domains_pushes_spec.rb +162 -0
- data/spec/dnsimple/client/domains_spec.rb +6 -6
- data/spec/dnsimple/client/registrar_delegation_spec.rb +51 -0
- data/spec/dnsimple/client/registrar_spec.rb +6 -6
- data/spec/dnsimple/client/registrar_whois_privacy_spec.rb +4 -4
- data/spec/dnsimple/client/services_domains_spec.rb +115 -0
- data/spec/dnsimple/client/services_spec.rb +1 -1
- data/spec/dnsimple/client/templates_domains_spec.rb +32 -0
- data/spec/dnsimple/client/templates_records_spec.rb +1 -1
- data/spec/dnsimple/client/templates_spec.rb +25 -1
- data/spec/dnsimple/client/tlds_spec.rb +8 -4
- data/spec/dnsimple/client/vanity_name_servers_spec.rb +54 -0
- data/spec/dnsimple/client/webhooks_spec.rb +2 -2
- data/spec/dnsimple/client/zones_records_spec.rb +34 -23
- data/spec/dnsimple/client/zones_spec.rb +40 -4
- data/spec/fixtures.http/acceptPush/success.http +17 -0
- data/spec/fixtures.http/addCollaborator/invite-success.http +21 -0
- data/spec/fixtures.http/addCollaborator/success.http +21 -0
- data/spec/fixtures.http/appliedServices/success.http +21 -0
- data/spec/fixtures.http/applyService/created.http +17 -0
- data/spec/fixtures.http/applyTemplate/success.http +13 -0
- data/spec/fixtures.http/changeDomainDelegationFromVanity/success.http +17 -0
- data/spec/fixtures.http/changeDomainDelegationToVanity/success.http +21 -0
- data/spec/fixtures.http/createZoneRecord/created.http +13 -9
- data/spec/fixtures.http/disableVanityNameServers/success.http +17 -0
- data/spec/fixtures.http/downloadCertificate/success.http +21 -0
- data/spec/fixtures.http/enableVanityNameServers/success.http +21 -0
- data/spec/fixtures.http/getCertificate/success.http +21 -0
- data/spec/fixtures.http/getCertificatePrivateKey/success.http +21 -0
- data/spec/fixtures.http/getTld/success.http +13 -9
- data/spec/fixtures.http/getZoneFile/success.http +21 -0
- data/spec/fixtures.http/getZoneRecord/success.http +13 -9
- data/spec/fixtures.http/initiatePush/success.http +21 -0
- data/spec/fixtures.http/{accounts → listAccounts}/success-account.http +0 -0
- data/spec/fixtures.http/{accounts → listAccounts}/success-user.http +0 -0
- data/spec/fixtures.http/listCertificates/success.http +21 -0
- data/spec/fixtures.http/listCollaborators/success.http +21 -0
- data/spec/fixtures.http/listPushes/success.http +21 -0
- data/spec/fixtures.http/listTlds/success.http +13 -9
- data/spec/fixtures.http/listZoneRecords/success.http +13 -9
- data/spec/fixtures.http/notfound-certificate.http +16 -0
- data/spec/fixtures.http/notfound-collaborator.http +16 -0
- data/spec/fixtures.http/notfound-contact.http +1 -1
- data/spec/fixtures.http/notfound-domainpush.http +12 -0
- data/spec/fixtures.http/rejectPush/success.http +17 -0
- data/spec/fixtures.http/removeCollaborator/success.http +17 -0
- data/spec/fixtures.http/unapplyService/success.http +17 -0
- data/spec/fixtures.http/updateZoneRecord/success.http +13 -9
- metadata +80 -10
@@ -0,0 +1,97 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
class Client
|
3
|
+
module DomainsPushes
|
4
|
+
|
5
|
+
# Initiate a push for the domain.
|
6
|
+
#
|
7
|
+
# @see https://developer.dnsimple.com/v2/domains/pushes/#initiate
|
8
|
+
#
|
9
|
+
# @example Initiate a domain pushe for example.com:
|
10
|
+
# client.domains.initiate_push(1010, "example.com", new_account_email: "admin@target-account.test")
|
11
|
+
#
|
12
|
+
# @param [Fixnum] account_id the account ID
|
13
|
+
# @param [#to_s] domain_id The domain ID or domain name
|
14
|
+
# @param [Hash] attributes
|
15
|
+
# @option attributes [String] :new_account_email the target account email (mandatory)
|
16
|
+
# @param [Hash] options
|
17
|
+
# @return [Dnsimple::Response<Dnsimple::Struct::DomainPush>]
|
18
|
+
#
|
19
|
+
# @raise [Dnsimple::RequestError]
|
20
|
+
def initiate_push(account_id, domain_id, attributes, options = {})
|
21
|
+
Extra.validate_mandatory_attributes(attributes, [:new_account_email])
|
22
|
+
response = client.post(Client.versioned("/%s/domains/%s/pushes" % [account_id, domain_id]), attributes, options)
|
23
|
+
|
24
|
+
Dnsimple::Response.new(response, Struct::DomainPush.new(response["data"]))
|
25
|
+
end
|
26
|
+
|
27
|
+
# Lists the pushes for the domain.
|
28
|
+
#
|
29
|
+
# @see https://developer.dnsimple.com/v2/domains/pushes/#list
|
30
|
+
#
|
31
|
+
# @example List domain pushes in the first page
|
32
|
+
# client.domains.pushes(2020)
|
33
|
+
#
|
34
|
+
# @example List domain pushes, provide a specific page
|
35
|
+
# client.domains.pushes(2020, page: 2)
|
36
|
+
#
|
37
|
+
# @param [Fixnum] account_id the account ID
|
38
|
+
# @param [Hash] options
|
39
|
+
# @option options [Integer] :page current page (pagination)
|
40
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
41
|
+
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::DomainPush>]
|
42
|
+
#
|
43
|
+
# @raise [Dnsimple::NotFoundError]
|
44
|
+
# @raise [Dnsimple::RequestError]
|
45
|
+
def pushes(account_id, options = {})
|
46
|
+
response = client.get(Client.versioned("/%s/pushes" % [account_id]), Options::ListOptions.new(options))
|
47
|
+
|
48
|
+
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::DomainPush.new(r) })
|
49
|
+
end
|
50
|
+
|
51
|
+
# Accept a domain push.
|
52
|
+
#
|
53
|
+
# @see https://developer.dnsimple.com/v2/domains/pushes/#accept
|
54
|
+
#
|
55
|
+
# @example Accept a domain push in the target account:
|
56
|
+
# client.domains.accept_push(2020, 1, contact_id: 2)
|
57
|
+
#
|
58
|
+
# @param [Fixnum] account_id the target account ID
|
59
|
+
# @param [Fixnum] push_id the domain push ID
|
60
|
+
# @param [Hash] options
|
61
|
+
# @param [Hash] attributes
|
62
|
+
# @option attributes [Integer] :contact_id the contact ID (mandatory)
|
63
|
+
# @return [Dnsimple::Response<nil>]
|
64
|
+
#
|
65
|
+
# @raise [Dnsimple::NotFoundError]
|
66
|
+
# @raise [Dnsimple::RequestError]
|
67
|
+
def accept_push(account_id, push_id, attributes, options = {})
|
68
|
+
Extra.validate_mandatory_attributes(attributes, [:contact_id])
|
69
|
+
response = client.post(Client.versioned("/%s/pushes/%s" % [account_id, push_id]), attributes, options)
|
70
|
+
|
71
|
+
Dnsimple::Response.new(response, nil)
|
72
|
+
end
|
73
|
+
|
74
|
+
# Reject a domain push.
|
75
|
+
#
|
76
|
+
# @see https://developer.dnsimple.com/v2/domains/pushes/#reject
|
77
|
+
#
|
78
|
+
# @example Reject a domain push in the target account:
|
79
|
+
# client.domains.reject_push(2020, 1, contact_id: 2)
|
80
|
+
#
|
81
|
+
# @param [Fixnum] account_id the target account ID
|
82
|
+
# @param [Fixnum] push_id the domain push ID
|
83
|
+
# @param [Hash] options
|
84
|
+
# @return [Dnsimple::Response<nil>]
|
85
|
+
#
|
86
|
+
# @raise [Dnsimple::NotFoundError]
|
87
|
+
# @raise [Dnsimple::RequestError]
|
88
|
+
def reject_push(account_id, push_id, options = {})
|
89
|
+
response = client.delete(Client.versioned("/%s/pushes/%s" % [account_id, push_id]), options)
|
90
|
+
|
91
|
+
Dnsimple::Response.new(response, nil)
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
@@ -71,7 +71,7 @@ module Dnsimple
|
|
71
71
|
# @see https://developer.dnsimple.com/v2/registrar/#transfer
|
72
72
|
#
|
73
73
|
# @example Initiate the transfer for example.com using the contact 1234 as registrant:
|
74
|
-
# client.registrar.transfer(1010, "example.com", registrant_id: 1234,
|
74
|
+
# client.registrar.transfer(1010, "example.com", registrant_id: 1234, auth_code: "x1y2z3")
|
75
75
|
#
|
76
76
|
# @param [Fixnum] account_id the account ID
|
77
77
|
# @param [#to_s] domain_name the domain name to transfer
|
@@ -90,7 +90,7 @@ module Dnsimple
|
|
90
90
|
|
91
91
|
# Requests the transfer of a domain out of DNSimple.
|
92
92
|
#
|
93
|
-
# @see https://developer.dnsimple.com/v2/registrar/#
|
93
|
+
# @see https://developer.dnsimple.com/v2/registrar/#transfer-out
|
94
94
|
#
|
95
95
|
# @example Request to transfer of example.com out of DNSimple:
|
96
96
|
# client.registrar.transfer_out(1010, "example.com")
|
@@ -44,6 +44,48 @@ module Dnsimple
|
|
44
44
|
Dnsimple::Response.new(response, response["data"])
|
45
45
|
end
|
46
46
|
|
47
|
+
# Enable vanity name servers for the domain.
|
48
|
+
#
|
49
|
+
# @see https://developer.dnsimple.com/v2/registrar/delegation/#delegateToVanity
|
50
|
+
#
|
51
|
+
# @example Enable vanity name servers for example.com:
|
52
|
+
# client.registrar.change_domain_delegation_to_vanity(1010, "example.com",
|
53
|
+
# ["ns1.example.com", "ns2.example.com", "ns3.example.com", "ns4.example.com"])
|
54
|
+
#
|
55
|
+
# @param [Fixnum] account_id the account ID
|
56
|
+
# @param [#to_s] domain_name the domain name to check
|
57
|
+
# @param [Array] attributes
|
58
|
+
# @param [Hash] options
|
59
|
+
# @return [Dnsimple::Response<Array>]
|
60
|
+
#
|
61
|
+
# @raise [RequestError] When the request fails.
|
62
|
+
def change_domain_delegation_to_vanity(account_id, domain_name, attributes, options = {})
|
63
|
+
endpoint = Client.versioned("/%s/registrar/domains/%s/delegation/vanity" % [account_id, domain_name])
|
64
|
+
response = client.put(endpoint, attributes, options)
|
65
|
+
|
66
|
+
Dnsimple::Response.new(response, response["data"])
|
67
|
+
end
|
68
|
+
|
69
|
+
# Disable vanity name servers for the domain.
|
70
|
+
#
|
71
|
+
# @see https://developer.dnsimple.com/v2/registrar/delegation/#delegateFromVanity
|
72
|
+
#
|
73
|
+
# @example Disable vanity name servers for example.com:
|
74
|
+
# client.registrar.change_domain_delegation_from_vanity(1010, "example.com")
|
75
|
+
#
|
76
|
+
# @param [Fixnum] account_id the account ID
|
77
|
+
# @param [#to_s] domain_name the domain name to check
|
78
|
+
# @param [Hash] options
|
79
|
+
# @return [Dnsimple::Response<nil>]
|
80
|
+
#
|
81
|
+
# @raise [RequestError] When the request fails.
|
82
|
+
def change_domain_delegation_from_vanity(account_id, domain_name, options = {})
|
83
|
+
endpoint = Client.versioned("/%s/registrar/domains/%s/delegation/vanity" % [account_id, domain_name])
|
84
|
+
response = client.delete(endpoint, options)
|
85
|
+
|
86
|
+
Dnsimple::Response.new(response, response["data"])
|
87
|
+
end
|
88
|
+
|
47
89
|
end
|
48
90
|
end
|
49
91
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
class Client
|
3
|
+
module ServicesDomains
|
4
|
+
|
5
|
+
# Lists the one-click services applied to the domain.
|
6
|
+
#
|
7
|
+
# @see https://developer.dnsimple.com/v2/services/domains/#applied
|
8
|
+
#
|
9
|
+
# @example List applied one-click services for example.com:
|
10
|
+
# client.service.applied_services(1010, "example.com")
|
11
|
+
#
|
12
|
+
# @example List applied one-click services for example.com, provide a specific page:
|
13
|
+
# client.services.applied_services(1010, "example.com", page: 2)
|
14
|
+
#
|
15
|
+
# @example List applied one-click services for example.com, provide a sorting policy:
|
16
|
+
# client.services.applied_services(1010, "example.com", sort: "short_name:asc")
|
17
|
+
#
|
18
|
+
# @param [Fixnum] account_id the account ID
|
19
|
+
# @param [#to_s] domain_id the domain name
|
20
|
+
# @param [Hash] options the filtering and sorting options
|
21
|
+
# @option options [Integer] :page current page (pagination)
|
22
|
+
# @option options [Integer] :per_page number of entries to return (pagination)
|
23
|
+
# @option options [String] :sort sorting policy
|
24
|
+
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Service>]
|
25
|
+
#
|
26
|
+
# @raise [RequestError] When the request fails.
|
27
|
+
def applied_services(account_id, domain_id, options = {})
|
28
|
+
endpoint = Client.versioned("/%s/domains/%s/services" % [account_id, domain_id])
|
29
|
+
response = client.get(endpoint, Options::ListOptions.new(options))
|
30
|
+
|
31
|
+
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Service.new(r) })
|
32
|
+
end
|
33
|
+
|
34
|
+
# Apply a given one-click service to the domain.
|
35
|
+
#
|
36
|
+
# @see https://developer.dnsimple.com/v2/services/domains/#apply
|
37
|
+
#
|
38
|
+
# @example Apply one-click service service1 to example.com:
|
39
|
+
# client.domain_services.applied_services(1010, "example.com", "service1")
|
40
|
+
#
|
41
|
+
# @example Apply one-click service service1 to example.com, provide optional settings:
|
42
|
+
# client.domain_services.applied_services(1010, "example.com", "service1", app: "foo")
|
43
|
+
#
|
44
|
+
# @param [Fixnum] account_id the account ID
|
45
|
+
# @param [#to_s] service_id the service name (or ID)
|
46
|
+
# @param [#to_s] domain_id the domain name
|
47
|
+
# @param [Hash] settings optional settings to apply the one-click service
|
48
|
+
# @param [Hash] options
|
49
|
+
# @return [Dnsimple::Response<nil>]
|
50
|
+
#
|
51
|
+
# @raise [RequestError] When the request fails.
|
52
|
+
def apply_service(account_id, service_id, domain_id, settings = {}, options = {})
|
53
|
+
endpoint = Client.versioned("/%s/domains/%s/services/%s" % [account_id, domain_id, service_id])
|
54
|
+
response = client.post(endpoint, settings, options)
|
55
|
+
|
56
|
+
Dnsimple::Response.new(response, nil)
|
57
|
+
end
|
58
|
+
|
59
|
+
# Unapply a given one-click service from the domain.
|
60
|
+
#
|
61
|
+
# @see https://developer.dnsimple.com/v2/services/domains/#unapply
|
62
|
+
#
|
63
|
+
# @example Unapply one-click service service1 from example.com:
|
64
|
+
# client.domain_services.applied_services(1010, "example.com", "service1")
|
65
|
+
#
|
66
|
+
# @param [Fixnum] account_id the account ID
|
67
|
+
# @param [#to_s] service_id the service name (or ID)
|
68
|
+
# @param [#to_s] domain_id the domain name
|
69
|
+
# @param [Hash] options
|
70
|
+
# @return [Dnsimple::Response<nil>]
|
71
|
+
#
|
72
|
+
# @raise [RequestError] When the request fails.
|
73
|
+
def unapply_service(account_id, service_id, domain_id, options = {})
|
74
|
+
endpoint = Client.versioned("/%s/domains/%s/services/%s" % [account_id, domain_id, service_id])
|
75
|
+
response = client.delete(endpoint, options)
|
76
|
+
|
77
|
+
Dnsimple::Response.new(response, nil)
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -29,7 +29,6 @@ module Dnsimple
|
|
29
29
|
|
30
30
|
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Template.new(r) })
|
31
31
|
end
|
32
|
-
alias list templates
|
33
32
|
alias list_templates templates
|
34
33
|
|
35
34
|
# Lists ALL the templates in the account.
|
@@ -57,7 +56,6 @@ module Dnsimple
|
|
57
56
|
def all_templates(account_id, options = {})
|
58
57
|
paginate(:templates, account_id, options)
|
59
58
|
end
|
60
|
-
alias all all_templates
|
61
59
|
|
62
60
|
# Creates a template in the account.
|
63
61
|
#
|
@@ -78,7 +76,6 @@ module Dnsimple
|
|
78
76
|
|
79
77
|
Dnsimple::Response.new(response, Struct::Template.new(response["data"]))
|
80
78
|
end
|
81
|
-
alias create create_template
|
82
79
|
|
83
80
|
# Gets the template with specified ID.
|
84
81
|
#
|
@@ -120,7 +117,6 @@ module Dnsimple
|
|
120
117
|
|
121
118
|
Dnsimple::Response.new(response, Struct::Template.new(response["data"]))
|
122
119
|
end
|
123
|
-
alias update update_template
|
124
120
|
|
125
121
|
# Deletes a template from the account.
|
126
122
|
#
|
@@ -144,7 +140,6 @@ module Dnsimple
|
|
144
140
|
|
145
141
|
Dnsimple::Response.new(response, nil)
|
146
142
|
end
|
147
|
-
alias delete delete_template
|
148
143
|
|
149
144
|
end
|
150
145
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
class Client
|
3
|
+
module TemplatesDomains
|
4
|
+
|
5
|
+
# Applies a template to the domain.
|
6
|
+
#
|
7
|
+
# @see https://developer.dnsimple.com/v2/templates/domains/#apply
|
8
|
+
#
|
9
|
+
# @example Apply template 5401 for example.com in account 1010:
|
10
|
+
# client.templates.apply_template(1010, 5401, "example.com")
|
11
|
+
#
|
12
|
+
# @param [Fixnum] account_id The account ID
|
13
|
+
# @param [#to_s] template_id The template ID
|
14
|
+
# @param [#to_s] domain_id The Domain ID or name
|
15
|
+
# @param [Hash] options
|
16
|
+
# @return [Dnsimple::Response<nil>]
|
17
|
+
#
|
18
|
+
# @raise [Dnsimple::NotFoundError]
|
19
|
+
# @raise [Dnsimple::RequestError]
|
20
|
+
def apply_template(account_id, template_id, domain_id, options = {})
|
21
|
+
endpoint = Client.versioned("/%s/domains/%s/templates/%s" % [account_id, domain_id, template_id])
|
22
|
+
response = client.post(endpoint, options)
|
23
|
+
|
24
|
+
Dnsimple::Response.new(response, nil)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
class Client
|
3
|
+
module VanityNameServers
|
4
|
+
|
5
|
+
# Enable vanity name servers for the domain.
|
6
|
+
#
|
7
|
+
# @see https://developer.dnsimple.com/v2/vanity/#enable
|
8
|
+
#
|
9
|
+
# @example Enable vanity name servers for example.com:
|
10
|
+
# client.vanity_name_servers.enable(1010, "example.com")
|
11
|
+
#
|
12
|
+
# @param [Fixnum] account_id the account ID
|
13
|
+
# @param [#to_s] domain_name the domain name
|
14
|
+
# @param [Hash] options
|
15
|
+
# @return [Dnsimple::Response<Array>]
|
16
|
+
#
|
17
|
+
# @raise [RequestError] When the request fails.
|
18
|
+
def enable_vanity_name_servers(account_id, domain_name, options = {})
|
19
|
+
endpoint = Client.versioned("/%s/vanity/%s" % [account_id, domain_name])
|
20
|
+
response = client.put(endpoint, options)
|
21
|
+
|
22
|
+
Dnsimple::Response.new(response, response["data"])
|
23
|
+
end
|
24
|
+
|
25
|
+
# Disable vanity name servers for the domain.
|
26
|
+
#
|
27
|
+
# @see https://developer.dnsimple.com/v2/vanity/#disable
|
28
|
+
#
|
29
|
+
# @example Disable vanity name servers for example.com:
|
30
|
+
# client.vanity_name_servers.disable(1010, "example.com")
|
31
|
+
#
|
32
|
+
# @param [Fixnum] account_id the account ID
|
33
|
+
# @param [#to_s] domain_name the domain name
|
34
|
+
# @param [Hash] options
|
35
|
+
# @return [Dnsimple::Response<nil>]
|
36
|
+
#
|
37
|
+
# @raise [RequestError] When the request fails.
|
38
|
+
def disable_vanity_name_servers(account_id, domain_name, options = {})
|
39
|
+
endpoint = Client.versioned("/%s/vanity/%s" % [account_id, domain_name])
|
40
|
+
response = client.delete(endpoint, options)
|
41
|
+
|
42
|
+
Dnsimple::Response.new(response, response["data"])
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -77,6 +77,23 @@ module Dnsimple
|
|
77
77
|
Dnsimple::Response.new(response, Struct::Zone.new(response["data"]))
|
78
78
|
end
|
79
79
|
|
80
|
+
# Gets a zone file from the account.
|
81
|
+
#
|
82
|
+
# @see https://developer.dnsimple.com/v2/zones/#get-file
|
83
|
+
#
|
84
|
+
# @param [Fixnum] account_id the account ID
|
85
|
+
# @param [#to_s] zone_name the zone name
|
86
|
+
# @param [Hash] options
|
87
|
+
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneFile>]
|
88
|
+
#
|
89
|
+
# @raise [Dnsimple::NotFoundError]
|
90
|
+
# @raise [Dnsimple::RequestError]
|
91
|
+
def zone_file(account_id, zone_name, options = {})
|
92
|
+
response = client.get(Client.versioned("/%s/zones/%s/file" % [account_id, zone_name]), options)
|
93
|
+
|
94
|
+
Dnsimple::Response.new(response, Struct::ZoneFile.new(response["data"]))
|
95
|
+
end
|
96
|
+
|
80
97
|
end
|
81
98
|
end
|
82
99
|
end
|
@@ -26,14 +26,14 @@ module Dnsimple
|
|
26
26
|
# @option options [Integer] :per_page number of entries to return (pagination)
|
27
27
|
# @option options [String] :sort sorting policy
|
28
28
|
# @option options [Hash] :filter filtering policy
|
29
|
-
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::
|
29
|
+
# @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::ZoneRecord>]
|
30
30
|
#
|
31
31
|
# @raise [Dnsimple::NotFoundError]
|
32
32
|
# @raise [Dnsimple::RequestError]
|
33
33
|
def records(account_id, zone_id, options = {})
|
34
34
|
response = client.get(Client.versioned("/%s/zones/%s/records" % [account_id, zone_id]), Options::ListOptions.new(options))
|
35
35
|
|
36
|
-
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::
|
36
|
+
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::ZoneRecord.new(r) })
|
37
37
|
end
|
38
38
|
alias list records
|
39
39
|
alias list_records records
|
@@ -59,7 +59,7 @@ module Dnsimple
|
|
59
59
|
# @option options [Integer] :per_page number of entries to return (pagination)
|
60
60
|
# @option options [String] :sort sorting policy
|
61
61
|
# @option options [Hash] :filter filtering policy
|
62
|
-
# @return [Dnsimple::CollectionResponse<Dnsimple::Struct::
|
62
|
+
# @return [Dnsimple::CollectionResponse<Dnsimple::Struct::ZoneRecord>]
|
63
63
|
#
|
64
64
|
# @raise [Dnsimple::NotFoundError]
|
65
65
|
# @raise [Dnsimple::RequestError]
|
@@ -79,7 +79,7 @@ module Dnsimple
|
|
79
79
|
# @param [String] zone_id the zone name
|
80
80
|
# @param [Hash] attributes
|
81
81
|
# @param [Hash] options
|
82
|
-
# @return [Dnsimple::Response<Dnsimple::Struct::
|
82
|
+
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneRecord>]
|
83
83
|
#
|
84
84
|
# @raise [Dnsimple::NotFoundError]
|
85
85
|
# @raise [Dnsimple::RequestError]
|
@@ -87,7 +87,7 @@ module Dnsimple
|
|
87
87
|
Extra.validate_mandatory_attributes(attributes, [:type, :name, :content])
|
88
88
|
response = client.post(Client.versioned("/%s/zones/%s/records" % [account_id, zone_id]), attributes, options)
|
89
89
|
|
90
|
-
Dnsimple::Response.new(response, Struct::
|
90
|
+
Dnsimple::Response.new(response, Struct::ZoneRecord.new(response["data"]))
|
91
91
|
end
|
92
92
|
alias create create_record
|
93
93
|
|
@@ -102,14 +102,14 @@ module Dnsimple
|
|
102
102
|
# @param [String] zone_id the zone name
|
103
103
|
# @param [Fixnum] record_id the record ID
|
104
104
|
# @param [Hash] options
|
105
|
-
# @return [Dnsimple::Response<Dnsimple::Struct::
|
105
|
+
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneRecord>]
|
106
106
|
#
|
107
107
|
# @raise [Dnsimple::NotFoundError]
|
108
108
|
# @raise [Dnsimple::RequestError]
|
109
109
|
def record(account_id, zone_id, record_id, options = {})
|
110
110
|
response = client.get(Client.versioned("/%s/zones/%s/records/%s" % [account_id, zone_id, record_id]), options)
|
111
111
|
|
112
|
-
Dnsimple::Response.new(response, Struct::
|
112
|
+
Dnsimple::Response.new(response, Struct::ZoneRecord.new(response["data"]))
|
113
113
|
end
|
114
114
|
|
115
115
|
# Updates a zone record in the account.
|
@@ -124,14 +124,14 @@ module Dnsimple
|
|
124
124
|
# @param [Fixnum] record_id the record ID
|
125
125
|
# @param [Hash] attributes
|
126
126
|
# @param [Hash] options
|
127
|
-
# @return [Dnsimple::Response<Dnsimple::Struct::
|
127
|
+
# @return [Dnsimple::Response<Dnsimple::Struct::ZoneRecord>]
|
128
128
|
#
|
129
129
|
# @raise [Dnsimple::NotFoundError]
|
130
130
|
# @raise [Dnsimple::RequestError]
|
131
131
|
def update_record(account_id, zone_id, record_id, attributes, options = {})
|
132
132
|
response = client.patch(Client.versioned("/%s/zones/%s/records/%s" % [account_id, zone_id, record_id]), attributes, options)
|
133
133
|
|
134
|
-
Dnsimple::Response.new(response, Struct::
|
134
|
+
Dnsimple::Response.new(response, Struct::ZoneRecord.new(response["data"]))
|
135
135
|
end
|
136
136
|
alias update update_record
|
137
137
|
|