gds-api-adapters 0.0.6 → 0.0.7

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/README.md CHANGED
@@ -10,9 +10,25 @@ Example usage:
10
10
 
11
11
  Very much still a work in progress.
12
12
 
13
+ ## Logging
14
+
15
+ Each HTTP request is logged as JSON. Example:
16
+
17
+ {
18
+ "request_uri":"http://contactotron.platform/contacts/1",
19
+ "start_time":"2011-12-10 21:18:33 +0000",
20
+ "status":"success",
21
+ "end_time":"2011-12-10 21:18:33 +0000"
22
+ }
23
+
24
+ By default it is logged to STDOUT using the ruby logger. To override that set GdsApi::Base.logger
25
+
26
+ GdsApi::Base.logger = Logger.new("/path/to/file.log")
27
+
13
28
  ## Test Helpers
14
29
 
15
- There's also a test helper for stubbing panopticon requests in other apps. Example usage:
30
+ There are also test helpers for stubbing various requests in other apps. Example usage of
31
+ the panopticon helper:
16
32
 
17
33
  In test_helper.rb:
18
34
 
@@ -26,4 +42,8 @@ In the test:
26
42
 
27
43
  panopticon_has_metadata('id' => 12345, 'need_id' => need.id, 'slug' => 'my_slug')
28
44
 
29
- This presumes you have webmock installed and enabled.
45
+ This presumes you have webmock installed and enabled.
46
+
47
+ ## To Do
48
+
49
+ * Make timeout handling work
@@ -1,9 +1,18 @@
1
1
  require_relative 'json_utils'
2
2
  require 'cgi'
3
+ require 'logger'
3
4
 
4
5
  class GdsApi::Base
5
6
  include GdsApi::JsonUtils
6
7
 
8
+ class <<self
9
+ attr_writer :logger
10
+ end
11
+
12
+ def self.logger
13
+ @logger ||= Logger.new(STDOUT)
14
+ end
15
+
7
16
  def initialize(platform, endpoint_url=nil)
8
17
  adapter_name = self.class.to_s.split("::").last.downcase
9
18
 
@@ -1,6 +1,5 @@
1
1
  class OpenStruct
2
-
3
- def to_json
4
- table.to_json
5
- end
6
- end
2
+ def to_json
3
+ table.to_json
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ module GdsApi
2
+ class EndpointNotFound < StandardError
3
+ end
4
+ end
@@ -3,34 +3,54 @@ require 'net/http'
3
3
  require 'ostruct'
4
4
  require_relative 'core-ext/openstruct'
5
5
  require_relative 'version'
6
+ require_relative 'exceptions'
6
7
 
7
8
  module GdsApi::JsonUtils
8
- USER_AGENT = "GDS Api Client v. #{GdsApi::VERSION}"
9
+ REQUEST_HEADERS = {
10
+ 'Accept' => 'application/json',
11
+ 'Content-Type' => 'application/json',
12
+ 'User-Agent' => "GDS Api Client v. #{GdsApi::VERSION}"
13
+ }
14
+ TIMEOUT_IN_SECONDS = 0.5
15
+
16
+ def do_request(url, &block)
17
+ loggable = {request_uri: url, start_time: Time.now}
9
18
 
10
- def get_json(url)
11
19
  url = URI.parse(url)
12
20
  request = url.path
13
21
  request = request + "?" + url.query if url.query
14
22
 
15
23
  response = Net::HTTP.start(url.host, url.port) do |http|
16
- http.get(request, {'Accept' => 'application/json', 'User-Agent' => USER_AGENT})
24
+ http.read_timeout = TIMEOUT_IN_SECONDS
25
+ yield http, request
17
26
  end
18
- if response.code.to_i != 200
19
- return nil
27
+
28
+ if response.is_a?(Net::HTTPSuccess)
29
+ GdsApi::Base.logger.info loggable.merge(status: 'success', end_time: Time.now).to_json
30
+ JSON.parse(response.body)
20
31
  else
