dnsimple 8.7.1 → 8.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/auto-merge.yml +1 -1
  3. data/.github/workflows/ci.yml +1 -13
  4. data/.github/workflows/release.yml +2 -2
  5. data/.rubocop_dnsimple.yml +19 -76
  6. data/CHANGELOG.md +4 -0
  7. data/Gemfile +5 -2
  8. data/lib/dnsimple/client/billing.rb +2 -0
  9. data/lib/dnsimple/client/clients.rb +45 -0
  10. data/lib/dnsimple/client/dns_analytics.rb +30 -0
  11. data/lib/dnsimple/client/domains.rb +1 -0
  12. data/lib/dnsimple/client/domains_dnssec.rb +1 -0
  13. data/lib/dnsimple/client/domains_pushes.rb +0 -1
  14. data/lib/dnsimple/client/identity.rb +2 -0
  15. data/lib/dnsimple/client/registrar.rb +1 -0
  16. data/lib/dnsimple/client/registrar_registrant_changes.rb +1 -0
  17. data/lib/dnsimple/client/services.rb +1 -0
  18. data/lib/dnsimple/client/templates_records.rb +1 -0
  19. data/lib/dnsimple/client/tlds.rb +2 -0
  20. data/lib/dnsimple/client.rb +0 -1
  21. data/lib/dnsimple/default.rb +1 -2
  22. data/lib/dnsimple/error.rb +8 -2
  23. data/lib/dnsimple/options.rb +10 -0
  24. data/lib/dnsimple/response.rb +12 -0
  25. data/lib/dnsimple/struct/account.rb +2 -2
  26. data/lib/dnsimple/struct/certificate.rb +2 -2
  27. data/lib/dnsimple/struct/certificate_bundle.rb +0 -2
  28. data/lib/dnsimple/struct/certificate_purchase.rb +2 -2
  29. data/lib/dnsimple/struct/certificate_renewal.rb +2 -2
  30. data/lib/dnsimple/struct/charge.rb +3 -1
  31. data/lib/dnsimple/struct/collaborator.rb +2 -2
  32. data/lib/dnsimple/struct/contact.rb +2 -2
  33. data/lib/dnsimple/struct/delegation_signer_record.rb +2 -2
  34. data/lib/dnsimple/struct/dns_analytics.rb +18 -0
  35. data/lib/dnsimple/struct/dnssec.rb +2 -2
  36. data/lib/dnsimple/struct/domain.rb +2 -1
  37. data/lib/dnsimple/struct/domain_check.rb +2 -2
  38. data/lib/dnsimple/struct/domain_premium_price.rb +2 -2
  39. data/lib/dnsimple/struct/domain_price.rb +2 -2
  40. data/lib/dnsimple/struct/domain_push.rb +2 -2
  41. data/lib/dnsimple/struct/domain_registration.rb +2 -2
  42. data/lib/dnsimple/struct/domain_renewal.rb +2 -2
  43. data/lib/dnsimple/struct/domain_transfer.rb +2 -2
  44. data/lib/dnsimple/struct/email_forward.rb +2 -1
  45. data/lib/dnsimple/struct/extended_attribute.rb +2 -2
  46. data/lib/dnsimple/struct/oauth_token.rb +2 -2
  47. data/lib/dnsimple/struct/registrant_change.rb +2 -1
  48. data/lib/dnsimple/struct/registrant_change_check.rb +2 -1
  49. data/lib/dnsimple/struct/service.rb +2 -2
  50. data/lib/dnsimple/struct/template.rb +2 -2
  51. data/lib/dnsimple/struct/template_record.rb +2 -2
  52. data/lib/dnsimple/struct/tld.rb +2 -2
  53. data/lib/dnsimple/struct/transfer_lock.rb +2 -2
  54. data/lib/dnsimple/struct/user.rb +2 -2
  55. data/lib/dnsimple/struct/vanity_name_server.rb +2 -2
  56. data/lib/dnsimple/struct/webhook.rb +2 -2
  57. data/lib/dnsimple/struct/whoami.rb +2 -2
  58. data/lib/dnsimple/struct/whois_privacy.rb +2 -2
  59. data/lib/dnsimple/struct/whois_privacy_renewal.rb +2 -2
  60. data/lib/dnsimple/struct/zone.rb +2 -2
  61. data/lib/dnsimple/struct/zone_distribution.rb +2 -2
  62. data/lib/dnsimple/struct/zone_file.rb +2 -2
  63. data/lib/dnsimple/struct/zone_record.rb +2 -2
  64. data/lib/dnsimple/struct.rb +4 -3
  65. data/lib/dnsimple/version.rb +3 -1
  66. data/spec/dnsimple/client/dns_analytics_spec.rb +84 -0
  67. data/spec/dnsimple/client/registrar_delegation_spec.rb +4 -4
  68. data/spec/dnsimple/client/vanity_name_servers_spec.rb +1 -1
  69. data/spec/dnsimple/client/zones_records_spec.rb +2 -2
  70. data/spec/dnsimple/client_spec.rb +2 -2
  71. data/spec/dnsimple/extra_spec.rb +1 -1
  72. data/spec/fixtures.http/dnsAnalytics/success.http +20 -0
  73. metadata +7 -3
