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
data/lib/dnsimple/extra.rb
CHANGED
@@ -53,7 +53,7 @@ module Dnsimple
|
|
53
53
|
# @raise [ArgumentError]
|
54
54
|
def self.validate_mandatory_attributes(attributes, required)
|
55
55
|
required.each do |name|
|
56
|
-
attributes.key?(name) or raise(ArgumentError, ":#{name} is required")
|
56
|
+
attributes && attributes.key?(name) or raise(ArgumentError, ":#{name} is required")
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
|
3
|
+
# The Response represents a response returned by a client request.
|
4
|
+
#
|
5
|
+
# It wraps the content of the response data, as well other response metadata such as rate-limiting information.
|
6
|
+
class Response
|
7
|
+
|
8
|
+
# @return [HTTParty::Response]
|
9
|
+
attr_reader :http_response
|
10
|
+
|
11
|
+
# @return [Struct::Base, Array] The content of the response data field.
|
12
|
+
attr_reader :data
|
13
|
+
|
14
|
+
# @return [Fixnum] The maximum number of requests this authentication context can perform per hour.
|
15
|
+
# @see https://developer.dnsimple.com/v2/#rate-limiting
|
16
|
+
attr_reader :rate_limit
|
17
|
+
|
18
|
+
# @return [Fixnum] The number of requests remaining in the current rate limit window.
|
19
|
+
# @see https://developer.dnsimple.com/v2/#rate-limiting
|
20
|
+
attr_reader :rate_limit_remaining
|
21
|
+
|
22
|
+
# @return [Fixnum] The time at which the current rate limit window in Unix time format.
|
23
|
+
# @see https://developer.dnsimple.com/v2/#rate-limiting
|
24
|
+
attr_reader :rate_limit_reset
|
25
|
+
|
26
|
+
|
27
|
+
# @param [HTTParty::Response] http_response the HTTP response
|
28
|
+
# @param [Object] data the response data
|
29
|
+
def initialize(http_response, data)
|
30
|
+
@http_response = http_response
|
31
|
+
@data = data
|
32
|
+
|
33
|
+
@rate_limit = http_response.headers['X-RateLimit-Limit'].to_i
|
34
|
+
@rate_limit_remaining = http_response.headers['X-RateLimit-Remaining'].to_i
|
35
|
+
@rate_limit_reset = Time.at(http_response.headers['X-RateLimit-Reset'].to_i)
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
# The CollectionResponse is a specific type of Response where the data is a collection of enumerable objects.
|
41
|
+
class CollectionResponse < Response
|
42
|
+
def initialize(http_response, collection)
|
43
|
+
super
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# The PaginatedResponse is a specific type of Response that also exposes pagination metadata.
|
48
|
+
class PaginatedResponse < CollectionResponse
|
49
|
+
|
50
|
+
# @return [Fixnum] The current page.
|
51
|
+
attr_reader :page
|
52
|
+
|
53
|
+
# @return [Fixnum] The number of records per page.
|
54
|
+
attr_reader :per_page
|
55
|
+
|
56
|
+
# @return [Fixnum] The total number of records.
|
57
|
+
attr_reader :total_entries
|
58
|
+
|
59
|
+
# @return [Fixnum] The total number of pages.
|
60
|
+
attr_reader :total_pages
|
61
|
+
|
62
|
+
|
63
|
+
# Initializes a new paginated response from the response metadata,
|
64
|
+
# and with given collection.
|
65
|
+
#
|
66
|
+
# @param [Hash] http_response the HTTP response
|
67
|
+
# @param [Array] collection the enumerable collection of records returned in the response data
|
68
|
+
def initialize(http_response, collection)
|
69
|
+
super
|
70
|
+
|
71
|
+
pagination = http_response["pagination"]
|
72
|
+
@page = pagination["current_page"]
|
73
|
+
@per_page = pagination["per_page"]
|
74
|
+
@total_entries = pagination["total_entries"]
|
75
|
+
@total_pages = pagination["total_pages"]
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
data/lib/dnsimple/struct.rb
CHANGED
@@ -13,17 +13,16 @@ module Dnsimple
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
require 'dnsimple/struct/whois_privacy'
|
16
|
+
require_relative 'struct/account'
|
17
|
+
require_relative 'struct/contact'
|
18
|
+
require_relative 'struct/domain'
|
19
|
+
require_relative 'struct/domain_check'
|
20
|
+
require_relative 'struct/email_forward'
|
21
|
+
require_relative 'struct/extended_attribute'
|
22
|
+
require_relative 'struct/oauth_token'
|
23
|
+
require_relative 'struct/record'
|
24
|
+
require_relative 'struct/tld'
|
25
|
+
require_relative 'struct/user'
|
26
|
+
require_relative 'struct/whois_privacy'
|
27
|
+
require_relative 'struct/zone'
|
28
|
+
require_relative 'struct/webhook'
|
@@ -5,6 +5,9 @@ module Dnsimple
|
|
5
5
|
# @return [Fixnum] The contact ID in DNSimple.
|
6
6
|
attr_accessor :id
|
7
7
|
|
8
|
+
# @return [Fixnum] The associated account ID.
|
9
|
+
attr_accessor :account_id
|
10
|
+
|
8
11
|
# @return [String] The label to represent the contact.
|
9
12
|
attr_accessor :label
|
10
13
|
|
@@ -45,7 +48,7 @@ module Dnsimple
|
|
45
48
|
attr_accessor :fax
|
46
49
|
|
47
50
|
# @return [String] The contact email address.
|
48
|
-
attr_accessor :
|
51
|
+
attr_accessor :email
|
49
52
|
|
50
53
|
# @return [String] When the contact was created in DNSimple.
|
51
54
|
attr_accessor :created_at
|
@@ -53,8 +56,8 @@ module Dnsimple
|
|
53
56
|
# @return [String] When the contact was last updated in DNSimple.
|
54
57
|
attr_accessor :updated_at
|
55
58
|
|
56
|
-
alias :
|
57
|
-
alias :
|
59
|
+
alias :email_address :email
|
60
|
+
alias :email_address= :email=
|
58
61
|
end
|
59
62
|
|
60
63
|
end
|
@@ -5,26 +5,26 @@ module Dnsimple
|
|
5
5
|
# @return [Fixnum] The domain ID in DNSimple.
|
6
6
|
attr_accessor :id
|
7
7
|
|
8
|
-
# @return [Fixnum] The associated
|
9
|
-
attr_accessor :
|
8
|
+
# @return [Fixnum] The associated account ID.
|
9
|
+
attr_accessor :account_id
|
10
10
|
|
11
11
|
# @return [Fixnum] The associated registrant (contact) ID.
|
12
12
|
attr_accessor :registrant_id
|
13
13
|
|
14
|
-
#
|
14
|
+
# @return [String] The domain name.
|
15
15
|
attr_accessor :name
|
16
16
|
|
17
|
-
#
|
18
|
-
attr_accessor :state
|
19
|
-
|
20
|
-
# The String API token
|
17
|
+
# @return [String] The domain API token used for domain authentication.
|
21
18
|
attr_accessor :token
|
22
19
|
|
23
|
-
#
|
20
|
+
# @return [String] The domain state.
|
21
|
+
attr_accessor :state
|
22
|
+
|
23
|
+
# @return [Bool] True if the domain is set to auto-renew, false otherwise.
|
24
24
|
attr_accessor :auto_renew
|
25
25
|
|
26
|
-
#
|
27
|
-
attr_accessor :
|
26
|
+
# @return [Bool] True if the domain WHOIS privacy is enabled, false otherwise.
|
27
|
+
attr_accessor :private_whois
|
28
28
|
|
29
29
|
# @return [String] The date the domain will expire.
|
30
30
|
attr_accessor :expires_on
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
module Struct
|
3
|
+
|
4
|
+
class DomainCheck < Base
|
5
|
+
# @return [String] The domain name that was checked.
|
6
|
+
attr_accessor :domain
|
7
|
+
|
8
|
+
# @return [Boolean] Whether the domain name is available.
|
9
|
+
attr_accessor :available
|
10
|
+
|
11
|
+
# @return [Boolean] Whether the domain name is premium.
|
12
|
+
attr_accessor :premium
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -2,13 +2,23 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class EmailForward < Base
|
5
|
+
# @return [Fixnum] The email forward ID in DNSimple.
|
5
6
|
attr_accessor :id
|
7
|
+
|
8
|
+
# @return [Fixnum] The associated domain ID.
|
6
9
|
attr_accessor :domain_id
|
10
|
+
|
11
|
+
# @return [String] The "local part" of the originating email address. Anything to the left of the @ symbol.
|
7
12
|
attr_accessor :from
|
13
|
+
|
14
|
+
# @return [String] The full email address to forward to.
|
8
15
|
attr_accessor :to
|
16
|
+
|
17
|
+
# @return [String] When the email forward was created in DNSimple.
|
9
18
|
attr_accessor :created_at
|
19
|
+
|
20
|
+
# @return [String] Then the email forward was last updated in DNSimple.
|
10
21
|
attr_accessor :updated_at
|
11
22
|
end
|
12
|
-
|
13
23
|
end
|
14
24
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
module Struct
|
3
|
+
|
4
|
+
class OauthToken < Base
|
5
|
+
# @return [String] The token you can use to authenticate.
|
6
|
+
attr_accessor :access_token
|
7
|
+
|
8
|
+
# @return [String] The token type.
|
9
|
+
attr_accessor :token_type
|
10
|
+
|
11
|
+
# @return [String] The token scope (not used for now).
|
12
|
+
attr_accessor :scope
|
13
|
+
|
14
|
+
# @return [Fixnum] The account ID in DNSimple this token belongs to.
|
15
|
+
attr_accessor :account_id
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -2,20 +2,38 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class Record < Base
|
5
|
+
# @return [Fixnum] The record ID in DNSimple.
|
5
6
|
attr_accessor :id
|
6
|
-
|
7
|
-
|
7
|
+
|
8
|
+
# @return [String] The associated zone ID.
|
9
|
+
attr_accessor :zone_id
|
10
|
+
|
11
|
+
# @return [Fixnum] The ID of the parent record, if this record is dependent on another record.
|
12
|
+
attr_accessor :parent_id
|
13
|
+
|
14
|
+
# @return [String] The type of record, in uppercase.
|
8
15
|
attr_accessor :type
|
16
|
+
|
17
|
+
# @return [String] The record name (without the domain name).
|
18
|
+
attr_accessor :name
|
19
|
+
|
20
|
+
# @return [String] The plain-text record content.
|
9
21
|
attr_accessor :content
|
22
|
+
|
23
|
+
# @return [Fixnum] The TTL value.
|
10
24
|
attr_accessor :ttl
|
25
|
+
|
26
|
+
# @return [Fixnum] The priority value, if the type of record accepts a priority.
|
11
27
|
attr_accessor :priority
|
28
|
+
|
29
|
+
# @return [Bool] True if this is a system record created by DNSimple. System records are read-only.
|
30
|
+
attr_accessor :system_record
|
31
|
+
|
32
|
+
# @return [String] When the domain was created in DNSimple.
|
12
33
|
attr_accessor :created_at
|
13
|
-
attr_accessor :updated_at
|
14
34
|
|
15
|
-
|
16
|
-
|
17
|
-
alias :record_type :type
|
18
|
-
alias :record_type= :type=
|
35
|
+
# @return [String] When the domain was last updated in DNSimple.
|
36
|
+
attr_accessor :updated_at
|
19
37
|
end
|
20
38
|
|
21
39
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
module Struct
|
3
|
+
|
4
|
+
class Tld < Base
|
5
|
+
# @return [String] The TLD in DNSimple.
|
6
|
+
attr_accessor :tld
|
7
|
+
|
8
|
+
# @return [Fixnum] The TLD type.
|
9
|
+
attr_accessor :tld_type
|
10
|
+
|
11
|
+
# @return [Boolean] True if Whois Privacy Protection is available.
|
12
|
+
attr_accessor :whois_privacy
|
13
|
+
|
14
|
+
# @return [Boolean] True if TLD requires use of auto-renewal for renewals.
|
15
|
+
attr_accessor :auto_renew_only
|
16
|
+
|
17
|
+
# @return [Boolean] True if IDN is available.
|
18
|
+
attr_accessor :idn
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
data/lib/dnsimple/struct/user.rb
CHANGED
@@ -2,15 +2,11 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class User < Base
|
5
|
+
# @return [Fixnum] The user ID in DNSimple.
|
5
6
|
attr_accessor :id
|
7
|
+
|
8
|
+
# @return [String] The user email.
|
6
9
|
attr_accessor :email
|
7
|
-
attr_accessor :api_token
|
8
|
-
attr_accessor :domain_count
|
9
|
-
attr_accessor :domain_limit
|
10
|
-
attr_accessor :login_count
|
11
|
-
attr_accessor :failed_login_count
|
12
|
-
attr_accessor :created_at
|
13
|
-
attr_accessor :updated_at
|
14
10
|
end
|
15
11
|
|
16
12
|
end
|
@@ -2,17 +2,20 @@ module Dnsimple
|
|
2
2
|
module Struct
|
3
3
|
|
4
4
|
class WhoisPrivacy < Base
|
5
|
-
# @return [Fixnum] The WHOIS privacy ID in DNSimple.
|
6
|
-
attr_accessor :id
|
7
|
-
|
8
5
|
# @return [Fixnum] The associated domain ID.
|
9
6
|
attr_accessor :domain_id
|
10
7
|
|
11
|
-
# @return [
|
8
|
+
# @return [Boolean] Whether the whois privacy is enabled for the domain.
|
12
9
|
attr_accessor :enabled
|
13
10
|
|
14
|
-
# @return [String] The date the
|
11
|
+
# @return [String] The date the whois privacy will expire on.
|
15
12
|
attr_accessor :expires_on
|
13
|
+
|
14
|
+
# @return [String] When the whois privacy was created in DNSimple.
|
15
|
+
attr_accessor :created_at
|
16
|
+
|
17
|
+
# @return [String] When the whois privacy was last updated in DNSimple.
|
18
|
+
attr_accessor :updated_at
|
16
19
|
end
|
17
20
|
|
18
21
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Dnsimple
|
2
|
+
module Struct
|
3
|
+
|
4
|
+
class Zone < Base
|
5
|
+
# @return [Fixnum] The zone ID in DNSimple.
|
6
|
+
attr_accessor :id
|
7
|
+
|
8
|
+
# @return [Fixnum] The associated account ID.
|
9
|
+
attr_accessor :account_id
|
10
|
+
|
11
|
+
# @return [String] The zone name.
|
12
|
+
attr_accessor :name
|
13
|
+
|
14
|
+
# @return [Boolean] True if the zone is a reverse zone.
|
15
|
+
attr_accessor :reverse
|
16
|
+
|
17
|
+
# @return [String] When the zone was created in DNSimple.
|
18
|
+
attr_accessor :created_at
|
19
|
+
|
20
|
+
# @return [String] When the zone was last updated in DNSimple.
|
21
|
+
attr_accessor :updated_at
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/dnsimple/version.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Dnsimple::Client::ClientService do
|
4
|
+
|
5
|
+
describe "#paginate" do
|
6
|
+
service_class = Class.new(Dnsimple::Client::ClientService) do
|
7
|
+
Item = Class.new(Dnsimple::Struct::Base) do
|
8
|
+
attr_accessor :id
|
9
|
+
end
|
10
|
+
|
11
|
+
def list(account_id, options = {})
|
12
|
+
response = client.get(Dnsimple::Client.versioned("/%s/list" % [account_id]), options)
|
13
|
+
Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Item.new(r) })
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
subject { service_class.new(Dnsimple::Client.new(base_url: "https://api.example.com/", access_token: "a1b2c3")) }
|
18
|
+
|
19
|
+
let(:account_id) { 1010 }
|
20
|
+
|
21
|
+
before do
|
22
|
+
stub_request(:get, %r[/v2/#{account_id}/list\?page=1&per_page=100])
|
23
|
+
.to_return(read_http_fixture("pages-1of3.http"))
|
24
|
+
stub_request(:get, %r[/v2/#{account_id}/list\?page=2&per_page=100])
|
25
|
+
.to_return(read_http_fixture("pages-2of3.http"))
|
26
|
+
stub_request(:get, %r[/v2/#{account_id}/list\?page=3&per_page=100])
|
27
|
+
.to_return(read_http_fixture("pages-3of3.http"))
|
28
|
+
end
|
29
|
+
|
30
|
+
it "loops all the pages" do
|
31
|
+
results = subject.paginate(:list, account_id, {})
|
32
|
+
expect(results.data.size).to eq(5)
|
33
|
+
expect(results.data.map(&:id)).to eq([1, 2, 3, 4, 5])
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|