dnsimple 4.4.0 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop_dnsimple.yml +34 -2
  3. data/.travis.yml +5 -1
  4. data/CHANGELOG.md +11 -0
  5. data/CONTRIBUTING.md +12 -7
  6. data/README.md +1 -2
  7. data/dnsimple.gemspec +1 -1
  8. data/lib/dnsimple/client.rb +1 -1
  9. data/lib/dnsimple/client/accounts.rb +0 -1
  10. data/lib/dnsimple/client/certificates.rb +1 -0
  11. data/lib/dnsimple/client/clients.rb +4 -2
  12. data/lib/dnsimple/client/contacts.rb +0 -5
  13. data/lib/dnsimple/client/domains.rb +0 -4
  14. data/lib/dnsimple/client/{collaborators.rb → domains_collaborators.rb} +1 -1
  15. data/lib/dnsimple/client/registrar_delegation.rb +4 -4
  16. data/lib/dnsimple/client/services.rb +0 -2
  17. data/lib/dnsimple/client/tlds.rb +14 -17
  18. data/lib/dnsimple/client/webhooks.rb +0 -3
  19. data/lib/dnsimple/client/zones.rb +0 -1
  20. data/lib/dnsimple/client/zones_distributions.rb +47 -0
  21. data/lib/dnsimple/client/zones_records.rb +23 -28
  22. data/lib/dnsimple/struct.rb +2 -0
  23. data/lib/dnsimple/struct/vanity_name_server.rb +25 -0
  24. data/lib/dnsimple/struct/zone_distribution.rb +11 -0
  25. data/lib/dnsimple/version.rb +1 -1
  26. data/spec/dnsimple/client/{collaborators_spec.rb → domains_collaborators_spec.rb} +0 -0
  27. data/spec/dnsimple/client/registrar_delegation_spec.rb +3 -2
  28. data/spec/dnsimple/client/tlds_spec.rb +13 -12
  29. data/spec/dnsimple/client/zones_distributions_spec.rb +135 -0
  30. data/spec/dnsimple/client/zones_records_spec.rb +33 -33
  31. data/spec/dnsimple/client_spec.rb +5 -5
  32. data/spec/fixtures.http/checkZoneDistribution/error.http +21 -0
  33. data/spec/fixtures.http/checkZoneDistribution/failure.http +21 -0
  34. data/spec/fixtures.http/checkZoneDistribution/success.http +21 -0
  35. data/spec/fixtures.http/checkZoneRecordDistribution/error.http +21 -0
  36. data/spec/fixtures.http/checkZoneRecordDistribution/failure.http +21 -0
  37. data/spec/fixtures.http/checkZoneRecordDistribution/success.http +21 -0
  38. data/spec/spec_helper.rb +1 -1
  39. metadata +24 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5798dd92561074094a81017acdd5337d2497e6b0
4
- data.tar.gz: cde903898b98b7d316d0542f7e9257de64f5196a
2
+ SHA256:
3
+ metadata.gz: 49d2f2a2d0892e3ae7e31b563035cd668200f164a05fcde6b59b5fb497a123ee
4
+ data.tar.gz: 572cf3a3277efb2cb55cd5f9a0fc644bfe4a356a2853846e6f3af37a3964e28e
5
5
  SHA512:
6
- metadata.gz: dc7c8c73aa1deace9034c3d5e4f8a392c0dbd966b73ff28c1771f581614f6efbe74e331b01225552513c63d006637f24d3df07ac68b44940aa9ada62d0a99c99
7
- data.tar.gz: 6c1cc1d2121ccbbc316bcd55a99d3c4fca2a00410298c56f69bbc22b925ce0cee1b46bc30ed97467d202183a690982b61c49ad3d84fefecbb1800b91394fe924
6
+ metadata.gz: 90c025c122e88a6408f57abf2ff564ea309e10af4e85c16c2e1d8b513b58cfb726514634abd00e746e98a966827df7082d16ec333d32cb5290c0711a2ac94bd4
7
+ data.tar.gz: ba8db8d64adddf8d7aa04f66527eaa0fb00a6ed00be88c52c0a23d21b616ef0ef03a7850e83b0571f6be7d2e227915a4b755b58064136d199adce9b3b2ccf117
@@ -1,4 +1,8 @@
1
1
  # Defaults https://github.com/bbatsov/rubocop/blob/master/config/default.yml