@@ -4,6 +4,7 @@ module Dnsimple
4
4
  module Options
5
5
 
6
6
  class Base
7
+
7
8
  def initialize(options)
8
9
  @options = (options || {}).dup
9
10
  end
@@ -11,15 +12,18 @@ module Dnsimple
11
12
  def to_h
12
13
  @options
13
14
  end
15
+
14
16
  end
15
17
 
16
18
  class ListOptions < Base
19
+
17
20
  def initialize(options)
18
21
  super
19
22
  _prepare_query
20
23
  _prepare_pagination
21
24
  _prepare_sort
22
25
  _prepare_filter
26
+ _prepare_groupings
23
27
  end
24
28
 
25
29
  private
@@ -46,9 +50,15 @@ module Dnsimple
46
50
  _merge(@filter) unless @filter.nil?
47
51
  end
48
52
 
53
+ def _prepare_groupings
54
+ groupings = @options.delete(:groupings)
55
+ _merge({ groupings: groupings }) unless groupings.nil?
56
+ end
57
+
49
58
  def _merge(hash)
50
59
  @options[:query].merge!(hash)
51
60
  end
61
+
52
62
  end
53
63
 
54
64
  end
@@ -77,4 +77,16 @@ module Dnsimple
77
77
 
78
78
  end
79
79
 
80
+ class PaginatedResponseWithQuery < PaginatedResponse
81
+
82
+ # @return [Hash] A hash containing the query parameters that produced the results in this response
83
+ attr_reader :query
84
+
85
+ def initialize(http_response, collection)
86
+ super
87
+ @query = http_response["query"]
88
+ end
89
+
90
+ end
91
+
80
92
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Account < Base
6
+
7
7
  # @return [Integer] The account ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -12,7 +12,7 @@ module Dnsimple
12
12
 
13
13
  # @return [String] The identifier of the plan the account is subscribed to.
14
14
  attr_accessor :plan_identifier
15
- end
16
15
 
16
+ end
17
17
  end
18
18
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Certificate < Base
6
+
7
7
  # @return [Integer] The certificate ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -42,7 +42,7 @@ module Dnsimple
42
42
 
43
43
  # @return [String] The timestamp when the certificate will expire.
44
44
  attr_accessor :expires_at
45
- end
46
45
 
46
+ end
47
47
  end
48
48
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class CertificateBundle < Base
7
6
 
8
7
  # @return [String] The certificate private key
@@ -24,6 +23,5 @@ module Dnsimple
24
23
  alias intermediate_certificates chain
25
24
 
26
25
  end
27
-
28
26
  end
29
27
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class CertificatePurchase < Base
6
+
7
7
  # @return [Integer] The certificate purchase ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -21,7 +21,7 @@ module Dnsimple
21
21
 
22
22
  # @return [String] When the certificate renewal was last updated in DNSimple.
23
23
  attr_accessor :updated_at
24
- end
25
24
 
25
+ end
26
26
  end
27
27
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class CertificateRenewal < Base
6
+
7
7
  # @return [Integer] The certificate renewal ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -24,7 +24,7 @@ module Dnsimple
24
24
 
25
25
  # @return [String] When the certificate renewal was last updated in DNSimple.
26
26
  attr_accessor :updated_at
27
- end
28
27
 
28
+ end
29
29
  end
30
30
  end
@@ -7,6 +7,7 @@ module Dnsimple
7
7
  class Charge < Base
8
8
 
9
9
  class ChargeItem < Base
10
+
10
11
  # @return [String] The description of the charge item.
11
12
  attr_accessor :description
12
13
 
@@ -29,6 +30,7 @@ module Dnsimple
29
30
  def amount=(amount)
30
31
  @amount = BigDecimal(amount)
31
32
  end
33
+
32
34
  end
33
35
 
34
36
  # @return [String] The reference number of the invoice.
@@ -79,7 +81,7 @@ module Dnsimple
79
81
  def total_amount=(total_amount)
80
82
  @total_amount = BigDecimal(total_amount)
81
83
  end
82
- end
83
84
 
85
+ end
84
86
  end
85
87
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Collaborator < Base
6
+
7
7
  # @return [Integer] The collaborator ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -30,7 +30,7 @@ module Dnsimple