21
- return JSON.parse(response.body)
32
+ loggable.merge!(status: '404', end_time: Time.now)
33
+ GdsApi::Base.logger.info loggable.to_json
34
+ nil
35
+ end
36
+ rescue Errno::ECONNREFUSED
37
+ GdsApi::Base.logger.info loggable.merge(status: 'refused', end_time: Time.now).to_json
38
+ raise GdsApi::EndpointNotFound.new("Could not connect to #{url}")
39
+ rescue Timeout::Error, Errno::ECONNRESET
40
+ GdsApi::Base.logger.info loggable.merge(status: 'failed', end_time: Time.now).to_json
41
+ nil
42
+ end
43
+
44
+ def get_json(url)
45
+ do_request(url) do |http, path|
46
+ http.get(path, REQUEST_HEADERS)
22
47
  end
23
48
  end
24
49
 
25
50
  def post_json(url, params)
26
- url = URI.parse(url)
27
- Net::HTTP.start(url.host, url.port) do |http|
28
- post_response = http.post(url.path, params.to_json, {'Content-Type' => 'application/json', 'User-Agent' => USER_AGENT})
29
- if post_response.code == '200'
30
- return JSON.parse(post_response.body)
31
- end
51
+ do_request(url) do |http, path|
52
+ http.post(path, params.to_json, REQUEST_HEADERS)
32
53
  end
33
- return nil
34
54
  end
35
55
 
36
56
  def to_ostruct(object)
@@ -21,8 +21,8 @@ class GdsApi::Publisher < GdsApi::Base
21
21
  end
22
22
  end
23
23
 
24
- def council_for_transaction(transaction,snac_codes)
25
- if json = post_json("#{@endpoint}/local_transactions/#{transaction.slug}/verify_snac.json",{'snac_codes' => snac_codes})
24
+ def council_for_transaction(transaction_slug, snac_codes)
25
+ if json = post_json("#{@endpoint}/local_transactions/#{transaction_slug}/verify_snac.json", {'snac_codes' => snac_codes})
26
26
  json['snac']
27
27
  else
28
28
  nil
@@ -0,0 +1,12 @@
1
+ module GdsApi
2
+ module TestHelpers
3
+ module Contactotron
4
+
5
+ def contactotron_has_contact(uri, details)
6
+ json = JSON.dump(details)
7
+ stub_request(:get, uri).to_return(:status => 200, :body => json, :headers => {})
8
+ return uri
9
+ end
10
+ end
11
+ end
12
+ end
@@ -1,12 +1,27 @@
1
1
  module GdsApi
2
2
  module TestHelpers
3
3
  module Panopticon
4
+ PANOPTICON_ENDPOINT = 'http://panopticon.test.alphagov.co.uk'
5
+
6
+ def stringify_hash_keys(input_hash)
7
+ input_hash.inject({}) do |options, (key, value)|
8
+ options[key.to_s] = value
9
+ options
10
+ end
11
+ end
12
+
4
13
  def panopticon_has_metadata(metadata)
14
+ metadata = stringify_hash_keys(metadata)
15
+
5
16
  json = JSON.dump(metadata)
6
- url = "http://panopticon.test.alphagov.co.uk/artefacts/#{metadata['id']}.json"
7
- stub_request(:get, url).
8
- to_return(:status => 200, :body => json, :headers => {})
9
- return url
17
+
18
+ urls = []
19
+ urls << "#{PANOPTICON_ENDPOINT}/artefacts/#{metadata['id']}.json" if metadata['id']
20
+ urls << "#{PANOPTICON_ENDPOINT}/artefacts/#{metadata['slug']}.json" if metadata['slug']
21
+
22
+ urls.each { |url| stub_request(:get, url).to_return(:status => 200, :body => json, :headers => {}) }
23
+
24
+ return urls.first
10
25
  end
