dnsimple 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2264602abbc1ed64a8305352440157f9342b477b
4
- data.tar.gz: 9cf9c92fb33974cc00a5e2d6afc91b6dcf177df3
3
+ metadata.gz: 0b4fdacf67fa0361f299902ba1f3c323150320c0
4
+ data.tar.gz: be9c4fd05ecbc4c638d1cdda892d99ecbeab8d8d
5
5
  SHA512:
6
- metadata.gz: 397d9277aa26d777c87f8f31bcc82460978bc075b4b5ec870189621e51743d1824baa6bb7229e7edecf8a2cbe48e23ff78fdc08268dd56d0802812c6afb6486e
7
- data.tar.gz: e5b17e381439cbab47dddbf02cf956be72d1498575bfa64f0b3cd3c59ca6e4afe1ddca20670669de405cc45975646459492feeeefb63d0134e43578c13c5e09d
6
+ metadata.gz: 5f5bcf78ff845d629377ac08c4f37ed8a31bb9e13f22218fa9b70d28e20245c8a5e8b9b667ce8c2b7fc9d9485698e3d84e5214920cab795b2f876f0c380b9080
7
+ data.tar.gz: 584c677a4e3c36d8a1e8fd63c86723b74bbe516ea570fa7eb3c15264d0a8a4a7a0cc40b25402a578a3d9337d7ad70b7c674db50503a1b37e2d61cf972cfa08c8
data/.travis.yml CHANGED
@@ -1,7 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0
5
- - 2.1
6
- - 2.2
3
+ - 1.9.3
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
7
7
  env: COVERALL=1
8
+ before_install:
9
+ - gem install bundler
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ #### 2.2.0
4
+
5
+ - NEW: Add support for Vanity Name Servers (GH-67, GH-63, GH-60). Thanks @iseem.
6
+
3
7
  #### 2.1.1
4
8
 
5
9
  - FIXED: Paths may mistakenly be generated use \ on windows.
@@ -1,6 +1,6 @@
1
- Copyright (c) 2010-2015 Aetrion LLC
1
+ The MIT License (MIT)
2
2
 
3
- MIT License
3
+ Copyright (c) 2010-2016 Aetrion LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -9,14 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
9
  copies of the Software, and to permit persons to whom the Software is
10
10
  furnished to do so, subject to the following conditions:
11
11
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
14
 
15
15
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
16
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
17
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
22
-
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -2,8 +2,8 @@
2
2
 
