gds-api-adapters 0.1.2 → 0.2.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.
data/lib/gds_api/exceptions.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
module GdsApi
|
2
|
-
class
|
2
|
+
class BaseError < StandardError
|
3
3
|
end
|
4
4
|
|
5
|
-
class
|
5
|
+
class EndpointNotFound < BaseError
|
6
6
|
end
|
7
7
|
|
8
|
-
class
|
8
|
+
class TimedOutException < BaseError
|
9
|
+
end
|
10
|
+
|
11
|
+
class HTTPErrorResponse < BaseError
|
9
12
|
attr_accessor :code
|
10
13
|
|
11
14
|
def initialize(code)
|
@@ -1,11 +1,12 @@
|
|
1
1
|
module GdsApi
|
2
2
|
class Panopticon < GdsApi::Base
|
3
3
|
class Registerer
|
4
|
-
attr_accessor :logger, :owning_app, :kind
|
4
|
+
attr_accessor :logger, :owning_app, :rendering_app, :kind
|
5
5
|
|
6
6
|
def initialize(options)
|
7
7
|
@logger = options[:logger] || GdsApi::Base.logger
|
8
8
|
@owning_app = options[:owning_app]
|
9
|
+
@rendering_app = options[:rendering_app]
|
9
10
|
@kind = options[:kind] || 'custom-application'
|
10
11
|
@panopticon = options[:panopticon]
|
11
12
|
@platform = options[:platform] || ENV['FACTER_govuk_platform'] || 'development'
|
@@ -20,6 +21,9 @@ module GdsApi
|
|
20
21
|
description: record.description,
|
21
22
|
live: record.live
|
22
23
|
}
|
24
|
+
if rendering_app
|
25
|
+
hash[:rendering_app] = rendering_app
|
26
|
+
end
|
23
27
|
[:need_id, :section, :indexable_content, :paths, :prefixes].each do |attr_name|
|
24
28
|
if record.respond_to? attr_name
|
25
29
|
hash[attr_name] = record.send(attr_name)
|
@@ -31,6 +31,13 @@ module GdsApi
|
|
31
31
|
stub_request(:get, url).to_return(:status => 404, :body => "", :headers => {})
|
32
32
|
end
|
33
33
|
|
34
|
+
def stub_panopticon_default_artefact
|
35
|
+
stub_request(:get, %r{\A#{PANOPTICON_ENDPOINT}/artefacts}).to_return { |request|
|
36
|
+
# return a response with only a slug, and set that slug to match the requested artefact slug
|
37
|
+
{:body => JSON.dump("slug" => request.uri.path.split('/').last.chomp('.json'))}
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
34
41
|
end
|
35
42
|
end
|
36
43
|
end
|
data/lib/gds_api/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.2.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- James Stewart
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-07-
|
13
|
+
date: 2012-07-12 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: plek
|
@@ -143,35 +143,35 @@ extensions: []
|
|
143
143
|
extra_rdoc_files: []
|
144
144
|
|
145
145
|
files:
|
146
|
-
- lib/gds_api/
|
147
|
-
- lib/gds_api/
|
148
|
-
- lib/gds_api/
|
149
|
-
- lib/gds_api/exceptions.rb
|
146
|
+
- lib/gds_api/version.rb
|
147
|
+
- lib/gds_api/publisher.rb
|
148
|
+
- lib/gds_api/panopticon/registerer.rb
|
150
149
|
- lib/gds_api/typhoeus_client.rb
|
151
150
|
- lib/gds_api/imminence.rb
|
152
|
-
- lib/gds_api/publisher.rb
|
153
151
|
- lib/gds_api/contactotron.rb
|
154
|
-
- lib/gds_api/panopticon.rb
|
155
|
-
- lib/gds_api/version.rb
|
156
|
-
- lib/gds_api/oauth2_client.rb
|
157
|
-
- lib/gds_api/test_helpers/imminence.rb
|
158
152
|
- lib/gds_api/test_helpers/publisher.rb
|
153
|
+
- lib/gds_api/test_helpers/imminence.rb
|
159
154
|
- lib/gds_api/test_helpers/contactotron.rb
|
160
155
|
- lib/gds_api/test_helpers/panopticon.rb
|
161
156
|
- lib/gds_api/test_helpers/json_client_helper.rb
|
162
|
-
- lib/gds_api/
|
163
|
-
- lib/gds_api/panopticon/registerer.rb
|
164
|
-
- lib/gds_api/needotron.rb
|
157
|
+
- lib/gds_api/base.rb
|
165
158
|
- lib/gds_api/json_client.rb
|
159
|
+
- lib/gds_api/response.rb
|
160
|
+
- lib/gds_api/panopticon.rb
|
166
161
|
- lib/gds_api/core-ext/openstruct.rb
|
162
|
+
- lib/gds_api/oauth2_client.rb
|
163
|
+
- lib/gds_api/part_methods.rb
|
164
|
+
- lib/gds_api/needotron.rb
|
165
|
+
- lib/gds_api/exceptions.rb
|
166
|
+
- lib/gds_api/helpers.rb
|
167
167
|
- README.md
|
168
168
|
- Rakefile
|
169
|
-
- test/
|
169
|
+
- test/contactotron_api_test.rb
|
170
|
+
- test/panopticon_api_test.rb
|
171
|
+
- test/publisher_api_test.rb
|
170
172
|
- test/json_client_test.rb
|
173
|
+
- test/gds_api_base_test.rb
|
171
174
|
- test/test_helper.rb
|
172
|
-
- test/publisher_api_test.rb
|
173
|
-
- test/panopticon_api_test.rb
|
174
|
-
- test/contactotron_api_test.rb
|
175
175
|
homepage: http://github.com/alphagov/gds-api-adapters
|
176
176
|
licenses: []
|
177
177
|
|
@@ -185,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
hash: -
|
188
|
+
hash: -3870041789509518781
|
189
189
|
segments:
|
190
190
|
- 0
|
191
191
|
version: "0"
|
@@ -194,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
194
|
requirements:
|
195
195
|
- - ">="
|
196
196
|
- !ruby/object:Gem::Version
|
197
|
-
hash: -
|
197
|
+
hash: -3870041789509518781
|
198
198
|
segments:
|
199
199
|
- 0
|
200
200
|
version: "0"
|
@@ -206,9 +206,9 @@ signing_key:
|
|
206
206
|
specification_version: 3
|
207
207
|
summary: Adapters to work with GDS APIs
|
208
208
|
test_files:
|
209
|
-
- test/
|
209
|
+
- test/contactotron_api_test.rb
|
210
|
+
- test/panopticon_api_test.rb
|
211
|
+
- test/publisher_api_test.rb
|
210
212
|
- test/json_client_test.rb
|
213
|
+
- test/gds_api_base_test.rb
|
211
214
|
- test/test_helper.rb
|
212
|
-
- test/publisher_api_test.rb
|
213
|
-
- test/panopticon_api_test.rb
|
214
|
-
- test/contactotron_api_test.rb
|