11
26
  end
12
27
  end
@@ -0,0 +1,14 @@
1
+ module GdsApi
2
+ module TestHelpers
3
+ module Publisher
4
+ PUBLISHER_ENDPOINT = "http://publisher.test.alphagov.co.uk"
5
+
6
+ def publication_exists(details)
7
+ json = JSON.dump(details)
8
+ uri = "#{PUBLISHER_ENDPOINT}/publications/#{details['slug']}.json"
9
+ stub_request(:get, uri).to_return(:body => json, :status => 200)
10
+ return uri
11
+ end
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
@@ -1,15 +1,17 @@
1
1
  require 'test_helper'
2
2
  require 'gds_api/contactotron'
3
+ require 'gds_api/test_helpers/contactotron'
3
4
 
4
5
  class ContactotronApiTest < MiniTest::Unit::TestCase
6
+ include GdsApi::TestHelpers::Contactotron
7
+
5
8
  def api
6
9
  GdsApi::Contactotron.new
7
10
  end
8
11
 
9
12
  def test_should_fetch_and_parse_JSON_into_ostruct
10
- uri = "http://contactotron.platform/contacts/1"
11
- stub_request(:get, uri).
12
- to_return(:status => 200, :body => '{"detail":"value"}')
13
+ uri = "http://contactotron.platform/contacts/1"
14
+ contactotron_has_contact(uri, {details: 'value'})
13
15
  assert_equal OpenStruct, api.contact_for_uri(uri).class
14
16
  end
15
17
  end
@@ -0,0 +1,44 @@
1
+ class JsonUtilsTest < MiniTest::Unit::TestCase
2
+ include GdsApi::JsonUtils
3
+
4
+ def test_get_returns_nil_on_timeout
5
+ url = "http://some.endpoint/some.json"
6
+ stub_request(:get, url).to_raise(Timeout::Error)
7
+ assert_nil get_json(url)
8
+ end
9
+
10
+ def test_get_should_raise_endpoint_not_found_if_connection_refused
11
+ url = "http://some.endpoint/some.json"
12
+ stub_request(:get, url).to_raise(Errno::ECONNREFUSED)
13
+ assert_raises GdsApi::EndpointNotFound do
14
+ get_json(url)
15
+ end
16
+ end
17
+
18
+ def test_post_should_raise_endpoint_not_found_if_connection_refused
19
+ url = "http://some.endpoint/some.json"
20
+ stub_request(:get, url).to_raise(Errno::ECONNREFUSED)
21
+ assert_raises GdsApi::EndpointNotFound do
22
+ get_json(url)
23
+ end
24
+ end
25
+
26
+ def test_post_returns_nil_on_timeout
27
+ url = "http://some.endpoint/some.json"
28
+ stub_request(:post, url).to_raise(Timeout::Error)
29
+ assert_nil post_json(url, {})
30
+ end
31
+
32
+ def test_should_fetch_and_parse_json_into_hash
33
+ url = "http://some.endpoint/some.json"
34
+ stub_request(:get, url).to_return(:body => "{}",:status => 200)
35
+ assert_equal Hash, get_json(url).class
36
+ end
37
+
38
+ def test_should_return_nil_if_404_returned_from_endpoint
39
+ url = "http://some.endpoint/some.json"
40
+ stub_request(:get, url).to_return(:body => "{}", :status => 404)
41
+ assert_nil get_json(url)
42
+ end
43
+
44
+ end
@@ -1,66 +1,67 @@
1
1
  require 'test_helper'
2
2
  require 'gds_api/panopticon'
3
+ require 'gds_api/test_helpers/panopticon'
3
4
 
4
5
  class PanopticonApiTest < MiniTest::Unit::TestCase