30
30
 
31
31
  # @return [String,NilClass] When the collaborator has accepted the invitation.
32
32
  attr_accessor :accepted_at
33
- end
34
33
 
34
+ end
35
35
  end
36
36
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Contact < Base
6
+
7
7
  # @return [Integer] The contact ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -57,7 +57,7 @@ module Dnsimple
57
57
 
58
58
  # @return [String] When the contact was last updated in DNSimple.
59
59
  attr_accessor :updated_at
60
- end
61
60
 
61
+ end
62
62
  end
63
63
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class DelegationSignerRecord < Base
6
+
7
7
  # @return [Integer] The ID of the delegation signer record in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -30,7 +30,7 @@ module Dnsimple
30
30
 
31
31
  # @return [String] When the delegation signing record was last updated in DNSimple.
32
32
  attr_accessor :updated_at
33
- end
34
33
 
34
+ end
35
35
  end
36
36
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dnsimple
4
+ module Struct
5
+ class DnsAnalytics < Base
6
+
7
+ # @return [Integer] The recorded volume
8
+ attr_accessor :volume
9
+
10
+ # @return [Date] The date
11
+ attr_accessor :date
12
+
13
+ # @return [String] The zone name
14
+ attr_accessor :zone_name
15
+
16
+ end
17
+ end
18
+ end
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Dnssec < Base
6
+
7
7
  # @return [Boolean] True if DNSSEC is enabled on the domain, otherwise false
8
8
  attr_accessor :enabled
9
- end
10
9
 
10
+ end
11
11
  end
12
12
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Domain < Base
6
+
7
7
  # @return [Integer] The domain ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -36,6 +36,7 @@ module Dnsimple
36
36
 
37
37
  # @return [String] When the domain was last updated in DNSimple.
38
38
  attr_accessor :updated_at
39
+
39
40
  end
40
41
  end
41
42
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class DomainCheck < Base
6
+
7
7
  # @return [String] The domain name that was checked.
8
8
  attr_accessor :domain
9
9
 
@@ -12,7 +12,7 @@ module Dnsimple
12
12
 
13
13
  # @return [Boolean] Whether the domain name is premium.
14
14
  attr_accessor :premium
15
- end
16
15
 
16
+ end
17
17
  end
18
18
  end
@@ -2,14 +2,14 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class DomainPremiumPrice < Base
6
+
7
7
  # @return [String] The domain premium price
8
8
  attr_accessor :premium_price
9
9
 
10
10
  # @return [String] The action: registration/transfer/renewal
11
11
  attr_accessor :action
12
- end
13
12
 
13
+ end
14
14
  end
15
15
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class DomainPrice < Base
6
+
7
7
  # @return [String] The domain name
8
8
  attr_accessor :domain
9
9
 
@@ -18,7 +18,7 @@ module Dnsimple
18
18
 
19
19
  # @return [Float] The price for transfer
20
20
  attr_accessor :transfer_price
21
- end
22
21
 
22
+ end
23
23
  end
24
24
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class DomainPush < Base
6
+
7
7
  # @return [Integer] The domain push ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -24,7 +24,7 @@ module Dnsimple
24
24
 
25
25
  # @return [String] When the domain push was accepted in DNSimple.
26
26
  attr_accessor :accepted_at
27
- end
28
27
 
28
+ end
29
29
  end
30
30
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class DomainRegistration < Base
6
+
7
7
  # @return [Integer] The domain registration ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -30,7 +30,7 @@ module Dnsimple
30
30
 
31
31
  # @return [String] When the domain renewal was last updated in DNSimple.
32
32
  attr_accessor :updated_at
33
- end
34
33
 
34
+ end
35
35
  end
36
36
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class DomainRenewal < Base
6
+
7
7
  # @return [Integer] The domain renewal ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -21,7 +21,7 @@ module Dnsimple
21
21
 
22
22
  # @return [String] When the domain renewal was last updated in DNSimple.
23
23
  attr_accessor :updated_at
24
- end
25
24
 
25
+ end
26
26
  end
27
27
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class DomainTransfer < Base
6
+
7
7
  # @return [Integer] The domain registration ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -30,7 +30,7 @@ module Dnsimple
30
30
 
31
31
  # @return [String] When the domain renewal was last updated in DNSimple.
32
32
  attr_accessor :updated_at
33
- end
34
33
 
34
+ end
35
35
  end
36
36
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class EmailForward < Base
6
+
7
7
  # @return [Integer] The email forward ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -21,6 +21,7 @@ module Dnsimple
21
21
 
22
22
  # @return [String] Then the email forward was last updated in DNSimple.
23
23
  attr_accessor :updated_at
24
+
24
25
  end
25
26
  end
