dnsimple 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +1 -8
- data/lib/dnsimple/client/certificates.rb +7 -7
- data/lib/dnsimple/client/collaborators.rb +3 -3
- data/lib/dnsimple/client/contacts.rb +6 -6
- data/lib/dnsimple/client/domains.rb +6 -6
- data/lib/dnsimple/client/domains_email_forwards.rb +5 -5
- data/lib/dnsimple/client/domains_pushes.rb +6 -6
- data/lib/dnsimple/client/registrar.rb +37 -11
- data/lib/dnsimple/client/registrar_auto_renewal.rb +2 -2
- data/lib/dnsimple/client/registrar_delegation.rb +4 -4
- data/lib/dnsimple/client/registrar_whois_privacy.rb +3 -3
- data/lib/dnsimple/client/services_domains.rb +3 -3
- data/lib/dnsimple/client/templates.rb +6 -6
- data/lib/dnsimple/client/templates_domains.rb +1 -1
- data/lib/dnsimple/client/templates_records.rb +7 -7
- data/lib/dnsimple/client/vanity_name_servers.rb +2 -2
- data/lib/dnsimple/client/webhooks.rb +4 -4
- data/lib/dnsimple/client/zones.rb +4 -4
- data/lib/dnsimple/client/zones_records.rb +9 -9
- data/lib/dnsimple/response.rb +7 -7
- data/lib/dnsimple/struct.rb +4 -0
- data/lib/dnsimple/struct/account.rb +1 -1
- data/lib/dnsimple/struct/certificate.rb +3 -3
- data/lib/dnsimple/struct/collaborator.rb +3 -3
- data/lib/dnsimple/struct/contact.rb +2 -2
- data/lib/dnsimple/struct/domain.rb +3 -3
- data/lib/dnsimple/struct/domain_premium_price.rb +13 -0
- data/lib/dnsimple/struct/domain_push.rb +4 -4
- data/lib/dnsimple/struct/domain_registration.rb +37 -0
- data/lib/dnsimple/struct/domain_renewal.rb +28 -0
- data/lib/dnsimple/struct/domain_transfer.rb +34 -0
- data/lib/dnsimple/struct/email_forward.rb +2 -2
- data/lib/dnsimple/struct/oauth_token.rb +1 -1
- data/lib/dnsimple/struct/service.rb +3 -3
- data/lib/dnsimple/struct/template.rb +4 -4
- data/lib/dnsimple/struct/template_record.rb +4 -4
- data/lib/dnsimple/struct/tld.rb +2 -2
- data/lib/dnsimple/struct/user.rb +1 -1
- data/lib/dnsimple/struct/webhook.rb +1 -1
- data/lib/dnsimple/struct/whois_privacy.rb +1 -1
- data/lib/dnsimple/struct/zone.rb +2 -2
- data/lib/dnsimple/struct/zone_record.rb +4 -4
- data/lib/dnsimple/version.rb +1 -1
- data/spec/dnsimple/client/certificates_spec.rb +2 -2
- data/spec/dnsimple/client/contacts_spec.rb +2 -2
- data/spec/dnsimple/client/domains_email_forwards_spec.rb +2 -2
- data/spec/dnsimple/client/domains_spec.rb +2 -2
- data/spec/dnsimple/client/identity_spec.rb +2 -2
- data/spec/dnsimple/client/registrar_auto_renewal_spec.rb +2 -2
- data/spec/dnsimple/client/registrar_spec.rb +57 -7
- data/spec/dnsimple/client/services_domains_spec.rb +2 -2
- data/spec/dnsimple/client/services_spec.rb +8 -4
- data/spec/dnsimple/client/templates_records_spec.rb +4 -4
- data/spec/dnsimple/client/templates_spec.rb +4 -4
- data/spec/dnsimple/client/zones_records_spec.rb +4 -4
- data/spec/dnsimple/client/zones_spec.rb +2 -2
- data/spec/fixtures.http/accounts/success-account.http +21 -0
- data/spec/fixtures.http/accounts/success-user.http +21 -0
- data/spec/fixtures.http/addCollaborator/invite-success.http +1 -1
- data/spec/fixtures.http/addCollaborator/success.http +1 -1
- data/spec/fixtures.http/appliedServices/success.http +1 -1
- data/spec/fixtures.http/applyService/{created.http → success.http} +0 -0
- data/spec/fixtures.http/changeDomainDelegationToVanity/success.http +1 -1
- data/spec/fixtures.http/checkDomain/success.http +17 -17
- data/spec/fixtures.http/createContact/created.http +17 -17
- data/spec/fixtures.http/createDomain/created.http +1 -1
- data/spec/fixtures.http/createEmailForward/created.http +1 -1
- data/spec/fixtures.http/createTemplate/created.http +1 -1
- data/spec/fixtures.http/createTemplateRecord/created.http +1 -1
- data/spec/fixtures.http/createWebhook/created.http +17 -17
- data/spec/fixtures.http/createZoneRecord/created-apex.http +17 -0
- data/spec/fixtures.http/createZoneRecord/created.http +9 -13
- data/spec/fixtures.http/deleteContact/success.http +13 -13
- data/spec/fixtures.http/deleteEmailForward/success.http +13 -12
- data/spec/fixtures.http/deleteWebhook/success.http +13 -13
- data/spec/fixtures.http/disableDomainAutoRenewal/success.http +13 -0
- data/spec/fixtures.http/disableWhoisPrivacy/success.http +1 -1
- data/spec/fixtures.http/enableDomainAutoRenewal/success.http +13 -0
- data/spec/fixtures.http/enableVanityNameServers/success.http +1 -1
- data/spec/fixtures.http/enableWhoisPrivacy/created.http +1 -1
- data/spec/fixtures.http/enableWhoisPrivacy/success.http +1 -1
- data/spec/fixtures.http/getCertificate/success.http +1 -1
- data/spec/fixtures.http/getContact/success.http +17 -17
- data/spec/fixtures.http/getDomain/success.http +16 -16
- data/spec/fixtures.http/getDomainPremiumPrice/failure.http +16 -0
- data/spec/fixtures.http/getDomainPremiumPrice/success.http +21 -0
- data/spec/fixtures.http/getEmailForward/success.http +17 -17
- data/spec/fixtures.http/getService/success.http +1 -1
- data/spec/fixtures.http/getTemplate/success.http +1 -1
- data/spec/fixtures.http/getTemplateRecord/success.http +1 -1
- data/spec/fixtures.http/getTldExtendedAttributes/success-attributes.http +17 -0
- data/spec/fixtures.http/getWebhook/success.http +17 -17
- data/spec/fixtures.http/getWhoisPrivacy/success.http +1 -1
- data/spec/fixtures.http/getZone/success.http +17 -17
- data/spec/fixtures.http/getZoneRecord/success.http +1 -1
- data/spec/fixtures.http/initiatePush/success.http +1 -1
- data/spec/fixtures.http/listAccounts/success-account.http +1 -1
- data/spec/fixtures.http/listAccounts/success-user.http +1 -1
- data/spec/fixtures.http/listCertificates/success.http +1 -1
- data/spec/fixtures.http/listCollaborators/success.http +1 -1
- data/spec/fixtures.http/listContacts/success.http +17 -17
- data/spec/fixtures.http/listDomains/success.http +1 -1
- data/spec/fixtures.http/listEmailForwards/success.http +1 -1
- data/spec/fixtures.http/listPushes/success.http +1 -1
- data/spec/fixtures.http/listServices/success.http +12 -8
- data/spec/fixtures.http/listTemplateRecords/success.http +1 -1
- data/spec/fixtures.http/listTemplates/success.http +1 -1
- data/spec/fixtures.http/listWebhooks/success.http +17 -17
- data/spec/fixtures.http/listZoneRecords/success.http +1 -1
- data/spec/fixtures.http/listZones/success.http +17 -17
- data/spec/fixtures.http/method-not-allowed.http +11 -11
- data/spec/fixtures.http/notfound-contact.http +12 -12
- data/spec/fixtures.http/notfound-record.http +11 -11
- data/spec/fixtures.http/notfound-whoisprivacy.http +12 -0
- data/spec/fixtures.http/notfound-zone.http +11 -11
- data/spec/fixtures.http/oauthAccessToken/error-invalid-request.http +16 -0
- data/spec/fixtures.http/oauthAccessToken/success.http +17 -17
- data/spec/fixtures.http/registerDomain/success.http +21 -17
- data/spec/fixtures.http/renewDomain/success.http +13 -9
- data/spec/fixtures.http/resetDomainToken/success.http +1 -1
- data/spec/fixtures.http/success-with-malformed-json.http +13 -0
- data/spec/fixtures.http/transferDomain/success.http +13 -9
- data/spec/fixtures.http/updateContact/success.http +17 -17
- data/spec/fixtures.http/updateTemplate/success.http +1 -1
- data/spec/fixtures.http/updateZoneRecord/success.http +1 -1
- data/spec/fixtures.http/validation-error.http +19 -0
- data/spec/fixtures.http/whoami/{success_account.http → success-account.http} +15 -15
- data/spec/fixtures.http/whoami/{success_user.http → success-user.http} +15 -15
- data/spec/fixtures.http/whoami/success.http +15 -15
- metadata +37 -14
- data/.ruby-version +0 -1
- data/spec/fixtures.http/disableAutoRenewal/success.http +0 -12
- data/spec/fixtures.http/enableAutoRenewal/success.http +0 -12
@@ -0,0 +1,13 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
module Struct
|
3
|
+
|
4
|
+
class DomainPremiumPrice < Base
|
5
|
+
# @return [String] The domain premium price
|
6
|
+
attr_accessor :premium_price
|
7
|
+
|
8
|
+
# @return [String] The action: registration/transfer/renewal
|
9
|
+
attr_accessor :action
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
@@ -2,16 +2,16 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class DomainPush < Base
|
5
|
-
# @return [
|
5
|
+
# @return [Integer] The domain push ID in DNSimple.
|
6
6
|
attr_accessor :id
|
7
7
|
|
8
|
-
# @return [
|
8
|
+
# @return [Integer] The associated domain ID.
|
9
9
|
attr_accessor :domain_id
|
10
10
|
|
11
|
-
# @return [
|
11
|
+
# @return [Integer] The associated contact ID.
|
12
12
|
attr_accessor :contact_id
|
13
13
|
|
14
|
-
# @return [
|
14
|
+
# @return [Integer] The associated account ID.
|
15
15
|
attr_accessor :account_id
|
16
16
|
|
17
17
|
# @return [String] When the domain push was created in DNSimple.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
module Struct
|
3
|
+
|
4
|
+
class DomainRegistration < Base
|
5
|
+
# @return [Integer] The domain registration ID in DNSimple.
|
6
|
+
attr_accessor :id
|
7
|
+
|
8
|
+
# @return [Integer] The associated domain ID.
|
9
|
+
attr_accessor :domain_id
|
10
|
+
|
11
|
+
# @return [Integer] The associated registrant (contact) ID.
|
12
|
+
attr_accessor :registrant_id
|
13
|
+
|
14
|
+
# @return [Integer] The number of years the domain was registered for.
|
15
|
+
attr_accessor :period
|
16
|
+
|
17
|
+
# @return [String] The state of the renewal.
|
18
|
+
attr_accessor :state
|
19
|
+
|
20
|
+
# @return [Bool] True if the domain auto-renew was requested.
|
21
|
+
attr_accessor :auto_renew
|
22
|
+
|
23
|
+
# @return [Bool] True if the domain WHOIS privacy was requested.
|
24
|
+
attr_accessor :whois_privacy
|
25
|
+
|
26
|
+
# @return [String] The premium price requested for the registration.
|
27
|
+
attr_accessor :premium_price
|
28
|
+
|
29
|
+
# @return [String] When the domain renewal was created in DNSimple.
|
30
|
+
attr_accessor :created_at
|
31
|
+
|
32
|
+
# @return [String] When the domain renewal was last updated in DNSimple.
|
33
|
+
attr_accessor :updated_at
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
module Struct
|
3
|
+
|
4
|
+
class DomainRenewal < Base
|
5
|
+
# @return [Integer] The domain renewal ID in DNSimple.
|
6
|
+
attr_accessor :id
|
7
|
+
|
8
|
+
# @return [Integer] The associated domain ID.
|
9
|
+
attr_accessor :domain_id
|
10
|
+
|
11
|
+
# @return [Integer] The number of years the domain was renewed for.
|
12
|
+
attr_accessor :period
|
13
|
+
|
14
|
+
# @return [String] The state of the renewal.
|
15
|
+
attr_accessor :state
|
16
|
+
|
17
|
+
# @return [String] The premium price requested for the renewal.
|
18
|
+
attr_accessor :premium_price
|
19
|
+
|
20
|
+
# @return [String] When the domain renewal was created in DNSimple.
|
21
|
+
attr_accessor :created_at
|
22
|
+
|
23
|
+
# @return [String] When the domain renewal was last updated in DNSimple.
|
24
|
+
attr_accessor :updated_at
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
module Struct
|
3
|
+
|
4
|
+
class DomainTransfer < Base
|
5
|
+
# @return [Integer] The domain registration ID in DNSimple.
|
6
|
+
attr_accessor :id
|
7
|
+
|
8
|
+
# @return [Integer] The associated domain ID.
|
9
|
+
attr_accessor :domain_id
|
10
|
+
|
11
|
+
# @return [Integer] The associated registrant (contact) ID.
|
12
|
+
attr_accessor :registrant_id
|
13
|
+
|
14
|
+
# @return [String] The state of the renewal.
|
15
|
+
attr_accessor :state
|
16
|
+
|
17
|
+
# @return [Bool] True if the domain auto-renew was requested.
|
18
|
+
attr_accessor :auto_renew
|
19
|
+
|
20
|
+
# @return [Bool] True if the domain WHOIS privacy was requested.
|
21
|
+
attr_accessor :whois_privacy
|
22
|
+
|
23
|
+
# @return [String] The premium price requested for the registration.
|
24
|
+
attr_accessor :premium_price
|
25
|
+
|
26
|
+
# @return [String] When the domain renewal was created in DNSimple.
|
27
|
+
attr_accessor :created_at
|
28
|
+
|
29
|
+
# @return [String] When the domain renewal was last updated in DNSimple.
|
30
|
+
attr_accessor :updated_at
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -2,10 +2,10 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class EmailForward < Base
|
5
|
-
# @return [
|
5
|
+
# @return [Integer] The email forward ID in DNSimple.
|
6
6
|
attr_accessor :id
|
7
7
|
|
8
|
-
# @return [
|
8
|
+
# @return [Integer] The associated domain ID.
|
9
9
|
attr_accessor :domain_id
|
10
10
|
|
11
11
|
# @return [String] The "local part" of the originating email address. Anything to the left of the @ symbol.
|
@@ -11,7 +11,7 @@ module Dnsimple
|
|
11
11
|
# @return [String] The token scope (not used for now).
|
12
12
|
attr_accessor :scope
|
13
13
|
|
14
|
-
# @return [
|
14
|
+
# @return [Integer] The account ID in DNSimple this token belongs to.
|
15
15
|
attr_accessor :account_id
|
16
16
|
end
|
17
17
|
|
@@ -23,14 +23,14 @@ module Dnsimple
|
|
23
23
|
attr_accessor :password
|
24
24
|
end
|
25
25
|
|
26
|
-
# @return [
|
26
|
+
# @return [Integer] The service ID in DNSimple.
|
27
27
|
attr_accessor :id
|
28
28
|
|
29
29
|
# @return [String] The service name.
|
30
30
|
attr_accessor :name
|
31
31
|
|
32
|
-
# @return [String] A
|
33
|
-
attr_accessor :
|
32
|
+
# @return [String] A string ID for the service.
|
33
|
+
attr_accessor :sid
|
34
34
|
|
35
35
|
# @return [String] The service description.
|
36
36
|
attr_accessor :description
|
@@ -2,17 +2,17 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class Template < Base
|
5
|
-
# @return [
|
5
|
+
# @return [Integer] The template ID in DNSimple.
|
6
6
|
attr_accessor :id
|
7
7
|
|
8
|
-
# @return [
|
8
|
+
# @return [Integer] The associated account ID.
|
9
9
|
attr_accessor :account_id
|
10
10
|
|
11
11
|
# @return [String] The template name.
|
12
12
|
attr_accessor :name
|
13
13
|
|
14
|
-
# @return [String] The
|
15
|
-
attr_accessor :
|
14
|
+
# @return [String] The string ID for the template.
|
15
|
+
attr_accessor :sid
|
16
16
|
|
17
17
|
# @return [String] The template description.
|
18
18
|
attr_accessor :description
|
@@ -2,10 +2,10 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class TemplateRecord < Base
|
5
|
-
# @return [
|
5
|
+
# @return [Integer] The template record ID in DNSimple.
|
6
6
|
attr_accessor :id
|
7
7
|
|
8
|
-
# @return [
|
8
|
+
# @return [Integer] The template ID in DNSimple.
|
9
9
|
attr_accessor :template_id
|
10
10
|
|
11
11
|
# @return [String] The type of template record, in uppercase.
|
@@ -17,10 +17,10 @@ module Dnsimple
|
|
17
17
|
# @return [String] The plain-text template record content.
|
18
18
|
attr_accessor :content
|
19
19
|
|
20
|
-
# @return [
|
20
|
+
# @return [Integer] The template record TTL value.
|
21
21
|
attr_accessor :ttl
|
22
22
|
|
23
|
-
# @return [
|
23
|
+
# @return [Integer] The priority value, if the type of template record accepts a priority.
|
24
24
|
attr_accessor :priority
|
25
25
|
|
26
26
|
# @return [String] When the template record was created in DNSimple.
|
data/lib/dnsimple/struct/tld.rb
CHANGED
@@ -5,7 +5,7 @@ module Dnsimple
|
|
5
5
|
# @return [String] The TLD in DNSimple.
|
6
6
|
attr_accessor :tld
|
7
7
|
|
8
|
-
# @return [
|
8
|
+
# @return [Integer] The TLD type.
|
9
9
|
attr_accessor :tld_type
|
10
10
|
|
11
11
|
# @return [Boolean] True if Whois Privacy Protection is available.
|
@@ -17,7 +17,7 @@ module Dnsimple
|
|
17
17
|
# @return [Boolean] True if IDN is available.
|
18
18
|
attr_accessor :idn
|
19
19
|
|
20
|
-
# @return [
|
20
|
+
# @return [Integer] The minimum registration period, in years.
|
21
21
|
attr_accessor :minimum_registration
|
22
22
|
|
23
23
|
# @return [Boolean] True if DNSimple supports registrations for this TLD.
|
data/lib/dnsimple/struct/user.rb
CHANGED
data/lib/dnsimple/struct/zone.rb
CHANGED
@@ -2,10 +2,10 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class Zone < Base
|
5
|
-
# @return [
|
5
|
+
# @return [Integer] The zone ID in DNSimple.
|
6
6
|
attr_accessor :id
|
7
7
|
|
8
|
-
# @return [
|
8
|
+
# @return [Integer] The associated account ID.
|
9
9
|
attr_accessor :account_id
|
10
10
|
|
11
11
|
# @return [String] The zone name.
|
@@ -2,13 +2,13 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class ZoneRecord < Base
|
5
|
-
# @return [
|
5
|
+
# @return [Integer] The record ID in DNSimple.
|
6
6
|
attr_accessor :id
|
7
7
|
|
8
8
|
# @return [String] The associated zone ID.
|
9
9
|
attr_accessor :zone_id
|
10
10
|
|
11
|
-
# @return [
|
11
|
+
# @return [Integer] The ID of the parent record, if this record is dependent on another record.
|
12
12
|
attr_accessor :parent_id
|
13
13
|
|
14
14
|
# @return [String] The type of record, in uppercase.
|
@@ -20,10 +20,10 @@ module Dnsimple
|
|
20
20
|
# @return [String] The plain-text record content.
|
21
21
|
attr_accessor :content
|
22
22
|
|
23
|
-
# @return [
|
23
|
+
# @return [Integer] The TTL value.
|
24
24
|
attr_accessor :ttl
|
25
25
|
|
26
|
-
# @return [
|
26
|
+
# @return [Integer] The priority value, if the type of record accepts a priority.
|
27
27
|
attr_accessor :priority
|
28
28
|
|
29
29
|
# @return [Bool] True if this is a system record created by DNSimple. System records are read-only.
|
data/lib/dnsimple/version.rb
CHANGED
@@ -92,8 +92,8 @@ describe Dnsimple::Client, ".certificates" do
|
|
92
92
|
expect(result.csr).to eq("-----BEGIN CERTIFICATE REQUEST-----\nMIICljCCAX4CAQAwGTEXMBUGA1UEAwwOd3d3LndlcHBvcy5uZXQwggEiMA0GCSqG\nSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3MJwx9ahBG3kAwRjQdRvYZqtovUaxY6jp\nhd09975gO+2eYPDbc1yhNftVJ4KBT0zdEqzX0CwIlxE1MsnZ2YOsC7IJO531hMBp\ndBxM4tSG07xPz70AVUi9rY6YCUoJHmxoFbclpHFbtXZocR393WyzUK8047uM2mlz\n03AZKcMdyfeuo2/9TcxpTSCkklGqwqS9wtTogckaDHJDoBunAkMioGfOSMe7Yi6E\nYRtG4yPJYsDaq2yPJWV8+i0PFR1Wi5RCnPt0YdQWstHuZrxABi45+XVkzKtz3TUc\nYxrvPBucVa6uzd953u8CixNFkiOefvb/dajsv1GIwH6/Cvc1ftz1AgMBAAGgODA2\nBgkqhkiG9w0BCQ4xKTAnMCUGA1UdEQQeMByCDnd3dy53ZXBwb3MubmV0ggp3ZXBw\nb3MubmV0MA0GCSqGSIb3DQEBCwUAA4IBAQCDnVBO9RdJX0eFeZzlv5c8yG8duhKP\nl0Vl+V88fJylb/cbNj9qFPkKTK0vTXmS2XUFBChKPtLucp8+Z754UswX+QCsdc7U\nTTSG0CkyilcSubdZUERGej1XfrVQhrokk7Fu0Jh3BdT6REP0SIDTpA8ku/aRQiAp\np+h19M37S7+w/DMGDAq2LSX8jOpJ1yIokRDyLZpmwyLxutC21DXMGoJ3xZeUFrUT\nqRNwzkn2dJzgTrPkzhaXalUBqv+nfXHqHaWljZa/O0NVCFrHCdTdd53/6EE2Yabv\nq5SFTkRCpaxrvM/7a8Tr4ixD1/VKD6rw3+WC00000000000000000000\n-----END CERTIFICATE REQUEST-----\n")
|
93
93
|
expect(result.state).to eq("issued")
|
94
94
|
expect(result.authority_identifier).to eq("letsencrypt")
|
95
|
-
expect(result.created_at).to eq("2016-06-11T18:47:
|
96
|
-
expect(result.updated_at).to eq("2016-06-11T18:47:
|
95
|
+
expect(result.created_at).to eq("2016-06-11T18:47:08Z")
|
96
|
+
expect(result.updated_at).to eq("2016-06-11T18:47:37Z")
|
97
97
|
expect(result.expires_on).to eq("2016-09-09")
|
98
98
|
end
|
99
99
|
|
@@ -133,8 +133,8 @@ describe Dnsimple::Client, ".contacts" do
|
|
133
133
|
expect(result).to be_a(Dnsimple::Struct::Contact)
|
134
134
|
expect(result.id).to eq(1)
|
135
135
|
expect(result.account_id).to eq(1010)
|
136
|
-
expect(result.created_at).to eq("2016-01-19T20:50:
|
137
|
-
expect(result.updated_at).to eq("2016-01-19T20:50:
|
136
|
+
expect(result.created_at).to eq("2016-01-19T20:50:26Z")
|
137
|
+
expect(result.updated_at).to eq("2016-01-19T20:50:26Z")
|
138
138
|
end
|
139
139
|
|
140
140
|
context "when the contact does not exist" do
|
@@ -151,8 +151,8 @@ describe Dnsimple::Client, ".domains" do
|
|
151
151
|
expect(result.domain_id).to eq(228963)
|
152
152
|
expect(result.from).to eq("jim@a-domain.com")
|
153
153
|
expect(result.to).to eq("jim@another.com")
|
154
|
-
expect(result.created_at).to eq("2016-02-04T14:26:
|
155
|
-
expect(result.updated_at).to eq("2016-02-04T14:26:
|
154
|
+
expect(result.created_at).to eq("2016-02-04T14:26:50Z")
|
155
|
+
expect(result.updated_at).to eq("2016-02-04T14:26:50Z")
|
156
156
|
end
|
157
157
|
|
158
158
|
context "when the email forward does not exist" do
|
@@ -151,8 +151,8 @@ describe Dnsimple::Client, ".domains" do
|
|
151
151
|
expect(result.auto_renew).to eq(false)
|
152
152
|
expect(result.private_whois).to eq(false)
|
153
153
|
expect(result.expires_on).to eq(nil)
|
154
|
-
expect(result.created_at).to eq("2014-12-06T15:56:
|
155
|
-
expect(result.updated_at).to eq("2015-12-09T00:20:
|
154
|
+
expect(result.created_at).to eq("2014-12-06T15:56:55Z")
|
155
|
+
expect(result.updated_at).to eq("2015-12-09T00:20:56Z")
|
156
156
|
end
|
157
157
|
|
158
158
|
context "when the domain does not exist" do
|
@@ -29,7 +29,7 @@ describe Dnsimple::Client, ".identity" do
|
|
29
29
|
context "when authenticated as account" do
|
30
30
|
before do
|
31
31
|
stub_request(:get, %r{/v2/whoami$}).
|
32
|
-
to_return(read_http_fixture("whoami/
|
32
|
+
to_return(read_http_fixture("whoami/success-account.http"))
|
33
33
|
end
|
34
34
|
|
35
35
|
it "sets the account" do
|
@@ -42,7 +42,7 @@ describe Dnsimple::Client, ".identity" do
|
|
42
42
|
context "when authenticated as user" do
|
43
43
|
before do
|
44
44
|
stub_request(:get, %r{/v2/whoami$}).
|
45
|
-
to_return(read_http_fixture("whoami/
|
45
|
+
to_return(read_http_fixture("whoami/success-user.http"))
|
46
46
|
end
|
47
47
|
|
48
48
|
it "sets the user" do
|
@@ -10,7 +10,7 @@ describe Dnsimple::Client, ".registrar" do
|
|
10
10
|
|
11
11
|
before do
|
12
12
|
stub_request(:put, %r{/v2/#{account_id}/registrar/domains/#{domain_id}}).
|
13
|
-
to_return(read_http_fixture("
|
13
|
+
to_return(read_http_fixture("enableDomainAutoRenewal/success.http"))
|
14
14
|
end
|
15
15
|
|
16
16
|
|
@@ -47,7 +47,7 @@ describe Dnsimple::Client, ".registrar" do
|
|
47
47
|
|
48
48
|
before do
|
49
49
|
stub_request(:delete, %r{/v2/#{account_id}/registrar/domains/#{domain_id}}).
|
50
|
-
to_return(read_http_fixture("
|
50
|
+
to_return(read_http_fixture("disableDomainAutoRenewal/success.http"))
|
51
51
|
end
|
52
52
|
|
53
53
|
|
@@ -26,9 +26,57 @@ describe Dnsimple::Client, ".registrar" do
|
|
26
26
|
|
27
27
|
result = response.data
|
28
28
|
expect(result).to be_a(Dnsimple::Struct::DomainCheck)
|
29
|
-
expect(result.domain).to eq("
|
29
|
+
expect(result.domain).to eq("ruby.codes")
|
30
30
|
expect(result.available).to be_truthy
|
31
|
-
expect(result.premium).to
|
31
|
+
expect(result.premium).to be_truthy
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "#domain_premium_price" do
|
36
|
+
let(:account_id) { 1010 }
|
37
|
+
|
38
|
+
context "when premium price" do
|
39
|
+
before do
|
40
|
+
stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price[\?action]*}).
|
41
|
+
to_return(read_http_fixture("getDomainPremiumPrice/success.http"))
|
42
|
+
end
|
43
|
+
|
44
|
+
it "builds the correct request" do
|
45
|
+
subject.domain_premium_price(account_id, domain_name = "ruby.codes")
|
46
|
+
|
47
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price").
|
48
|
+
with(headers: { "Accept" => "application/json" })
|
49
|
+
end
|
50
|
+
|
51
|
+
it "returns the premium price" do
|
52
|
+
response = subject.domain_premium_price(account_id, "ruby.codes")
|
53
|
+
expect(response).to be_a(Dnsimple::Response)
|
54
|
+
|
55
|
+
result = response.data
|
56
|
+
expect(result).to be_a(Dnsimple::Struct::DomainPremiumPrice)
|
57
|
+
expect(result.premium_price).to eq("109.00")
|
58
|
+
expect(result.action).to eq("registration")
|
59
|
+
end
|
60
|
+
|
61
|
+
it "builds the correct request when action is passed" do
|
62
|
+
subject.domain_premium_price(account_id, domain_name = "ruby.codes", action: "registration")
|
63
|
+
|
64
|
+
expect(WebMock).to have_requested(:get, "https://api.dnsimple.test/v2/#{account_id}/registrar/domains/#{domain_name}/premium_price?action=registration").
|
65
|
+
with(headers: { "Accept" => "application/json" })
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
context "when not premium price" do
|
70
|
+
before do
|
71
|
+
stub_request(:get, %r{/v2/#{account_id}/registrar/domains/.+/premium_price$}).
|
72
|
+
to_return(read_http_fixture("getDomainPremiumPrice/failure.http"))
|
73
|
+
end
|
74
|
+
|
75
|
+
it "raises error" do
|
76
|
+
expect {
|
77
|
+
subject.domain_premium_price(account_id, "example.com")
|
78
|
+
}.to raise_error(Dnsimple::RequestError, "`example.com` is not a premium domain for registration")
|
79
|
+
end
|
32
80
|
end
|
33
81
|
end
|
34
82
|
|
@@ -55,8 +103,9 @@ describe Dnsimple::Client, ".registrar" do
|
|
55
103
|
expect(response).to be_a(Dnsimple::Response)
|
56
104
|
|
57
105
|
result = response.data
|
58
|
-
expect(result).to be_a(Dnsimple::Struct::
|
106
|
+
expect(result).to be_a(Dnsimple::Struct::DomainRegistration)
|
59
107
|
expect(result.id).to be_a(Integer)
|
108
|
+
expect(result.domain_id).to be_a(Integer)
|
60
109
|
end
|
61
110
|
|
62
111
|
context "when the attributes are incomplete" do
|
@@ -89,8 +138,9 @@ describe Dnsimple::Client, ".registrar" do
|
|
89
138
|
expect(response).to be_a(Dnsimple::Response)
|
90
139
|
|
91
140
|
result = response.data
|
92
|
-
expect(result).to be_a(Dnsimple::Struct::
|
141
|
+
expect(result).to be_a(Dnsimple::Struct::DomainRenewal)
|
93
142
|
expect(result.id).to be_a(Integer)
|
143
|
+
expect(result.domain_id).to be_a(Integer)
|
94
144
|
end
|
95
145
|
|
96
146
|
context "when it is too soon for the domain to be renewed" do
|
@@ -128,9 +178,9 @@ describe Dnsimple::Client, ".registrar" do
|
|
128
178
|
expect(response).to be_a(Dnsimple::Response)
|
129
179
|
|
130
180
|
result = response.data
|
131
|
-
expect(result).to be_a(Dnsimple::Struct::
|
132
|
-
expect(result.
|
133
|
-
expect(result.
|
181
|
+
expect(result).to be_a(Dnsimple::Struct::DomainTransfer)
|
182
|
+
expect(result.id).to be_a(Integer)
|
183
|
+
expect(result.domain_id).to be_a(Integer)
|
134
184
|
end
|
135
185
|
|
136
186
|
context "when the attributes are incomplete" do
|