5
- EXPECTED_ENDPOINT = 'http://panopticon.test.alphagov.co.uk'
6
+ include GdsApi::TestHelpers::Panopticon
7
+
8
+ def basic_artefact
9
+ {
10
+ name: 'An artefact',
11
+ slug: 'a-basic-artefact'
12
+ }
13
+ end
14
+
15
+ def artefact_with_contact
16
+ {
17
+ name: 'An artefact',
18
+ slug: 'an-artefact-with-contact',
19
+ contact: {
20
+ name: 'Department for Environment, Food and Rural Affairs (Defra)',
21
+ email_address: 'helpline@defra.gsi.gov.uk'
22
+ }
23
+ }
24
+ end
6
25
 
7
26
  def api
8
27
  GdsApi::Panopticon.new('test')
9
28
  end
10
29
 
11
30
  def test_given_a_slug__should_fetch_artefact_from_panopticon
12
- slug = 'an-artefact'
13
- artefact_json = { name: 'An artefact' }.to_json
14
- stub_request(:get, "#{EXPECTED_ENDPOINT}/artefacts/#{slug}.json").to_return(body: artefact_json)
15
-
16
- artefact = api.artefact_for_slug(slug)
31
+ panopticon_has_metadata(basic_artefact)
32
+
33
+ artefact = api.artefact_for_slug(basic_artefact[:slug])
17
34
  assert_equal 'An artefact', artefact.name
18
35
  end
19
-
36
+
20
37
  def test_given_a_slug_can_fetch_artefact_as_hash
21
- slug = 'an-artefact'
22
- artefact_json = { name: 'An artefact' }.to_json
23
- stub_request(:get, "#{EXPECTED_ENDPOINT}/artefacts/#{slug}.json").to_return(body: artefact_json)
24
-
25
- artefact = api.artefact_for_slug(slug, :as_hash => true)
38
+ panopticon_has_metadata(basic_artefact)
39
+ artefact = api.artefact_for_slug(basic_artefact[:slug], :as_hash => true)
26
40
  assert artefact.is_a?(Hash)
27
41
  end
28
-
42
+
29
43
  def should_fetch_and_parse_JSON_into_hash
30
- url = "#{EXPECTED_ENDPOINT}/some.json"
44
+ url = "#{PANOPTICON_ENDPOINT}/some.json"
31
45
  stub_request(:get, url).to_return(body: {}.to_json)
32
-
46
+
33
47
  assert_equal Hash, api.get_json(url).class
34
48
  end
35
-
36
- def test_should_return_nil_if_404_returned_from_EXPECTED_ENDPOINT
37
- url = "#{EXPECTED_ENDPOINT}/some.json"
49
+
50
+ def test_should_return_nil_if_404_returned_from_endpoint
51
+ url = "#{PANOPTICON_ENDPOINT}/some.json"
38
52
  stub_request(:get, url).to_return(status: Rack::Utils.status_code(:not_found))
39
-
53
+
40
54
  assert_nil api.get_json(url)
41
55
  end
42
-
56
+
43
57
  def test_should_construct_correct_url_for_a_slug
44
- assert_equal "#{EXPECTED_ENDPOINT}/artefacts/slug.json", api.url_for_slug('slug')
45
- end
46
-
47
- def artefact_with_contact_json
48
- {
49
- name: 'An artefact',
50
- slug: 'an-artefact',
51
- contact: {
52
- name: 'Department for Environment, Food and Rural Affairs (Defra)',
53
- email_address: 'helpline@defra.gsi.gov.uk'
54
- }
55
- }.to_json
58
+ assert_equal "#{PANOPTICON_ENDPOINT}/artefacts/slug.json", api.url_for_slug('slug')
56
59
  end
57
-
60
+
58
61
  def test_contacts_should_be_deserialised_into_whole_objects
59
- slug = 'an-artefact'
60
- artefact_json = artefact_with_contact_json
61
- stub_request(:get, "#{EXPECTED_ENDPOINT}/artefacts/#{slug}.json").to_return(body: artefact_json)
62
+ panopticon_has_metadata(artefact_with_contact)
62
63
 
