dnsimple 2.0.0.alpha3 → 2.0.0.alpha4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -2
  3. data/CHANGELOG.markdown +5 -3
  4. data/lib/dnsimple/client.rb +6 -55
  5. data/lib/dnsimple/client/{certificates_service.rb → certificates.rb} +1 -1
  6. data/lib/dnsimple/client/clients.rb +121 -0
  7. data/lib/dnsimple/client/{contacts_service.rb → contacts.rb} +1 -1
  8. data/lib/dnsimple/client/domains.rb +65 -0
  9. data/lib/dnsimple/client/domains_autorenewals.rb +35 -0
  10. data/lib/dnsimple/client/domains_forwards.rb +70 -0
  11. data/lib/dnsimple/client/domains_privacy.rb +35 -0
  12. data/lib/dnsimple/client/domains_records.rb +89 -0
  13. data/lib/dnsimple/client/domains_sharing.rb +53 -0
  14. data/lib/dnsimple/client/domains_zones.rb +22 -0
  15. data/lib/dnsimple/client/{name_servers_service.rb → name_servers.rb} +1 -1
  16. data/lib/dnsimple/client/{registrars_service.rb → registrar.rb} +1 -1
  17. data/lib/dnsimple/client/services.rb +34 -0
  18. data/lib/dnsimple/client/{services_service.rb → services_domains.rb} +1 -28
  19. data/lib/dnsimple/client/templates.rb +98 -0
  20. data/lib/dnsimple/client/{templates_service.rb → templates_records.rb} +1 -93
  21. data/lib/dnsimple/client/{users_service.rb → users.rb} +1 -1
  22. data/lib/dnsimple/version.rb +1 -1
  23. data/spec/dnsimple/client/{certificates_service_spec.rb → certificates_spec.rb} +0 -0
  24. data/spec/dnsimple/client/{contacts_service_spec.rb → contacts_spec.rb} +0 -0
  25. data/spec/dnsimple/client/domains_autorenewals_spec.rb +72 -0
  26. data/spec/dnsimple/client/domains_forwards_spec.rb +146 -0
  27. data/spec/dnsimple/client/domains_privacy_spec.rb +74 -0
  28. data/spec/dnsimple/client/domains_records_spec.rb +191 -0
  29. data/spec/dnsimple/client/domains_sharing_spec.rb +109 -0
  30. data/spec/dnsimple/client/domains_spec.rb +139 -0
  31. data/spec/dnsimple/client/domains_zones_spec.rb +40 -0
  32. data/spec/dnsimple/client/{name_servers_service_spec.rb → name_servers_spec.rb} +0 -0
  33. data/spec/dnsimple/client/{registrars_service_spec.rb → registrar_spec.rb} +9 -9
  34. data/spec/dnsimple/client/{services_service_spec.rb → services_domains_spec.rb} +1 -62
  35. data/spec/dnsimple/client/services_spec.rb +69 -0
  36. data/spec/dnsimple/client/{templates_service_spec.rb → templates_records_spec.rb} +1 -192
  37. data/spec/dnsimple/client/templates_spec.rb +198 -0
  38. data/spec/dnsimple/client/{users_service_spec.rb → users_spec.rb} +0 -0
  39. data/spec/files/{domains_whois_privacy → domains_privacy}/disable/success.http +0 -0
  40. data/spec/files/{domains_whois_privacy → domains_privacy}/enable/success.http +0 -0
  41. data/spec/files/domains_privacy/notfound-domain.http +19 -0
  42. data/spec/files/{registrars → registrar}/check/available.http +0 -0
  43. data/spec/files/{registrars → registrar}/check/registered.http +0 -0
  44. data/spec/files/{registrars → registrar}/register/badrequest-missingdomain.http +0 -0
  45. data/spec/files/{registrars → registrar}/register/badrequest-missingregistrant.http +0 -0
  46. data/spec/files/{registrars → registrar}/register/success.http +0 -0
  47. data/spec/files/{registrars → registrar}/renew/badrequest-missingrenewal.http +0 -0
  48. data/spec/files/{registrars → registrar}/renew/badrequest-unable.http +0 -0
  49. data/spec/files/{registrars → registrar}/renew/success.http +0 -0
  50. data/spec/files/{registrars → registrar}/transfer/success.http +0 -0
  51. data/spec/files/{registrars_extended_attributes → registrar_extended_attributes}/list/success.http +0 -0
  52. data/spec/files/{registrars_prices → registrar_prices}/list/success.http +0 -0
  53. data/spec/files/{subscription → subscriptions}/show/success.http +0 -0
  54. metadata +82 -56
  55. data/lib/dnsimple/client/client_service.rb +0 -8
  56. data/lib/dnsimple/client/domains_service.rb +0 -333
  57. data/spec/dnsimple/client/domains_service_spec.rb +0 -662
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsimple
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha3
4
+ version: 2.0.0.alpha4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Eden
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-22 00:00:00.000000000 Z
12
+ date: 2015-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -105,15 +105,23 @@ files:
105
105
  - dnsimple.gemspec