2
+ #
3
+ # References:
4
+ # * https://github.com/bbatsov/ruby-style-guide
5
+ # * https://rubocop.readthedocs.io/
2
6
 
3
7
  AllCops:
4
8
  Exclude:
@@ -10,6 +14,11 @@ AllCops:
10
14
  Bundler/OrderedGems:
11
15
  Enabled: false
12
16
 
17
+ # This cop requires odd code indentations (as of rubocop 0.57.0)
18
+ # https://github.com/rubocop-hq/rubocop/issues/5956
19
+ Layout/AccessModifierIndentation:
20
+ Enabled: false
21
+
13
22
  # Generally, the keyword style uses a lot of space. This is particularly true when
14
23
  # you use case/if statements, in combination with a long-name variable.
15
24
  #
@@ -20,7 +29,7 @@ Bundler/OrderedGems:
20
29
  # do_else
21
30
  # end
22
31
  #
23
- Lint/EndAlignment:
32
+ Layout/EndAlignment:
24
33
  EnforcedStyleAlignWith: variable
25
34
 
26
35
  # [codesmell]
@@ -84,6 +93,11 @@ Metrics/ParameterLists:
84
93
  Metrics/PerceivedComplexity:
85
94
  Enabled: false
86
95
 
96
+ # We tend to use @_name to represent a variable that is memoized,
97
+ # but it should not be accessed directly and kept as private.
98
+ Naming/MemoizedInstanceVariableName:
99
+ Enabled: false
100
+
87
101
  # We use it from time to time, as it's not always possible (or maintainable)
88
102
  # to use simple ? methods.
89
103
  # Moreover, it's actually more efficient to not-use predicates:
@@ -91,11 +105,24 @@ Metrics/PerceivedComplexity:
91
105
  Naming/PredicateName:
92
106
  Enabled: false
93
107
 
108
+ # This cop triggers several false positives that make sense in our domain model.
109
+ # For instance, ip is considered an uncommunicative parameter name:
110
+ #
111
+ # ipv4_to_arpa_name(ip)
112
+ #
113
+ Naming/UncommunicativeMethodParamName:
114
+ Enabled: false
115
+
94
116
  # [codesmell]
95
117
  # I don't really get the point of this cop.
96
118
  Performance/RedundantMerge:
97
119
  Enabled: false
98
120
 
121
+ # This cop returns false positive violations (as of rubocop 0.57.0)
122
+ # https://github.com/rubocop-hq/rubocop/issues/5953
123
+ Style/AccessModifierDeclarations:
124
+ Enabled: false
125
+
99
126
  # Do not use "and" or "or" in conditionals, but for readability we can use it
100
127
  # to chain executions. Just beware of operator order.
101
128
  Style/AndOr:
@@ -229,7 +256,12 @@ Style/StringLiteralsInInterpolation:
229
256
 
230
257
  # It's nice to be consistent. The trailing comma also allows easy reordering,
231
258
  # and doesn't cause a diff in Git when you add a line to the bottom.
232
- Style/TrailingCommaInLiteral:
259
+ Style/TrailingCommaInArrayLiteral:
260
+ EnforcedStyleForMultiline: consistent_comma
261
+
262
+ # It's nice to be consistent. The trailing comma also allows easy reordering,
263
+ # and doesn't cause a diff in Git when you add a line to the bottom.
264
+ Style/TrailingCommaInHashLiteral:
233
265
  EnforcedStyleForMultiline: consistent_comma
234
266
 
235
267
  Style/TrivialAccessors:
@@ -3,11 +3,11 @@ language: ruby
3
3
  sudo: false
4
4
 
