Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add domain registration, transfer, renewal
- Loading branch information
Showing
14 changed files
with
256 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,8 @@ | ||
module Dnsimple | ||
|
||
# Represents a transfer order. | ||
class TransferOrder < Base | ||
|
||
attr_accessor :id | ||
|
||
attr_accessor :status | ||
|
||
def self.create(name, authinfo='', registrant={}, extended_attributes={}, options={}) | ||
body = {:domain => {:name => name}, :transfer_order => {:authinfo => authinfo}} | ||
|
||
if registrant[:id] | ||
body[:domain][:registrant_id] = registrant[:id] | ||
else | ||
body.merge!(:contact => Contact.resolve_attributes(registrant)) | ||
end | ||
|
||
body.merge!(:extended_attribute => extended_attributes) | ||
|
||
options.merge!({:body => body}) | ||
|
||
response = Client.post("v1/domain_transfers", options) | ||
|
||
case response.code | ||
when 201 | ||
new(response["transfer_order"]) | ||
else | ||
raise RequestError.new("Error creating transfer order", response) | ||
end | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
spec/files/domains/registration/badrequest-missingdomain.http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
HTTP/1.1 400 Bad Request | ||
Server: nginx | ||
Date: Mon, 15 Dec 2014 22:49:03 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Transfer-Encoding: chunked | ||
Connection: close | ||
Status: 400 Bad Request | ||
Strict-Transport-Security: max-age=631138519 | ||
X-Frame-Options: SAMEORIGIN | ||
X-XSS-Protection: 1 | ||
X-Content-Type-Options: nosniff | ||
Access-Control-Allow-Origin: * | ||
Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with | ||
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS | ||
Cache-Control: no-cache | ||
X-Request-Id: 03ac0f0b-c485-4465-bed9-d584f9865ccd | ||
X-Runtime: 0.027365 | ||
|
||
{"message":"Required parameter missing: domain"} |
19 changes: 19 additions & 0 deletions
19
spec/files/domains/registration/badrequest-missingregistrant.http
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
HTTP/1.1 400 Bad Request | ||
Server: nginx | ||
Date: Mon, 15 Dec 2014 22:52:06 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Transfer-Encoding: chunked | ||
Connection: close | ||
Status: 400 Bad Request | ||
Strict-Transport-Security: max-age=631138519 | ||
X-Frame-Options: SAMEORIGIN | ||
X-XSS-Protection: 1 | ||
X-Content-Type-Options: nosniff | ||
Access-Control-Allow-Origin: * | ||
Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with | ||
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS | ||
Cache-Control: no-cache | ||
X-Request-Id: 5542b2f5-628d-4ddc-845e-32282496d37c | ||
X-Runtime: 1.826527 | ||
|
||
{"message":"Validation failed","errors":{"base":["A registrant is required"]}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
HTTP/1.1 201 Created | ||
Server: nginx | ||
Date: Mon, 15 Dec 2014 23:04:01 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Transfer-Encoding: chunked | ||
Connection: close | ||
Status: 201 Created | ||
Strict-Transport-Security: max-age=631138519 | ||
X-Frame-Options: SAMEORIGIN | ||
X-XSS-Protection: 1 | ||
X-Content-Type-Options: nosniff | ||
Access-Control-Allow-Origin: * | ||
Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with | ||
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS | ||
ETag: "642e37a05eb4016a974eb52085385822" | ||
Cache-Control: max-age=0, private, must-revalidate | ||
X-Request-Id: c67b3494-bea3-4fe3-9fdd-8ec5ca89095e | ||
X-Runtime: 5.852385 | ||
Strict-Transport-Security: max-age=315360000 | ||
|
||
{"domain":{"id":1797,"user_id":null,"registrant_id":409,"name":"example-1418683185.com","unicode_name":"example-1418683185.com","token":"domain-token","state":"registered","language":null,"lockable":true,"auto_renew":false,"whois_protected":false,"record_count":5,"service_count":0,"expires_on":"2015-12-15","created_at":"2014-12-15T23:03:56.636Z","updated_at":"2014-12-15T23:04:01.406Z"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
HTTP/1.1 400 Bad Request | ||
Server: nginx | ||
Date: Mon, 15 Dec 2014 23:22:54 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Transfer-Encoding: chunked | ||
Connection: close | ||
Status: 400 Bad Request | ||
Strict-Transport-Security: max-age=631138519 | ||
X-Frame-Options: SAMEORIGIN | ||
X-XSS-Protection: 1 | ||
X-Content-Type-Options: nosniff | ||
Access-Control-Allow-Origin: * | ||
Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with | ||
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS | ||
Cache-Control: no-cache | ||
X-Request-Id: 94aa82e2-ae9e-4298-9524-5ac0e9d0a1b7 | ||
X-Runtime: 0.041781 | ||
|
||
{"message":"Required parameter missing: domain_renewal"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
HTTP/1.1 422 Unprocessable Entity | ||
Server: nginx | ||
Date: Mon, 15 Dec 2014 23:21:08 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Transfer-Encoding: chunked | ||
Connection: close | ||
Status: 422 Unprocessable Entity | ||
Strict-Transport-Security: max-age=631138519 | ||
X-Frame-Options: SAMEORIGIN | ||
X-XSS-Protection: 1 | ||
X-Content-Type-Options: nosniff | ||
Access-Control-Allow-Origin: * | ||
Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with | ||
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS | ||
Cache-Control: no-cache | ||
X-Request-Id: 60f79466-a97b-4f6a-b3e2-95a7f22da87c | ||
X-Runtime: 0.060428 | ||
|
||
{"message":"example-1418683185.com may not be renewed at this time"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
HTTP/1.1 201 Created | ||
Server: nginx | ||
Date: Mon, 15 Dec 2014 23:04:01 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Transfer-Encoding: chunked | ||
Connection: close | ||
Status: 201 Created | ||
Strict-Transport-Security: max-age=631138519 | ||
X-Frame-Options: SAMEORIGIN | ||
X-XSS-Protection: 1 | ||
X-Content-Type-Options: nosniff | ||
Access-Control-Allow-Origin: * | ||
Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with | ||
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS | ||
ETag: "642e37a05eb4016a974eb52085385822" | ||
Cache-Control: max-age=0, private, must-revalidate | ||
X-Request-Id: c67b3494-bea3-4fe3-9fdd-8ec5ca89095e | ||
X-Runtime: 5.852385 | ||
Strict-Transport-Security: max-age=315360000 | ||
|
||
{"domain":{"id":1797,"user_id":null,"registrant_id":409,"name":"example-1418683185.com","unicode_name":"example-1418683185.com","token":"domain-token","state":"registered","language":null,"lockable":true,"auto_renew":false,"whois_protected":false,"record_count":5,"service_count":0,"expires_on":"2015-12-15","created_at":"2014-12-15T23:03:56.636Z","updated_at":"2014-12-15T23:04:01.406Z"}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
HTTP/1.1 201 Created | ||
Server: nginx | ||
Date: Tue, 16 Dec 2014 00:15:46 GMT | ||
Content-Type: application/json; charset=utf-8 | ||
Transfer-Encoding: chunked | ||
Connection: close | ||
Status: 201 Created | ||
Strict-Transport-Security: max-age=631138519 | ||
X-Frame-Options: SAMEORIGIN | ||
X-XSS-Protection: 1 | ||
X-Content-Type-Options: nosniff | ||
Access-Control-Allow-Origin: * | ||
Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with | ||
Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS | ||
ETag: "8ae2f909210b303eebe68b66e636b117" | ||
Cache-Control: max-age=0, private, must-revalidate | ||
X-Request-Id: c1ecc834-9cf7-4973-b060-34b701e6b686 | ||
X-Runtime: 16.594202 | ||
Strict-Transport-Security: max-age=315360000 | ||
|
||
{"transfer_order":{"id":11,"domain_id":1803,"state":"submitted","created_at":"2014-12-16T00:15:44.781Z","updated_at":"2014-12-16T00:15:46.065Z"}} |
File renamed without changes.
File renamed without changes.