63
- artefact = api.artefact_for_slug(slug)
64
+ artefact = api.artefact_for_slug(artefact_with_contact[:slug])
64
65
  assert_equal 'Department for Environment, Food and Rural Affairs (Defra)', artefact.contact.name
65
66
  assert_equal 'helpline@defra.gsi.gov.uk', artefact.contact.email_address
66
67
  end
@@ -1,28 +1,63 @@
1
1
  require 'test_helper'
2
2
  require 'gds_api/publisher'
3
+ require 'gds_api/test_helpers/publisher'
3
4
 
4
5
  class GdsApi::PublisherTest < MiniTest::Unit::TestCase
5
- EXPECTED_ENDPOINT = "http://publisher.test.alphagov.co.uk"
6
+ include GdsApi::TestHelpers::Publisher
7
+
8
+ def basic_answer
9
+ {
10
+ "audiences" => [""],
11
+ "slug" => "a-publication",
12
+ "tags" => "",
13
+ "updated_at" => "2011-07-28T11:53:03+00:00",
14
+ "type" => "answer",
15
+ "body" => "Something",
16
+ "title" => "A publication"
17
+ }
18
+ end
19
+
20
+ def publication_with_parts
21
+ {
22
+ "audiences" => [""],
23
+ "slug" => "a-publication",
24
+ "tags" => "",
25
+ "updated_at" => "2011-07-28T11:53:03+00:00",
26
+ "type" => "guide",
27
+ "body" => "Something",
28
+ "parts" => [
29
+ {
30
+ "body" => "You may be financially protected",
31
+ "number" => 1,
32
+ "slug" => "introduction",
33
+ "title" => "Introduction"
34
+ },
35
+ {
36
+ "body" => "All companies selling packag",
37
+ "number" => 2,
38
+ "slug" => "if-you-booked-a-package-holiday",
39
+ "title" => "If you booked a package holiday"
40
+ },
41
+ {
42
+ "body" => "##Know your rights when you b",
43
+ "number" => 3,
44
+ "slug" => "if-you-booked-your-trip-independently",
45
+ "title" => "If you booked your trip independently"
46
+ }
47
+ ],
48
+ "title" => "A publication"
49
+ }
50
+ end
6
51
 
7
52
  def api
8
53
  GdsApi::Publisher.new("test")
9
54
  end
10
55
 
11
- def test_given_a_slug__should_go_get_resource_from_publisher_app
12
- slug = "a-publication"
13
- publication = %@{"audiences":[""],
14
- "slug":"#{slug}",
15
- "tags":"",
16
- "updated_at":"2011-07-28T11:53:03+00:00",
17
- "type":"answer",
18
- "body":"Something",
19
- "title":"A publication"}@
20
- stub_request(:get, "#{EXPECTED_ENDPOINT}/publications/#{slug}.json").to_return(
21
- :body => publication,:status=>200)
22
-
23
- pub = api.publication_for_slug(slug)
56
+ def test_given_a_slug_should_go_get_resource_from_publisher_app
57
+ publication_exists(basic_answer)
58
+ pub = api.publication_for_slug(basic_answer['slug'])
24
59
 
25
- assert_equal "Something",pub.body
60
+ assert_equal "Something", pub.body
26
61
  end
27
62
 
28
63
  def test_should_optionally_accept_an_edition_id
@@ -34,89 +69,40 @@ class GdsApi::PublisherTest < MiniTest::Unit::TestCase
34
69
  "type":"answer",
35
70
  "body":"Something",
36
71
  "title":"A publication"}@