106
106
  - lib/dnsimple.rb
107
107
  - lib/dnsimple/client.rb
108
- - lib/dnsimple/client/certificates_service.rb
109
- - lib/dnsimple/client/client_service.rb
110
- - lib/dnsimple/client/contacts_service.rb
111
- - lib/dnsimple/client/domains_service.rb
112
- - lib/dnsimple/client/name_servers_service.rb
113
- - lib/dnsimple/client/registrars_service.rb
114
- - lib/dnsimple/client/services_service.rb
115
- - lib/dnsimple/client/templates_service.rb
116
- - lib/dnsimple/client/users_service.rb
108
+ - lib/dnsimple/client/certificates.rb
109
+ - lib/dnsimple/client/clients.rb
110
+ - lib/dnsimple/client/contacts.rb
111
+ - lib/dnsimple/client/domains.rb
112
+ - lib/dnsimple/client/domains_autorenewals.rb
113
+ - lib/dnsimple/client/domains_forwards.rb
114
+ - lib/dnsimple/client/domains_privacy.rb
115
+ - lib/dnsimple/client/domains_records.rb
116
+ - lib/dnsimple/client/domains_sharing.rb
117
+ - lib/dnsimple/client/domains_zones.rb
118
+ - lib/dnsimple/client/name_servers.rb
119
+ - lib/dnsimple/client/registrar.rb
120
+ - lib/dnsimple/client/services.rb
121
+ - lib/dnsimple/client/services_domains.rb
122
+ - lib/dnsimple/client/templates.rb
123
+ - lib/dnsimple/client/templates_records.rb
124
+ - lib/dnsimple/client/users.rb
117
125
  - lib/dnsimple/compatibility.rb
118
126
  - lib/dnsimple/default.rb
119
127
  - lib/dnsimple/error.rb
@@ -134,14 +142,22 @@ files:
134
142
  - lib/dnsimple/struct/user.rb
135
143
  - lib/dnsimple/struct/whois_privacy.rb
136
144
  - lib/dnsimple/version.rb
137
- - spec/dnsimple/client/certificates_service_spec.rb
138
- - spec/dnsimple/client/contacts_service_spec.rb
139
- - spec/dnsimple/client/domains_service_spec.rb
140
- - spec/dnsimple/client/name_servers_service_spec.rb
141
- - spec/dnsimple/client/registrars_service_spec.rb
142
- - spec/dnsimple/client/services_service_spec.rb
143
- - spec/dnsimple/client/templates_service_spec.rb
144
- - spec/dnsimple/client/users_service_spec.rb
145
+ - spec/dnsimple/client/certificates_spec.rb
146
+ - spec/dnsimple/client/contacts_spec.rb
147
+ - spec/dnsimple/client/domains_autorenewals_spec.rb
148
+ - spec/dnsimple/client/domains_forwards_spec.rb
149
+ - spec/dnsimple/client/domains_privacy_spec.rb
150
+ - spec/dnsimple/client/domains_records_spec.rb
151
+ - spec/dnsimple/client/domains_sharing_spec.rb
152
+ - spec/dnsimple/client/domains_spec.rb
153
+ - spec/dnsimple/client/domains_zones_spec.rb
154
+ - spec/dnsimple/client/name_servers_spec.rb
155
+ - spec/dnsimple/client/registrar_spec.rb
156
+ - spec/dnsimple/client/services_domains_spec.rb
157
+ - spec/dnsimple/client/services_spec.rb
158
+ - spec/dnsimple/client/templates_records_spec.rb
159
+ - spec/dnsimple/client/templates_spec.rb
160
+ - spec/dnsimple/client/users_spec.rb
145
161
  - spec/dnsimple/client_spec.rb