26
27
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class ExtendedAttribute < Base
7
6
 
8
7
  class Option < Base
8
+
9
9
  # The option name
10
10
  attr_accessor :title
11
11
 
@@ -14,6 +14,7 @@ module Dnsimple
14
14
 
15
15
  # A long description of the option
16
16
  attr_accessor :description
17
+
17
18
  end
18
19
 
19
20
  # The extended attribute name
@@ -40,6 +41,5 @@ module Dnsimple
40
41
  end
41
42
 
42
43
  end
43
-
44
44
  end
45
45
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class OauthToken < Base
6
+
7
7
  # @return [String] The token you can use to authenticate.
8
8
  attr_accessor :access_token
9
9
 
@@ -15,7 +15,7 @@ module Dnsimple
15
15
 
16
16
  # @return [Integer] The account ID in DNSimple this token belongs to.
17
17
  attr_accessor :account_id
18
- end
19
18
 
19
+ end
20
20
  end
21
21
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class RegistrantChange < Base
6
+
7
7
  # @return [Integer] The registrant change ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -33,6 +33,7 @@ module Dnsimple
33
33
 
34
34
  # @return [String] When the registrant change was last updated in DNSimple.
35
35
  attr_accessor :updated_at
36
+
36
37
  end
37
38
  end
38
39
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class RegistrantChangeCheck < Base
6
+
7
7
  # @return [Integer] The associated contact ID.
8
8
  attr_accessor :contact_id
9
9
 
@@ -15,6 +15,7 @@ module Dnsimple
15
15
 
16
16
  # # @return [Boolean] True if the registrant change is a registry owner change.
17
17
  attr_accessor :registry_owner_change
18
+
18
19
  end
19
20
  end
20
21
  end
@@ -2,10 +2,10 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Service < Base
7
6
 
8
7
  class Setting < Base
8
+
9
9
  # @return [String] The setting name.
10
10
  attr_accessor :name
11
11
 
@@ -23,6 +23,7 @@ module Dnsimple
23
23
 
24
24
  # @return [Boolean] Whether the setting requires a password.
25
25
  attr_accessor :password
26
+
26
27
  end
27
28
 
28
29
  # @return [Integer] The service ID in DNSimple.
@@ -61,6 +62,5 @@ module Dnsimple
61
62
  end
62
63
 
63
64
  end
64
-
65
65
  end
66
66
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Template < Base
6
+
7
7
  # @return [Integer] The template ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -18,7 +18,7 @@ module Dnsimple
18
18
 
19
19
  # @return [String] The template description.
20
20
  attr_accessor :description
21
- end
22
21
 
22
+ end
23
23
  end
24
24
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class TemplateRecord < Base
6
+
7
7
  # @return [Integer] The template record ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -30,7 +30,7 @@ module Dnsimple
30
30
 
31
31
  # @return [String] When the template record was last updated in DNSimple.
32
32
  attr_accessor :updated_at
33
- end
34
33
 
34
+ end
35
35
  end
36
36
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Tld < Base
6
+
7
7
  # @return [String] The TLD in DNSimple.
8
8
  attr_accessor :tld
9
9
 
@@ -33,7 +33,7 @@ module Dnsimple
33
33
 
34
34
  # @return [String, nil] Type of data interface required for DNSSEC for this TLD.
35
35
  attr_accessor :dnssec_interface_type
36
- end
37
36
 
37
+ end
38
38
  end
39
39
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class TransferLock < Base
6
+
7
7
  # @return [Boolean] True if Transfer Lock is enabled on the domain, otherwise false
8
8
  attr_accessor :enabled
9
- end
10
9
 
10
+ end
11
11
  end
12
12
  end
@@ -2,14 +2,14 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class User < Base
6
+
7
7
  # @return [Integer] The user ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
10
10
  # @return [String] The user email.
11
11
  attr_accessor :email
12
- end
13
12
 
13
+ end
14
14
  end
15
15
  end
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class VanityNameServer < Base
6
+
7
7
  # @return [Integer] The vanity name server ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
@@ -21,7 +21,7 @@ module Dnsimple
21
21
 
22
22
  # @return [String] When the vanity name server was last updated in DNSimple.
23
23
  attr_accessor :updated_at
24
- end
25
24
 
25
+ end
26
26
  end
27
27
  end
@@ -2,14 +2,14 @@
2
2
 
3
3
  module Dnsimple
4
4
  module Struct
5
-
6
5
  class Webhook < Base
6
+
7
7
  # @return [Integer] The contact ID in DNSimple.
8
8
  attr_accessor :id
9
9
 
10
10
  # @return [String] The callback URL.
11
11
  attr_accessor :url
12
- end
13
12
 
13
+ end
14
14
  end
15
15
  end