37
- stub_request(:get, "#{EXPECTED_ENDPOINT}/publications/#{slug}.json?edition=678").to_return(
72
+ stub_request(:get, "#{PUBLISHER_ENDPOINT}/publications/#{slug}.json?edition=678").to_return(
38
73
  :body => publication,:status=>200)
39
74
 
40
75
  pub = api.publication_for_slug(slug,{:edition => 678})
41
76
  end
42
77
 
43
- def test_should_fetch_and_parse_json_into_hash
44
- url = "#{EXPECTED_ENDPOINT}/some.json"
45
- stub_request(:get, url).to_return(
46
- :body => "{}",:status=>200)
47
- assert_equal Hash,api.get_json(url).class
48
- end
49
-
50
- def test_should_return_nil_if_404_returned_from_endpoint
51
- url = "#{EXPECTED_ENDPOINT}/some.json"
52
- stub_request(:get, url).to_return(
53
- :body => "{}",:status=>404)
54
- assert_nil api.get_json(url)
55
- end
56
-
57
78
  def test_should_construct_correct_url_for_a_slug
58
- assert_equal "#{EXPECTED_ENDPOINT}/publications/slug.json", api.url_for_slug("slug")
59
- end
60
-
61
- def publication_with_parts(slug)
62
- publication = %@{"audiences":[""],
63
- "slug":"#{slug}",
64
- "tags":"",
65
- "updated_at":"2011-07-28T11:53:03+00:00",
66
- "type":"guide",
67
- "body":"Something",
68
- "parts" : [
69
- {
70
- "body" : "You may be financially protected",
71
- "number" : 1,
72
- "slug" : "introduction",
73
- "title" : "Introduction"
74
- },
75
- {
76
- "body" : "All companies selling packag",
77
- "number" : 2,
78
- "slug" : "if-you-booked-a-package-holiday",
79
- "title" : "If you booked a package holiday"
80
- },
81
- {
82
- "body" : "##Know your rights when you b",
83
- "number" : 3,
84
- "slug" : "if-you-booked-your-trip-independently",
85
- "title" : "If you booked your trip independently"
86
- }],
87
- "title":"A publication"}@
88
-
79
+ assert_equal "#{PUBLISHER_ENDPOINT}/publications/slug.json", api.url_for_slug("slug")
89
80
  end
90
81
 
91
82
  def test_parts_should_be_deserialised_into_whole_objects
92
- slug = "a-publication"
93
- publication = publication_with_parts(slug)
94
- stub_request(:get, "#{EXPECTED_ENDPOINT}/publications/#{slug}.json").to_return(
95
- :body => publication,:status=>200)
96
-
97
- pub = api.publication_for_slug(slug)
83
+ publication_exists(publication_with_parts)
84
+ pub = api.publication_for_slug(publication_with_parts['slug'])
98
85
  assert_equal 3, pub.parts.size
99
86
  assert_equal "introduction", pub.parts.first.slug
100
87
  end
101
88
 
102
89
  def test_a_publication_with_parts_should_have_part_specific_methods
103
- slug = "a-publication"
104
- publication = publication_with_parts(slug)
105
- stub_request(:get, "#{EXPECTED_ENDPOINT}/publications/#{slug}.json").to_return(
106
- :body => publication,:status=>200)
107
-
108
- pub = api.publication_for_slug(slug)
90
+ publication_exists(publication_with_parts)
91
+ pub = api.publication_for_slug(publication_with_parts['slug'])
109
92
  assert_equal pub.part_index("introduction"),0
110
93
  end
111
94
 
112
95
  def test_updated_at_should_be_a_time_on_deserialisation
113
- slug = "a-publication"
114
- publication = publication_with_parts(slug)
115
- stub_request(:get, "#{EXPECTED_ENDPOINT}/publications/#{slug}.json").to_return(
116
- :body => publication,:status=>200)
117
-
118
- pub = api.publication_for_slug(slug)
96
+ publication_exists(publication_with_parts)
97
+ pub = api.publication_for_slug(publication_with_parts['slug'])
119
98
  assert_equal Time, pub.updated_at.class
120
99
  end
121
100
 
101
+ def test_should_be_able_to_retrieve_local_transaction_details
102
+ stub_request(:post, "http://publisher.test.alphagov.co.uk/local_transactions/fake-transaction/verify_snac.json").
103
+ with(:body => "{\"snac_codes\":[12345]}", :headers => GdsApi::JsonUtils::REQUEST_HEADERS).
104
+ to_return(:status => 200, :body => '{"snac": "12345"}', :headers => {})
105
+ assert_equal '12345', api.council_for_transaction('fake-transaction', [12345])
106
+ end
107
+
122
108
  end
@@ -2,6 +2,12 @@ require 'minitest/autorun'
2
2
  require 'webmock/minitest'
3
3
  require 'rack/utils'
4
4
  require 'simplecov'
5
+ require 'simplecov-rcov'
6
+
7
+ SimpleCov.start do
8
+ add_filter "/test/"
9
+ add_group "Test Helpers", "lib/gds_api/test_helpers"
10
+ formatter SimpleCov::Formatter::RcovFormatter
11
+ end
5
12
 
6
- SimpleCov.start
7
13
  WebMock.disable_net_connect!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-08 00:00:00.000000000Z
12
+ date: 2011-12-12 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plek
16
- requirement: &70184871869580 !ruby/object:Gem::Requirement
16
+ requirement: &70266639863640 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70184871869580
24
+ version_requirements: *70266639863640
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70184871863160 !ruby/object:Gem::Requirement
27
+ requirement: &70266639855540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70184871863160
35
+ version_requirements: *70266639855540
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: webmock
38
- requirement: &70184871862640 !ruby/object:Gem::Requirement
38
+ requirement: &70266639853460 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.7'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70184871862640
46
+ version_requirements: *70266639853460
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rack
49
- requirement: &70184871862180 !ruby/object:Gem::Requirement
49
+ requirement: &70266639852360 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70184871862180
57
+ version_requirements: *70266639852360
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &70184871861640 !ruby/object:Gem::Requirement
60
+ requirement: &70266639850240 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - =
@@ -65,7 +65,18 @@ dependencies:
65
65
  version: 0.4.2
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70184871861640
68
+ version_requirements: *70266639850240
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov-rcov
71
+ requirement: &70266639840080 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70266639840080
69
80
  description: A set of adapters providing easy access to the GDS gov.uk APIs
70
81
  email:
71
82
  - jystewart@gmail.com
@@ -76,18 +87,22 @@ files:
76
87
  - lib/gds_api/base.rb
77
88
  - lib/gds_api/contactotron.rb
78
89
  - lib/gds_api/core-ext/openstruct.rb
90
+ - lib/gds_api/exceptions.rb
79
91
  - lib/gds_api/imminence.rb
80
92
  - lib/gds_api/json_utils.rb
81
93
  - lib/gds_api/needotron.rb
82
94
  - lib/gds_api/panopticon.rb
83
95
  - lib/gds_api/part_methods.rb
84
96
  - lib/gds_api/publisher.rb
97
+ - lib/gds_api/test_helpers/contactotron.rb
85
98
  - lib/gds_api/test_helpers/panopticon.rb
99
+ - lib/gds_api/test_helpers/publisher.rb
86
100
  - lib/gds_api/version.rb
87
101
  - README.md
88
102
  - Rakefile
89
103
  - test/contactotron_api_test.rb
90
104
  - test/gds_api_base_test.rb
105
+ - test/json_utils_test.rb
91
106
  - test/panopticon_api_test.rb
92
107
  - test/publisher_api_test.rb
93
108
  - test/test_helper.rb
@@ -118,6 +133,7 @@ summary: Adapters to work with GDS APIs
118
133
  test_files:
119
134
  - test/contactotron_api_test.rb
120
135
  - test/gds_api_base_test.rb
136
+ - test/json_utils_test.rb
121
137
  - test/panopticon_api_test.rb
122
138
  - test/publisher_api_test.rb
123
139
  - test/test_helper.rb