146
162
  - spec/dnsimple/compatibility_spec.rb
147
163
  - spec/files/2fa/error-badtoken.http
@@ -178,6 +194,9 @@ files:
178
194
  - spec/files/domains_forwards/list/success.http
179
195
  - spec/files/domains_forwards/notfound-domain.http
180
196
  - spec/files/domains_forwards/notfound.http
197
+ - spec/files/domains_privacy/disable/success.http
198
+ - spec/files/domains_privacy/enable/success.http
199
+ - spec/files/domains_privacy/notfound-domain.http
181
200
  - spec/files/domains_records/create/created.http
182
201
  - spec/files/domains_records/delete/success-204.http
183
202
  - spec/files/domains_records/delete/success.http
@@ -190,8 +209,6 @@ files:
190
209
  - spec/files/domains_sharing/list/success.http
191
210
  - spec/files/domains_sharing/notfound-domain.http
192
211
  - spec/files/domains_sharing/notfound.http
193
- - spec/files/domains_whois_privacy/disable/success.http
194
- - spec/files/domains_whois_privacy/enable/success.http
195
212
  - spec/files/domains_zones/get/success.http
196
213
  - spec/files/domains_zones/notfound-domain.http
197
214
  - spec/files/nameservers/change/success.http
@@ -200,17 +217,17 @@ files:
200
217
  - spec/files/nameservers/notfound-domain.http
201
218
  - spec/files/nameservers/register/badrequest-valueerror.http
202
219
  - spec/files/nameservers/register/success.http
203
- - spec/files/registrars/check/available.http
204
- - spec/files/registrars/check/registered.http
205
- - spec/files/registrars/register/badrequest-missingdomain.http
206
- - spec/files/registrars/register/badrequest-missingregistrant.http
207
- - spec/files/registrars/register/success.http
208
- - spec/files/registrars/renew/badrequest-missingrenewal.http
209
- - spec/files/registrars/renew/badrequest-unable.http
210
- - spec/files/registrars/renew/success.http
211
- - spec/files/registrars/transfer/success.http
212
- - spec/files/registrars_extended_attributes/list/success.http
213
- - spec/files/registrars_prices/list/success.http
220
+ - spec/files/registrar/check/available.http
221
+ - spec/files/registrar/check/registered.http
222
+ - spec/files/registrar/register/badrequest-missingdomain.http
223
+ - spec/files/registrar/register/badrequest-missingregistrant.http
224
+ - spec/files/registrar/register/success.http
225
+ - spec/files/registrar/renew/badrequest-missingrenewal.http
226
+ - spec/files/registrar/renew/badrequest-unable.http
227
+ - spec/files/registrar/renew/success.http
228
+ - spec/files/registrar/transfer/success.http
229
+ - spec/files/registrar_extended_attributes/list/success.http
230
+ - spec/files/registrar_prices/list/success.http
214
231
  - spec/files/services/applied/success.http
215
232
  - spec/files/services/apply/success.http
216
233
  - spec/files/services/available/success.http
@@ -218,7 +235,7 @@ files:
218
235
  - spec/files/services/notfound.http
219
236
  - spec/files/services/show/success.http
220
237
  - spec/files/services/unapply/success.http
221
- - spec/files/subscription/show/success.http
238
+ - spec/files/subscriptions/show/success.http
222
239
  - spec/files/templates/apply/success.http
223
240
  - spec/files/templates/create/created.http
224
241
  - spec/files/templates/delete/success-204.http
@@ -257,19 +274,27 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
274
  version: 1.3.1
258
275
  requirements: []
259
276
  rubyforge_project:
260
- rubygems_version: 2.4.4
277
+ rubygems_version: 2.4.5
261
278
  signing_key:
262
279
  specification_version: 4
263
280
  summary: A Ruby client for the DNSimple API
264
281
  test_files:
265
- - spec/dnsimple/client/certificates_service_spec.rb
266
- - spec/dnsimple/client/contacts_service_spec.rb
267
- - spec/dnsimple/client/domains_service_spec.rb
268
- - spec/dnsimple/client/name_servers_service_spec.rb
269
- - spec/dnsimple/client/registrars_service_spec.rb
270
- - spec/dnsimple/client/services_service_spec.rb
271
- - spec/dnsimple/client/templates_service_spec.rb
272
- - spec/dnsimple/client/users_service_spec.rb
282
+ - spec/dnsimple/client/certificates_spec.rb
283
+ - spec/dnsimple/client/contacts_spec.rb
284
+ - spec/dnsimple/client/domains_autorenewals_spec.rb
285
+ - spec/dnsimple/client/domains_forwards_spec.rb
286
+ - spec/dnsimple/client/domains_privacy_spec.rb
287
+ - spec/dnsimple/client/domains_records_spec.rb
288
+ - spec/dnsimple/client/domains_sharing_spec.rb
289
+ - spec/dnsimple/client/domains_spec.rb
290
+ - spec/dnsimple/client/domains_zones_spec.rb
291
+ - spec/dnsimple/client/name_servers_spec.rb
292
+ - spec/dnsimple/client/registrar_spec.rb
293
+ - spec/dnsimple/client/services_domains_spec.rb
294
+ - spec/dnsimple/client/services_spec.rb
295
+ - spec/dnsimple/client/templates_records_spec.rb
296
+ - spec/dnsimple/client/templates_spec.rb
297
+ - spec/dnsimple/client/users_spec.rb
273
298
  - spec/dnsimple/client_spec.rb
274
299
  - spec/dnsimple/compatibility_spec.rb
275
300
  - spec/files/2fa/error-badtoken.http
@@ -306,6 +331,9 @@ test_files:
306
331
  - spec/files/domains_forwards/list/success.http
307
332
  - spec/files/domains_forwards/notfound-domain.http
308
333
  - spec/files/domains_forwards/notfound.http
334
+ - spec/files/domains_privacy/disable/success.http
335
+ - spec/files/domains_privacy/enable/success.http
336
+ - spec/files/domains_privacy/notfound-domain.http
309
337
  - spec/files/domains_records/create/created.http
310
338
  - spec/files/domains_records/delete/success-204.http
311
339
  - spec/files/domains_records/delete/success.http
@@ -318,8 +346,6 @@ test_files:
318
346
  - spec/files/domains_sharing/list/success.http
319
347
  - spec/files/domains_sharing/notfound-domain.http
320
348
  - spec/files/domains_sharing/notfound.http
321
- - spec/files/domains_whois_privacy/disable/success.http
322
- - spec/files/domains_whois_privacy/enable/success.http
323
349
  - spec/files/domains_zones/get/success.http
324
350
  - spec/files/domains_zones/notfound-domain.http
325
351
  - spec/files/nameservers/change/success.http
@@ -328,17 +354,17 @@ test_files:
328
354
  - spec/files/nameservers/notfound-domain.http
329
355
  - spec/files/nameservers/register/badrequest-valueerror.http
330
356
  - spec/files/nameservers/register/success.http
331
- - spec/files/registrars/check/available.http
332
- - spec/files/registrars/check/registered.http
333
- - spec/files/registrars/register/badrequest-missingdomain.http
334
- - spec/files/registrars/register/badrequest-missingregistrant.http
335
- - spec/files/registrars/register/success.http
336
- - spec/files/registrars/renew/badrequest-missingrenewal.http
337
- - spec/files/registrars/renew/badrequest-unable.http
338
- - spec/files/registrars/renew/success.http
339
- - spec/files/registrars/transfer/success.http
340
- - spec/files/registrars_extended_attributes/list/success.http
341
- - spec/files/registrars_prices/list/success.http
357
+ - spec/files/registrar/check/available.http
358
+ - spec/files/registrar/check/registered.http
359
+ - spec/files/registrar/register/badrequest-missingdomain.http
360
+ - spec/files/registrar/register/badrequest-missingregistrant.http
361
+ - spec/files/registrar/register/success.http
362
+ - spec/files/registrar/renew/badrequest-missingrenewal.http
363
+ - spec/files/registrar/renew/badrequest-unable.http
364
+ - spec/files/registrar/renew/success.http
365
+ - spec/files/registrar/transfer/success.http
366
+ - spec/files/registrar_extended_attributes/list/success.http
367
+ - spec/files/registrar_prices/list/success.http
342
368
  - spec/files/services/applied/success.http
