govuk-client-url_arbiter 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 889a793a1b2d742a900e9864ea51cf5aab540d46
4
+ data.tar.gz: 5e463712d9519c5056a964ec2b9a6f2694d76584
5
+ SHA512:
6
+ metadata.gz: aabfcf63389b58f8a17618c8d68d644b4517e0b5a7f890b1c722e06a36b78d125602e59da4dbe837f31e535085d941fa37902b4777d937c240ae859bd33e3fb7
7
+ data.tar.gz: ad5e228534ab04020837eae3e24dbab648f4faa854983fe02812e254478e9db7eaad408799a738f2ffac5c9d570d6c6f64d00f4dfa2d89ed14e21446f03b86e1
@@ -1 +1 @@
1
- 1.9.3
1
+ 2.1
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014 HM Government (Government Digital Service)
1
+ Copyright (c) 2014 Crown Copyright (Government Digital Service)
2
2
 
3
3
  MIT License
4
4
 
@@ -34,6 +34,8 @@ module GOVUK
34
34
 
35
35
  class Timeout < BaseError; end
36
36
 
37
+ class InvalidPath < BaseError; end
38
+
37
39
  class HTTPError < BaseError
38
40
  # @api private
39
41
  def initialize(restclient_exception)
@@ -22,6 +22,7 @@ module GOVUK
22
22
  #
23
23
  # @param path [String] the path to fetch
24
24
  # @return [Response, nil] Details of the reserved path, or +nil+ if the path wasn't found.
25
+ # @raise [Errors::InvalidPath] when called with an invalid path.
25
26
  def path(path)
26
27
  check_path(path)
27
28
  get_json("/paths#{path}")
@@ -34,6 +35,7 @@ module GOVUK
34
35
  # @return [Response] Details of the reserved path.
35
36
  # @raise [Errors::Conflict] if the path is already reserved by another app.
36
37
  # @raise [Errors::UnprocessableEntity] for any validation errors.
38
+ # @raise [Errors::InvalidPath] when called with an invalid path.
37
39
  def reserve_path(path, details)
38
40
  check_path(path)
39
41
  put_json!("/paths#{path}", details)
@@ -43,7 +45,7 @@ module GOVUK
43
45
 
44
46
  def check_path(path)
45
47
  unless path && path.start_with?("/")
46
- raise ArgumentError, "Path must start with a '/'"
48
+ raise Errors::InvalidPath, "Path must start with a '/'"
47
49
  end
48
50
  end
49
51
 
@@ -1,7 +1,7 @@
1
1
  module GOVUK
2
2
  module Client
3
3
  class URLArbiter
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
  end
6
6
  end
7
7
  end
@@ -22,19 +22,19 @@ describe GOVUK::Client::URLArbiter do
22
22
  it "should raise an error if the path is nil" do
23
23
  expect {
24
24
  response = client.path(nil)
25
- }.to raise_error(ArgumentError)
25
+ }.to raise_error(GOVUK::Client::Errors::InvalidPath)
26
26
  end
27
27
 
28
28
  it "should raise an error if the path is empty" do
29
29
  expect {
30
30
  response = client.path("")
31
- }.to raise_error(ArgumentError)
31
+ }.to raise_error(GOVUK::Client::Errors::InvalidPath)
32
32
  end
33
33
 
34
34
  it "should raise an error if the path doesn't start with a slash" do
35
35
  expect {
36
36
  response = client.path("bacon")
37
- }.to raise_error(ArgumentError)
37
+ }.to raise_error(GOVUK::Client::Errors::InvalidPath)
38
38
  end
39
39
 
40
40
  it "should return nil on 404" do
@@ -88,19 +88,19 @@ describe GOVUK::Client::URLArbiter do
88
88
  it "should raise an error if the path is nil" do
89
89
  expect {
90
90
  response = client.reserve_path(nil, {})
91
- }.to raise_error(ArgumentError)
91
+ }.to raise_error(GOVUK::Client::Errors::InvalidPath)
92
92
  end
93
93
 
94
94
  it "should raise an error if the path is empty" do
95
95
  expect {
96
96
  response = client.reserve_path("", {})
97
- }.to raise_error(ArgumentError)
97
+ }.to raise_error(GOVUK::Client::Errors::InvalidPath)
98
98
  end
99
99
 
100
100
  it "should raise an error if the path doesn't start with a slash" do
101
101
  expect {
102
102
  response = client.reserve_path("bacon", {})
103
- }.to raise_error(ArgumentError)
103
+ }.to raise_error(GOVUK::Client::Errors::InvalidPath)
104
104
  end
105
105
 
106
106
  it "should raise a conflict error if the path is already reserved" do
metadata CHANGED
@@ -1,126 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-client-url_arbiter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alex Tomlins
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-09-04 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rest-client
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.6'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.6'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: multi_json
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
33
  version: '1.0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
40
  version: '1.0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: plek
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
47
  version: '1.8'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
54
  version: '1.8'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rake
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: gem_publisher
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
75
  version: '1.4'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
82
  version: '1.4'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rspec
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ~>
87
+ - - "~>"
100
88
  - !ruby/object:Gem::Version
101
89
  version: '3.0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ~>
94
+ - - "~>"
108
95
  - !ruby/object:Gem::Version
109
96
  version: '3.0'
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: webmock
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
- - - ~>
101
+ - - "~>"
116
102
  - !ruby/object:Gem::Version
117
103
  version: 1.18.0
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
- - - ~>
108
+ - - "~>"
124
109
  - !ruby/object:Gem::Version
125
110
  version: 1.18.0
126
111
  description:
@@ -130,9 +115,9 @@ executables: []
130
115
  extensions: []
131
116
  extra_rdoc_files: []
132
117
  files:
133
- - .gitignore
134
- - .rspec
135
- - .ruby-version
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".ruby-version"
136
121
  - Gemfile
137
122
  - LICENSE.txt
138
123
  - README.md
@@ -150,33 +135,26 @@ files:
150
135
  homepage: https://github.com/alphagov/govuk-client-url_arbiter
151
136
  licenses:
152
137
  - MIT
138
+ metadata: {}
153
139
  post_install_message:
154
140
  rdoc_options: []
155
141
  require_paths:
156
142
  - lib
157
143
  required_ruby_version: !ruby/object:Gem::Requirement
158
- none: false
159
144
  requirements:
160
- - - ! '>='
145
+ - - ">="
161
146
  - !ruby/object:Gem::Version
162
147
  version: '0'
163
- segments:
164
- - 0
165
- hash: 3700616753026108825
166
148
  required_rubygems_version: !ruby/object:Gem::Requirement
167
- none: false
168
149
  requirements:
169
- - - ! '>='
150
+ - - ">="
170
151
  - !ruby/object:Gem::Version
171
152
  version: '0'
172
- segments:
173
- - 0
174
- hash: 3700616753026108825
175
153
  requirements: []
176
154
  rubyforge_project:
177
- rubygems_version: 1.8.23.2
155
+ rubygems_version: 2.2.5
178
156
  signing_key:
179
- specification_version: 3
157
+ specification_version: 4
180
158
  summary: API client for the url-arbiter
181
159
  test_files:
182
160
  - spec/spec_helper.rb