5
5
  rvm:
6
- - 2.0
7
6
  - 2.1
8
7
  - 2.2
9
8
  - 2.3
10
9
  - 2.4
10
+ - 2.5
11
11
 
12
12
  env:
13
13
  - COVERALL=1
@@ -16,3 +16,7 @@ before_install:
16
16
  - rvm get latest
17
17
  - gem update --system
18
18
  - gem install bundler
19
+
20
+ notifications:
21
+ slack:
22
+ secure: "N9zPR5jnF1TBiqvb3mCV6Wem3TIvqu4tXiob2P66vBMwmj1ewWvyUzNLwAEOCDc3mRfsI50IYXHewckAUpCWW7XEJlT/pv8llMsoiHqArb7SGJyDdy3ZRr35L7glixs/ikod+xhRKXMM3jML/2MgSa+Culzhl42tMUFDk+bBBQU="
@@ -3,6 +3,17 @@
3
3
  This project uses [Semantic Versioning 2.0.0](http://semver.org/).
4
4
 
5
5
 
6
+ ### 4.5.0
7
+
8
+ - NEW: Added zone distribution and zone record distribution (GH-160)
9
+
10
+ - CHANGED: Bump minimum Ruby requirement to 2.1
11
+ - CHANGED: Introduce Dnsimple::Struct::VanityNameServer (GH-144)
12
+ - CHANGED: Fix name inconsistency of the Collaborator module (GH-154)
13
+
14
+ - REMOVED: Removed extra alias (GH-168). You should use `dnsimple.foo.list_foo` instead of `dnsimple.foo.list`. Same for create/update. The change ensures consistency across the various clients. We prefer fully qualified methods.
15
+
16
+
6
17
  #### 4.4.0
7
18
 
8
19
  - NEW: Added Let's Encrypt certificate methods (GH-159)
@@ -2,19 +2,25 @@
2
2
 
3
3
  ## Getting started
4
4
 
5
+ #### 1. Clone the repository
6
+
5
7
  Clone the repository and move into it:
6
8
 
9
+ ```shell
10
+ git clone git@github.com:dnsimple/dnsimple-ruby.git
11
+ cd dnsimple-ruby
7
12
  ```
8
- $ git clone git@github.com:dnsimple/dnsimple-ruby.git
9
- $ cd dnsimple-ruby
10
- ```
13
+
14
+ #### 2. Install the dependencies
11
15
 
12
16
  Install the dependencies using [Bundler](http://bundler.io/):
13
17
 
14
18
  ```
15
- $ bundle
19
+ bundle
16
20
  ```
17
21
 
22
+ #### 3. Build and test
23
+
18
24
  [Run the test suite](#testing) to check everything works as expected.
19
25
 
20
26
 
@@ -23,7 +29,7 @@ $ bundle
23
29
  To run the test suite:
24
30
 
25
31
  ```
26
- $ rake
32
+ rake
27
33
  ```
28
34
 
29
35
 
@@ -31,5 +37,4 @@ $ rake
31
37
 
32
38
  Submit unit tests for your changes. You can test your changes on your machine by [running the test suite](#testing).
33
39
 
34
- When you submit a PR, tests will also be run on the continuous integration environment [through Travis](https://travis-ci.org/dnsimple/dnsimple-ruby).
35
-
40
+ When you submit a PR, tests will also be run on the [continuous integration environment via Travis](https://travis-ci.org/dnsimple/dnsimple-ruby).
data/README.md CHANGED
@@ -14,7 +14,7 @@ We provide a full API and an easy-to-use web interface so you can get your domai
14
14
  You can install the gem manually:
15
15
 
16
16
  ```
17
- $ gem install dnsimple
17
+ gem install dnsimple
18
18
  ```
19
19
 
20
20
  Or use Bundler and define it as a dependency in your Gemfile:
@@ -85,7 +85,6 @@ client = Dnsimple::Client.new(user_agent: "my-app")
85
85
 
86
86
  The value you provide will be appended to the default `User-Agent` the client uses. For example, if you use `my-app`, the final header value will be `dnsimple-ruby/4.1.0 my-app` (note that it will vary depending on the client version).
87
87
 
88
-
89
88
  ## License
90
89
 
91
90
  Copyright (c) 2010-2018 Aetrion LLC. This is Free Software distributed under the MIT license.
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.summary = 'The DNSimple API client for Ruby'
12
12
  s.description = 'The DNSimple API client for Ruby.'
13
13
 
14
- s.required_ruby_version = ">= 2.0"
14
+ s.required_ruby_version = ">= 2.1"
15
15
 
16
16
  s.require_paths = ['lib']
17
17
  s.files = `git ls-files`.split("\n")
@@ -61,7 +61,7 @@ module Dnsimple
61
61
  def initialize(options = {})
62
62
  defaults = Dnsimple::Default.options
63
63
 
64
- Dnsimple::Default.keys.each do |key| # rubocop:disable Performance/HashEachMethods
64
+ Dnsimple::Default.keys.each do |key|
65
65
  instance_variable_set(:"@#{key}", options[key] || defaults[key])
66
66
  end
67
67
 
@@ -18,7 +18,6 @@ module Dnsimple
18
18
 
19
19
  Dnsimple::Response.new(response, response["data"].map { |r| Struct::Account.new(r) })
20
20
  end
21
- alias list accounts
22
21
  alias list_accounts accounts
23
22
 
24
23
  end
@@ -29,6 +29,7 @@ module Dnsimple
29
29
 
30
30
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Certificate.new(r) })
31
31
  end
32
+ alias list_certificates certificates
32
33
 
33
34
  # List ALL the certificates for the domain in the account.
34
35
  #
@@ -137,7 +137,7 @@ module Dnsimple
137
137
  require_relative 'domains_dnssec'
138
138
  require_relative 'domains_email_forwards'
139
139
  require_relative 'domains_pushes'
140
- require_relative 'collaborators'
140
+ require_relative 'domains_collaborators'
141
141
 
142
142
  class DomainsService < ClientService
143
143
  include Client::Domains
@@ -145,7 +145,7 @@ module Dnsimple
145
145
  include Client::DomainsDnssec
146
146
  include Client::DomainsEmailForwards
147
147
  include Client::DomainsPushes
148
- include Client::Collaborators
148
+ include Client::DomainsCollaborators
149
149
  end
150
150
 
151
151
 
@@ -212,10 +212,12 @@ module Dnsimple
212
212
 
213
213
  require_relative 'zones'
214
214
  require_relative 'zones_records'
215
+ require_relative 'zones_distributions'
215
216
 
216
217
  class ZonesService < ClientService
217
218
  include Client::Zones
218
219
  include Client::ZonesRecords
220
+ include Client::ZonesDistributions
219
221
  end
220
222
 
221
223
 
@@ -29,7 +29,6 @@ module Dnsimple
29
29
 
30
30
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Contact.new(r) })
31
31
  end
32
- alias list contacts
33
32
  alias list_contacts contacts
34
33
 
35
34
  # Lists ALL the contacts in the account.
@@ -54,7 +53,6 @@ module Dnsimple
54
53
  def all_contacts(account_id, options = {})
55
54
  paginate(:contacts, account_id, options)
56
55
  end
57
- alias all all_contacts
58
56
 
59
57
  # Creates a contact in the account.
60
58
  #
@@ -72,7 +70,6 @@ module Dnsimple
72
70
 
73
71
  Dnsimple::Response.new(response, Struct::Contact.new(response["data"]))
74
72
  end
75
- alias create create_contact
76
73
 
77
74
  # Gets a contact from the account.
78
75
  #
@@ -107,7 +104,6 @@ module Dnsimple
107
104
 
108
105
  Dnsimple::Response.new(response, Struct::Contact.new(response["data"]))
109
106
  end
110
- alias update update_contact
111
107
 
112
108
  # Deletes a contact from the account.
113
109
  #
@@ -127,7 +123,6 @@ module Dnsimple
127
123
 
128
124
  Dnsimple::Response.new(response, nil)
129
125
  end
130
- alias delete delete_contact
131
126
 
132
127
  end
133
128
  end
@@ -33,7 +33,6 @@ module Dnsimple
33
33
 
34
34
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Domain.new(r) })
35
35
  end
36
- alias list domains
37
36
  alias list_domains domains
38
37
 
39
38
  # Lists ALL the domains in the account.
@@ -59,7 +58,6 @@ module Dnsimple
59
58
  def all_domains(account_id, options = {})
60
59
  paginate(:domains, account_id, options)
61
60
  end
62
- alias all all_domains
63
61
 
64
62
  # Creates a domain in the account.
65
63
  #
@@ -78,7 +76,6 @@ module Dnsimple
78
76
 
79
77
  Dnsimple::Response.new(response, Struct::Domain.new(response["data"]))
80
78
  end
81
- alias create create_domain
82
79
 
83
80
  # Gets a domain from the account.
84
81
  #
@@ -115,7 +112,6 @@ module Dnsimple
115
112
 
116
113
  Dnsimple::Response.new(response, nil)
117
114
  end
118
- alias delete delete_domain
119
115
 
120
116
  # Resets the domain token.
121
117
  #
@@ -1,6 +1,6 @@
1
1
  module Dnsimple
2
2
  class Client
3
- module Collaborators
3
+ module DomainsCollaborators
4
4
 
5
5
  # Lists the collaborators for a domain.
6
6
  #
@@ -56,19 +56,19 @@ module Dnsimple
56
56
  # @param [#to_s] domain_name the domain name to check
57
57
  # @param [Array] attributes
58
58
  # @param [Hash] options
59
- # @return [Dnsimple::Response<Array>]
59
+ # @return [Dnsimple::Response<Array<Dnsimple::Struct::VanityNameServer>>]
60
60
  #
61
61
  # @raise [RequestError] When the request fails.
62
62
  def change_domain_delegation_to_vanity(account_id, domain_name, attributes, options = {})
63
63
  endpoint = Client.versioned("/%s/registrar/domains/%s/delegation/vanity" % [account_id, domain_name])
64
64
  response = client.put(endpoint, attributes, options)
65
65
 
66
- Dnsimple::Response.new(response, response["data"])
66
+ Dnsimple::Response.new(response, response["data"].map { |r| Struct::VanityNameServer.new(r) })
67
67
  end
68
68
 
69
69
  # Disable vanity name servers for the domain.
70
70
  #
71
- # @see https://developer.dnsimple.com/v2/registrar/delegation/#delegateFromVanity
71
+ # @see https://developer.dnsimple.com/v2/registrar/delegation/#dedelegateFromVanity
72
72
  #
73
73
  # @example Disable vanity name servers for example.com:
74
74
  # client.registrar.change_domain_delegation_from_vanity(1010, "example.com")
@@ -83,7 +83,7 @@ module Dnsimple
83
83
  endpoint = Client.versioned("/%s/registrar/domains/%s/delegation/vanity" % [account_id, domain_name])
84
84
  response = client.delete(endpoint, options)
85
85
 
86
- Dnsimple::Response.new(response, response["data"])
86
+ Dnsimple::Response.new(response, nil)
87
87
  end
88
88
 
89
89
  end
@@ -28,7 +28,6 @@ module Dnsimple
28
28
 
29
29
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Service.new(r) })
30
30
  end
31
- alias list services
32
31
  alias list_services services
33
32
 
34
33
  # Lists ALL the available one-click services.
@@ -55,7 +54,6 @@ module Dnsimple
55
54
  def all_services(options = {})
56
55
  paginate(:services, options)
57
56
  end
58
- alias all all_services
59
57
 
60
58
  # Gets the service with specified ID.
61
59
  #
@@ -1,18 +1,18 @@
1
1
  module Dnsimple
2
2
  class Client
3
3
  module Tlds
4
- # Lists the tlds available for registration
4
+ # Lists the TLDs available for registration
5
5
  #
6
- # @see https://developer.dnsimple.com/v2/tlds/#list
6
+ # @see https://developer.dnsimple.com/v2/tlds/#listTlds
7
7
  #
8
8
  # @example List TLDs in the first page
9
- # client.tlds.list
9
+ # client.tlds.list_tlds
10
10
  #
11
11
  # @example List TLDs, providing a specific page
12
- # client.tlds.list(page: 2)
12
+ # client.tlds.list_tlds(page: 2)
13
13
  #
14
14
  # @example List TLDs, providing sorting policy
15
- # client.tlds.list(sort: "tld:asc")
15
+ # client.tlds.list_tlds(sort: "tld:asc")
16
16
  #
17
17
  # @param [Hash] options the filtering and sorting options
18
18
  # @option options [Integer] :page current page (pagination)
@@ -21,13 +21,11 @@ module Dnsimple
21
21
  # @return [Dnsimple::PaginatedResponse<Dnsimple::Struct::Tld>]
22
22
  #
23
23
  # @raise [Dnsimple::RequestError]
24
- def tlds(options = {})
24
+ def list_tlds(options = {})
25
25
  response = client.get(Client.versioned("/tlds"), Options::ListOptions.new(options))
26
26
 
27
27
  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Tld.new(r) })
28
28
  end
29
- alias list tlds
30
- alias list_tlds tlds
31
29
 
32
30
  # Lists ALL the TLDs in DNSimple.
33
31
  #
@@ -37,8 +35,8 @@ module Dnsimple
37
35
  # Please use this method carefully, as fetching the entire collection will increase the number of requests
38
36
  # you send to the API server and you may eventually risk to hit the throttle limit.
39
37
  #
40
- # @see https://developer.dnsimple.com/v2/tlds/#list
41
- # @see #tlds
38
+ # @see https://developer.dnsimple.com/v2/tlds/#listTlds
39
+ # @see #list_tlds
42
40
  #
43
41
  # @example List all TLDs in DNSimple
44
42
  # client.tlds.all
@@ -51,13 +49,12 @@ module Dnsimple
51
49
  #
52
50
  # @raise [Dnsimple::RequestError]
53
51
  def all_tlds(options = {})
54
- paginate(:tlds, options)
52
+ paginate(:list_tlds, options)
55
53
  end
56
- alias all all_tlds
57
54
 
58
- # Gets a TLD's details
55
+ # Gets a TLD details
59
56
  #
60
- # @see https://developer.dnsimple.com/v2/tlds/#get
57
+ # @see https://developer.dnsimple.com/v2/tlds/#getTld
61
58
  #
62
59
  # @example Get information on a specific TLD
63
60
  # client.tlds.tld('com')
@@ -76,10 +73,10 @@ module Dnsimple
76
73
 
77
74
  # Gets the extended attributes for a TLD.
78
75
  #
79
- # @see https://developer.dnsimple.com/v2/tlds/#extended-attributes
76
+ # @see https://developer.dnsimple.com/v2/tlds/#getTldExtendedAttributes
80
77
  #
81
78
  # @example Get extended attributes for a specific TLD
82
- # client.tlds.extended_attributes('uk')
79
+ # client.tlds.tld_extended_attributes('uk')
83
80
  #
84
81
  # @param [#to_s] tld The TLD name.
85
82
  # @param [Hash] options
@@ -87,7 +84,7 @@ module Dnsimple
87
84
  #
88
85
  # @raise [Dnsimple::NotFoundError]
89
86
  # @raise [Dnsimple::RequestError]
90
- def extended_attributes(tld, options = {})
87
+ def tld_extended_attributes(tld, options = {})
91
88
  response = client.get(Client.versioned("/tlds/%s/extended_attributes" % tld), options)
92
89
 
93
90
  Dnsimple::CollectionResponse.new(response, response["data"].map { |r| Struct::ExtendedAttribute.new(r) })