3
3
  A Ruby client for the [DNSimple API](https://developer.dnsimple.com/).
4
4
 
5
- [![Build Status](https://travis-ci.org/aetrion/dnsimple-ruby.svg?branch=master)](https://travis-ci.org/aetrion/dnsimple-ruby)
6
- [![Coverage Status](https://img.shields.io/coveralls/aetrion/dnsimple-ruby.svg)](https://coveralls.io/r/aetrion/dnsimple-ruby?branch=master)
5
+ [![Build Status](https://travis-ci.org/aetrion/dnsimple-ruby.svg?branch=master-v1)](https://travis-ci.org/aetrion/dnsimple-ruby)
6
+ [![Coverage Status](https://img.shields.io/coveralls/aetrion/dnsimple-ruby.svg)](https://coveralls.io/r/aetrion/dnsimple-ruby?branch=master-v1)
7
7
 
8
8
  [DNSimple](https://dnsimple.com/) provides DNS hosting and domain registration that is simple and friendly.
9
9
  We provide a full API and an easy-to-use web interface so you can get your domain registered and set up with a minimal amount of effort.
@@ -99,7 +99,20 @@ client.users.user
99
99
  # => Dnsimple::Struct::User
100
100
  ```
101
101
 
102
+ #### Domain API Token
103
+
104
+ The domain API token grants [limited access]](https://developer.dnsimple.com/v1/authentication/#domain-token) to a single domain.
105
+
106
+ ```ruby
107
+ client = Dnsimple::Client.new(domain_api_token: 'DOMAIN_TOKEN')
108
+
109
+ client.domains.records("example.com")
110
+ # => [Dnsimple::Struct::Record, Dnsimple::Struct::Record, ...]
111
+
112
+ client.domains.records("foobar.com")
113
+ # => Authentication error
114
+ ```
102
115
 
103
116
  ## License
104
117
 
105
- Copyright (c) 2010-2015 Aetrion LLC. This is Free Software distributed under the MIT license.
118
+ Copyright (c) 2010-2016 Aetrion LLC. This is Free Software distributed under the MIT license.
File without changes
data/dnsimple.gemspec CHANGED
@@ -16,7 +16,6 @@ Gem::Specification.new do |s|
16
16
  s.require_paths = ['lib']
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.extra_rdoc_files = %w( README.markdown CHANGELOG.markdown LICENSE )
20
19
 
21
20
  s.add_dependency 'httparty'
22
21
 
@@ -80,9 +80,11 @@ module Dnsimple
80
80
 
81
81
 
82
82
  require 'dnsimple/client/name_servers'
83
+ require 'dnsimple/client/vanity_name_servers'
83
84
 
84
85
  class NameServersService < ClientService
85
86
  include Client::NameServers
87
+ include Client::VanityNameServers
86
88
  end
87
89
 
88
90
 
@@ -0,0 +1,39 @@
1
+ module Dnsimple
2
+ class Client
3
+ module VanityNameServers
4
+
5
+ # Enable vanity name servers for a domain.
6
+ #
7
+ # @see https://developer.dnsimple.com/v1/nameservers/vanity-nameservers/#enable
8
+ #
9
+ # @param [#to_s] domain The domain id or domain name.
10
+ # @param [Hash] names A hash of up to 4 external name servers; hash keys
11
+ # are ns1 through ns4, e.g.
12
+ # {
13
+ # "ns1" => "ns1.example.com",
14
+ # "ns2" => "ns2.example.com"
15
+ # }
16
+ #
17
+ # @return [void]
18
+ # @raise [RequestError] When the request fails.
19
+ def enable_vanity_name_servers(domain, names, options={})
20
+ options["vanity_nameserver_configuration"] = {"server_source" => "external"}
21
+ options["vanity_nameserver_configuration"].merge!(names)
22
+ client.post(Client.versioned("domains/#{domain}/vanity_name_servers"), options)
23
+ end
24
+
25
+ # Disable vanity name servers for a domain.
26
+ #
27
+ # @see https://developer.dnsimple.com/v1/nameservers/vanity-nameservers/#disable
28
+ #
29
+ # @param [#to_s] domain The domain id or domain name.
30
+ #
31
+ # @return [void]
32
+ # @raise [RequestError] When the request fails.
33
+ def disable_vanity_name_servers(domain, options={})
34
+ client.delete("v1/domains/#{domain}/vanity_name_servers", options)
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -1,3 +1,3 @@
1
1
  module Dnsimple
2
- VERSION = "2.1.1"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe Dnsimple::Client, ".nameservers / vanity_name_servers" do
4
+ subject { described_class.new(api_endpoint: "https://api.zone", username: "user", api_token: "token").name_servers }
5
+
6
+ describe "#enable_vanity_name_servers" do
7
+ before do
8
+ stub_request(:post, %r[/v1/domains/.+/vanity_name_servers]).
9
+ to_return(read_fixture("nameservers/vanity_name_servers/enabled.http"))
10
+ end
11
+
12
+ it "builds the correct request" do
13
+ subject.enable_vanity_name_servers("example.com", { "ns1" => "ns1.example.com", "ns2" => "ns2.example.com" })
14
+
15
+ expect(WebMock).to have_requested(:post, "https://api.zone/v1/domains/example.com/vanity_name_servers").
16
+ with(body: { "vanity_nameserver_configuration" => { "server_source" => "external", "ns1" => "ns1.example.com", "ns2" => "ns2.example.com" } }).
17
+ with(headers: { 'Accept' => 'application/json' })
18
+ end
19
+
20
+ it "allows submission of extra options" do
21
+ subject.enable_vanity_name_servers("example.com", { "ns1" => "ns1.example.com", "ns2" => "ns2.example.com" }, {headers: { "X-FAKE-HEADER" => "Some value" }})
22
+
23
+ expect(WebMock).to have_requested(:post, "https://api.zone/v1/domains/example.com/vanity_name_servers").
24
+ with(body: { "vanity_nameserver_configuration" => { "server_source" => "external", "ns1" => "ns1.example.com", "ns2" => "ns2.example.com" } }).
25
+ with(headers: { 'Accept' => 'application/json', "X-FAKE-HEADER" => "Some value" })
26
+ end
27
+
28
+ it "returns nothing" do
29
+ result = subject.enable_vanity_name_servers("example.com", { ns1: "ns1.example.com", ns2: "ns2.example.com" })
30
+
31
+ expect(result).to be_truthy
32
+ end
33
+ end
34
+
35
+ describe "#disable_vanity_name_servers" do
36
+ before do
37
+ stub_request(:delete, %r[/v1/domains/.+/vanity_name_servers]).
38
+ to_return(read_fixture("nameservers/vanity_name_servers/disabled.http"))
39
+ end
40
+
41
+ it "builds the correct request" do
42
+ subject.disable_vanity_name_servers("example.com")
43
+
44
+ expect(WebMock).to have_requested(:delete, "https://api.zone/v1/domains/example.com/vanity_name_servers").
45
+ with(headers: { 'Accept' => 'application/json' })
46
+ end
47
+
48
+ it "allows submission of extra options" do
49
+ subject.disable_vanity_name_servers("example.com", {headers: { "X-FAKE-HEADER" => "Some value" }})
50
+
51
+ expect(WebMock).to have_requested(:delete, "https://api.zone/v1/domains/example.com/vanity_name_servers").
52
+ with(headers: { 'Accept' => 'application/json', "X-FAKE-HEADER" => "Some value" })
53
+ end
54
+
55
+ it "returns nothing" do
56
+ result = subject.disable_vanity_name_servers("example.com")
57
+
58
+ expect(result).to be_truthy
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,23 @@
1
+ HTTP/1.1 200 OK
2
+ Date: Thu, 10 Dec 2015 20:14:05 GMT
3
+ Status: 200 OK
4
+ Connection: close
5
+ Access-Control-Allow-Origin: *
6
+ Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with
7
+ Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
8
+ X-Frame-Options: SAMEORIGIN
9
+ X-XSS-Protection: 1
10
+ X-Content-Type-Options: nosniff
11
+ X-Download-Options: noopen
12
+ X-Permitted-Cross-Domain-Policies: none
13
+ Content-Type: application/json; charset=utf-8
14
+ Cache-Control: no-store, must-revalidate, private, max-age=0
15
+ X-Request-Id: 360532fd-7df5-4b9d-82d9-707495232709
16
+ X-Runtime: 0.351830
17
+ Set-Cookie: __profilin=p%3Dt; path=/
18
+ Set-Cookie: __profilin=p%3Dt; path=/
19
+ Set-Cookie: __profilin=p%3Dt; path=/
20
+ X-MiniProfiler-Ids: ["57flfc4miao2xtm0qi6t","3ob7yssth2tgz18xdhmh","lcx8amyy6mysu1rsv7d5","2qsm2f2xvqh224oqcnq9","qmhq7a2rqv5mtlz7e8bb"]
21
+ Transfer-Encoding: chunked
22
+
23
+ {"status":"disabled"}
@@ -0,0 +1,23 @@
1
+ HTTP/1.1 200 OK
2
+ Date: Thu, 10 Dec 2015 20:13:43 GMT
3
+ Status: 200 OK
4
+ Connection: close
5
+ Access-Control-Allow-Origin: *
6
+ Access-Control-Allow-Headers: Authorization,Accepts,Content-Type,X-DNSimple-Token,X-DNSimple-Domain-Token,X-CSRF-Token,x-requested-with
7
+ Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS
8
+ X-Frame-Options: SAMEORIGIN
9
+ X-XSS-Protection: 1
10
+ X-Content-Type-Options: nosniff
11
+ X-Download-Options: noopen
12
+ X-Permitted-Cross-Domain-Policies: none
13
+ Content-Type: application/json; charset=utf-8
14
+ Cache-Control: no-store, must-revalidate, private, max-age=0
15
+ X-Request-Id: 765d10fb-5e1d-456a-8bb8-653712cd07ae
16
+ X-Runtime: 0.386822
17
+ Set-Cookie: __profilin=p%3Dt; path=/
18
+ Set-Cookie: __profilin=p%3Dt; path=/
19
+ Set-Cookie: __profilin=p%3Dt; path=/
20
+ X-MiniProfiler-Ids: ["qmhq7a2rqv5mtlz7e8bb","3ob7yssth2tgz18xdhmh","lcx8amyy6mysu1rsv7d5","2qsm2f2xvqh224oqcnq9"]
21
+ Transfer-Encoding: chunked
22
+
23
+ {"status":"enabled"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsimple
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Eden
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-30 00:00:00.000000000 Z
12
+ date: 2016-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -87,22 +87,19 @@ email:
87
87
  - simone.carletti@dnsimple.com
88
88
  executables: []
89
89
  extensions: []
90
- extra_rdoc_files:
91
- - README.markdown
92
- - CHANGELOG.markdown
93
- - LICENSE
90
+ extra_rdoc_files: []
94
91
  files:
95
92
  - ".gitignore"
96
93
  - ".rspec"
97
94
  - ".ruby-gemset"
98
95
  - ".ruby-version"
99
96
  - ".travis.yml"
100
- - CHANGELOG.markdown
97
+ - CHANGELOG.md
101
98
  - Gemfile
102
- - LICENSE
103
- - README.markdown
99
+ - LICENSE.txt
100
+ - README.md
104
101
  - Rakefile
105
- - UPGRADING.markdown
102
+ - UPGRADING.md
106
103
  - dnsimple.gemspec
107
104
  - lib/dnsimple.rb
108
105
  - lib/dnsimple/client.rb
@@ -124,6 +121,7 @@ files:
124
121
  - lib/dnsimple/client/templates_domains.rb
125
122
  - lib/dnsimple/client/templates_records.rb
126
123
  - lib/dnsimple/client/users.rb
124
+ - lib/dnsimple/client/vanity_name_servers.rb
127
125
  - lib/dnsimple/compatibility.rb
128
126
  - lib/dnsimple/default.rb
129
127
  - lib/dnsimple/error.rb
@@ -161,6 +159,7 @@ files:
161
159
  - spec/dnsimple/client/templates_records_spec.rb
162
160
  - spec/dnsimple/client/templates_spec.rb
163
161
  - spec/dnsimple/client/users_spec.rb
162
+ - spec/dnsimple/client/vanity_name_servers_spec.rb
164
163
  - spec/dnsimple/client_spec.rb
165
164
  - spec/dnsimple/compatibility_spec.rb
166
165
  - spec/dnsimple/extra_spec.rb
@@ -215,6 +214,8 @@ files:
215
214
  - spec/files/nameservers/notfound-domain.http
216
215
  - spec/files/nameservers/register/badrequest-valueerror.http
217
216
  - spec/files/nameservers/register/success.http
217
+ - spec/files/nameservers/vanity_name_servers/disabled.http
218
+ - spec/files/nameservers/vanity_name_servers/enabled.http
218
219
  - spec/files/registrar/check/available.http
219
220
  - spec/files/registrar/check/registered.http
220
221
  - spec/files/registrar/extended_attributes/success.http
@@ -272,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
272
273
  version: '0'
273
274
  requirements: []
274
275
  rubyforge_project:
275
- rubygems_version: 2.4.7
276
+ rubygems_version: 2.2.5
276
277
  signing_key:
277
278
  specification_version: 4
278
279
  summary: The DNSimple API client for Ruby
@@ -294,6 +295,7 @@ test_files:
294
295
  - spec/dnsimple/client/templates_records_spec.rb
295
296
  - spec/dnsimple/client/templates_spec.rb
296
297
  - spec/dnsimple/client/users_spec.rb
298
+ - spec/dnsimple/client/vanity_name_servers_spec.rb
297
299
  - spec/dnsimple/client_spec.rb
298
300
  - spec/dnsimple/compatibility_spec.rb
299
301
  - spec/dnsimple/extra_spec.rb
@@ -348,6 +350,8 @@ test_files:
348
350
  - spec/files/nameservers/notfound-domain.http
349
351
  - spec/files/nameservers/register/badrequest-valueerror.http
350
352
  - spec/files/nameservers/register/success.http
353
+ - spec/files/nameservers/vanity_name_servers/disabled.http
354
+ - spec/files/nameservers/vanity_name_servers/enabled.http
351
355
  - spec/files/registrar/check/available.http
352
356
  - spec/files/registrar/check/registered.http
353
357
  - spec/files/registrar/extended_attributes/success.http