343
369
  - spec/files/services/apply/success.http
344
370
  - spec/files/services/available/success.http
@@ -346,7 +372,7 @@ test_files:
346
372
  - spec/files/services/notfound.http
347
373
  - spec/files/services/show/success.http
348
374
  - spec/files/services/unapply/success.http
349
- - spec/files/subscription/show/success.http
375
+ - spec/files/subscriptions/show/success.http
350
376
  - spec/files/templates/apply/success.http
351
377
  - spec/files/templates/create/created.http
352
378
  - spec/files/templates/delete/success-204.http
@@ -1,8 +0,0 @@
1
- module Dnsimple
2
- class Client
3
-
4
- class ClientService < ::Struct.new(:client)
5
- end
6
-
7
- end
8
- end
@@ -1,333 +0,0 @@
1
- module Dnsimple
2
- class Client
3
- class DomainsService < ClientService
4
-
5
- # Lists the domains in the account.
6
- #
7
- # @see http://developer.dnsimple.com/domains/#list
8
- #
9
- # @return [Array<Struct::Domain>]
10
- # @raise [RequestError] When the request fails.
11
- def list(options = {})
12
- response = client.get("v1/domains", options)
13
-
14
- response.map { |r| Struct::Domain.new(r["domain"]) }
15
- end
16
-
17
- # Gets a domain from the account.
18
- #
19
- # @see http://developer.dnsimple.com/domains/#get
20
- #
21
- # @param [#to_s] domain The domain id or domain name.
22
- #
23
- # @return [Struct::Domain]
24
- # @raise [RecordNotFound]
25
- # @raise [RequestError] When the request fails.
26
- def find(domain)
27
- response = client.get("v1/domains/#{domain}")
28
-
29
- Struct::Domain.new(response["domain"])
30
- end
31
-
32
- # Creates a domain in the account.
33
- #
34
- # @see http://developer.dnsimple.com/domains/#create
35
- #
36
- # @param [Hash] attributes
37
- #
38
- # @return [Struct::Domain]
39
- # @raise [RequestError] When the request fails.
40
- def create(attributes = {})
41
- Extra.validate_mandatory_attributes(attributes, [:name])
42
- options = { domain: attributes }
43
- response = client.post("v1/domains", options)
44
-
45
- Struct::Domain.new(response["domain"])
46
- end
47
-
48
- # Deletes a domain from the account.
49
- #
50
- # WARNING: this cannot be undone.
51
- #
52
- # @see http://developer.dnsimple.com/domains/#delete
53
- #
54
- # @param [#to_s] domain The domain id or domain name.
55
- #
56
- # @return [void]
57
- # @raise [RecordNotFound]
58
- # @raise [RequestError] When the request fails.
59
- def delete(domain)
60
- client.delete("v1/domains/#{domain}")
61
- end
62
-
63
-
64
- # Lists the records for a domain.
65
- #
66
- # @see http://developer.dnsimple.com/domains/records/#list
67
- #
68
- # @param [#to_s] domain The domain id or domain name.
69
- # @param [Hash] options
70
- #
71
- # @return [Array<Struct::Record>]
72
- # @raise [RecordNotFound]
73
- # @raise [RequestError] When the request fails.
74
- def list_records(domain, options = {})
75
- response = client.get("v1/domains/#{domain}/records", options)
76
-
77
- response.map { |r| Struct::Record.new(r["record"]) }
78
- end
79
-
80
- # Creates a record for a domain.
81
- #
82
- # @see http://developer.dnsimple.com/domains/records/#create
83
- #
84
- # @param [#to_s] domain The domain id or domain name.
85
- # @param [Hash] attributes
86
- #
87
- # @return [Struct::Record]
88
- # @raise [RecordNotFound]
89
- # @raise [RequestError] When the request fails.
90
- def create_record(domain, attributes = {})
91
- Extra.validate_mandatory_attributes(attributes, [:name, :record_type, :content])
92
- options = { record: attributes }
93
- response = client.post("v1/domains/#{domain}/records", options)
94
-
95
- Struct::Record.new(response["record"])
96
- end
97
-
98
- # Gets a record for a domain.
99
- #
100
- # @see http://developer.dnsimple.com/domains/records/#get
101
- #
102
- # @param [#to_s] domain The domain id or domain name.
103
- # @param [Fixnum] record The record id.
104
- #
105
- # @return [Struct::Record]
106
- # @raise [RecordNotFound]
107
- # @raise [RequestError] When the request fails.
108
- def find_record(domain, record)
109
- response = client.get("v1/domains/#{domain}/records/#{record}")
110
-
111
- Struct::Record.new(response["record"])
112
- end
113
-
114
- # Updates a record for a domain.
115
- #
116
- # @see http://developer.dnsimple.com/domains/records/#update
117
- #
118
- # @param [#to_s] domain The domain id or domain name.
119
- # @param [Fixnum] record The record id.
120
- # @param [Hash] attributes
121
- #
122
- # @return [Struct::Record]
123
- # @raise [RecordNotFound]
124
- # @raise [RequestError] When the request fails.
125
- def update_record(domain, record, attributes = {})
126
- options = { record: attributes }
127
- response = client.put("v1/domains/#{domain}/records/#{record}", options)
128
-
129
- Struct::Record.new(response["record"])
130
- end
131
-
132
- # Deletes a record for a domain.
133
- #
134
- # @see http://developer.dnsimple.com/domains/records/#delete
135
- #
136
- # @param [#to_s] domain The domain id or domain name.
137
- # @param [Fixnum] record The record id.
138
- #
139
- # @return [void]
140
- # @raise [RecordNotFound]
141
- # @raise [RequestError] When the request fails.
142
- def delete_record(domain, record)
143
- client.delete("v1/domains/#{domain}/records/#{record}")
144
- end
145
-
146
-
147
- # Enables auto-renewal for a domain.
148
- #
149
- # @see http://developer.dnsimple.com/domains/autorenewal/#enable
150
- #
151
- # @param [#to_s] domain The domain id or domain name.
152
- #
153
- # @return [Struct::Domain]
154
- # @raise [RequestError] When the request fails.
155
- def enable_auto_renewal(domain)
156
- response = client.post("v1/domains/#{domain}/auto_renewal")
157
-
158
- Struct::Domain.new(response["domain"])
159
- end
160
-
161
- # Disables auto-renewal for a domain.
162
- #
163
- # @see http://developer.dnsimple.com/domains/autorenewal/#disable
164
- #
165
- # @param [#to_s] domain The domain id or domain name.
166
- #
167
- # @return [Struct::Domain]
168
- # @raise [RequestError] When the request fails.
169
- def disable_auto_renewal(domain)
170
- response = client.delete("v1/domains/#{domain}/auto_renewal")
171
-
172
- Struct::Domain.new(response["domain"])
173
- end
174
-
175
-
176
- # Enables WHOIS privacy for a domain.
177
- #
178
- # @see http://developer.dnsimple.com/domains/privacy/#enable
179
- #
180
- # @param [#to_s] domain The domain id or domain name.
181
- #
182
- # @return [Struct::WhoisPrivacy]
183
- # @raise [RequestError] When the request fails.
184
- def enable_whois_privacy(domain)
185
- response = client.post("v1/domains/#{domain}/whois_privacy")
186
-
187
- Struct::WhoisPrivacy.new(response["whois_privacy"])
188
- end
189
-
190
- # Disables WHOIS privacy for a domain.
191
- #
192
- # @see http://developer.dnsimple.com/domains/privacy/#disable
193
- #
194
- # @param [#to_s] domain The domain id or domain name.
195
- #
196
- # @return [Struct::WhoisPrivacy]
197
- # @raise [RequestError] When the request fails.
198
- def disable_whois_privacy(domain)
199
- response = client.delete("v1/domains/#{domain}/whois_privacy")
200
-
201
- Struct::WhoisPrivacy.new(response["whois_privacy"])
202
- end
203
-
204
-
205
- # Lists the memberships.
206
- #
207
- # @see http://developer.dnsimple.com/domains/sharing/#list
208
- #
209
- # @param [#to_s] domain The domain id or domain name.
210
- #
211
- # @return [Array<Struct::Membership>]
212
- # @raise [RecordNotFound]
213
- # @raise [RequestError] When the request fails.
214
- def list_memberships(domain)
215
- response = client.get("v1/domains/#{domain}/memberships")
216
-
217
- response.map { |r| Struct::Membership.new(r["membership"]) }
218
- end
219
-
220
- # Shares a domain.
221
- #
222
- # @see http://developer.dnsimple.com/domains/sharing/#create
223
- #
224
- # @param [#to_s] domain The domain id or domain name.
225
- # @param [String] email
226
- #
227
- # @return [Struct::Membership]
228
- # @raise [RecordNotFound]
229
- # @raise [RequestError] When the request fails.
230
- def create_membership(domain, email)
231
- options = { membership: { email: email }}
232
- response = client.post("v1/domains/#{domain}/memberships", options)
233
-
234
- Struct::Membership.new(response["membership"])
235
- end
236
-
237
- # Un-shares a domain.
238
- #
239
- # @see http://developer.dnsimple.com/domains/sharing/#delete
240
- #
241
- # @param [#to_s] domain The domain id or domain name.
242
- # @param [Fixnum] membership The membership id.
243
- #
244
- # @return [void]
245
- # @raise [RecordNotFound]
246
- # @raise [RequestError] When the request fails.
247
- def delete_membership(domain, membership)
248
- client.delete("v1/domains/#{domain}/memberships/#{membership}")
249
- end
250
-
251
-
252
- # Lists the email forwards for a domain.
253
- #
254
- # @see http://developer.dnsimple.com/domains/forwards/#list
255
- #
256
- # @param [#to_s] domain The domain id or domain name.
257
- #
258
- # @return [Array<Struct::EmailForward>]
259
- # @raise [RecordNotFound]
260
- # @raise [RequestError] When the request fails.
261
- def list_email_forwards(domain)
262
- response = client.get("v1/domains/#{domain}/email_forwards")
263
-
264
- response.map { |r| Struct::EmailForward.new(r["email_forward"]) }
265
- end
266
-
267
- # Creates an email forward for a domain.
268
- #
269
- # @see http://developer.dnsimple.com/domains/forwards/#create
270
- #
271
- # @param [#to_s] domain The domain id or domain name.
272
- # @param [Hash] attributes
273
- #
274
- # @return [Struct::EmailForward]
275
- # @raise [RecordNotFound]
276
- # @raise [RequestError] When the request fails.
277
- def create_email_forward(domain, attributes = {})
278
- Extra.validate_mandatory_attributes(attributes, [:from, :to])
279
- options = { email_forward: attributes }
280
- response = client.post("v1/domains/#{domain}/email_forwards", options)
281
-
282
- Struct::EmailForward.new(response["email_forward"])
283
- end
284
-
285
- # Gets an email forward for a domain.
286
- #
287
- # @see http://developer.dnsimple.com/domains/forwards/#get
288
- #
289
- # @param [#to_s] domain The domain id or domain name.
290
- # @param [Fixnum] forward The forward id.
291
- #
292
- # @return [Struct::EmailForward]
293
- # @raise [RecordNotFound]
294
- # @raise [RequestError] When the request fails.
295
- def find_email_forward(domain, forward)
296
- response = client.get("v1/domains/#{domain}/email_forwards/#{forward}")
297
-
298
- Struct::EmailForward.new(response["email_forward"])
299
- end
300
-
301
- # Deletes an email forward for a domain.
302
- #
303
- # @see http://developer.dnsimple.com/domains/forwards/#delete
304
- #
305
- # @param [#to_s] domain The domain id or domain name.
306
- # @param [Fixnum] forward The forward id.
307
- #
308
- # @return [void]
309
- # @raise [RecordNotFound]
310
- # @raise [RequestError] When the request fails.
311
- def delete_email_forward(domain, forward)
312
- client.delete("v1/domains/#{domain}/email_forwards/#{forward}")
313
- end
314
-
315
-
316
- # Gets a domain zone as zone file.
317
- #
318
- # @see http://developer.dnsimple.com/domains/zones/#get
319
- #
320
- # @param [#to_s] domain The domain id or domain name.
321
- #
322
- # @return [String]
323
- # @raise [RecordNotFound]
324
- # @raise [RequestError] When the request fails.
325
- def zone(domain)
326
- response = client.get("v1/domains/#{domain}/zone")
327
-
328
- response["zone"]
329
- end
330
-
331
- end
332
- end
333
- end