gds-api-adapters 47.9.1 → 48.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gds_api/helpers.rb +0 -5
- data/lib/gds_api/support.rb +4 -0
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -3
- data/lib/gds_api/test_helpers/need_api.rb +0 -90
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3fef7af19662563a6043ef90158471079b7deca
|
4
|
+
data.tar.gz: 9872c16f885853d14249d733c6c59fac73338bb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c03fee24ac79191be81310a96f6f8a8e6b50a4b1314ef036162a0464e85c719205da48298cd4823df600070303a4072d75b64c26de7e923285aaf3c533c7ef6
|
7
|
+
data.tar.gz: 355939f04694c309530da78106255e81f31b638e8c7fa45aded79bd9edae46e9781e60155437bfeccb5817bacd6c0afbbeeef69f790104d3006cd9a42c0b900f
|
data/lib/gds_api/helpers.rb
CHANGED
@@ -2,7 +2,6 @@ require 'gds_api/asset_manager'
|
|
2
2
|
require 'gds_api/content_store'
|
3
3
|
require 'gds_api/imminence'
|
4
4
|
require 'gds_api/licence_application'
|
5
|
-
require 'gds_api/need_api'
|
6
5
|
require 'gds_api/worldwide'
|
7
6
|
require 'gds_api/email_alert_api'
|
8
7
|
|
@@ -24,10 +23,6 @@ module GdsApi
|
|
24
23
|
@licence_application_api ||= GdsApi::LicenceApplication.new(Plek.current.find("licensify"), options)
|
25
24
|
end
|
26
25
|
|
27
|
-
def need_api(options = {})
|
28
|
-
@need_api ||= GdsApi::NeedApi.new(Plek.current.find("needapi"), options)
|
29
|
-
end
|
30
|
-
|
31
26
|
def worldwide_api(options = {})
|
32
27
|
@worldwide_api ||= GdsApi::Worldwide.new(Plek.current.find("whitehall-admin"), options)
|
33
28
|
end
|
data/lib/gds_api/support.rb
CHANGED
data/lib/gds_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gds-api-adapters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 48.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Stewart
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|
@@ -402,7 +402,6 @@ files:
|
|
402
402
|
- lib/gds_api/test_helpers/link_checker_api.rb
|
403
403
|
- lib/gds_api/test_helpers/local_links_manager.rb
|
404
404
|
- lib/gds_api/test_helpers/mapit.rb
|
405
|
-
- lib/gds_api/test_helpers/need_api.rb
|
406
405
|
- lib/gds_api/test_helpers/organisations.rb
|
407
406
|
- lib/gds_api/test_helpers/performance_platform/data_in.rb
|
408
407
|
- lib/gds_api/test_helpers/performance_platform/data_out.rb
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'gds_api/test_helpers/json_client_helper'
|
2
|
-
require 'gds_api/test_helpers/common_responses'
|
3
|
-
|
4
|
-
module GdsApi
|
5
|
-
module TestHelpers
|
6
|
-
module NeedApi
|
7
|
-
include GdsApi::TestHelpers::CommonResponses
|
8
|
-
|
9
|
-
NEED_API_ENDPOINT = Plek.current.find('need-api')
|
10
|
-
|
11
|
-
def need_api_has_needs_for_organisation(organisation, needs)
|
12
|
-
url = NEED_API_ENDPOINT + "/needs?organisation_id=#{organisation}"
|
13
|
-
|
14
|
-
body = response_base.merge(
|
15
|
-
"results" => needs
|
16
|
-
)
|
17
|
-
stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
|
18
|
-
end
|
19
|
-
|
20
|
-
def need_api_has_needs_for_search(search_term, needs)
|
21
|
-
url = NEED_API_ENDPOINT + "/needs?q=#{search_term}"
|
22
|
-
|
23
|
-
body = response_base.merge(
|
24
|
-
"results" => needs
|
25
|
-
)
|
26
|
-
stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
|
27
|
-
end
|
28
|
-
|
29
|
-
def need_api_has_needs(needs)
|
30
|
-
url = NEED_API_ENDPOINT + "/needs"
|
31
|
-
|
32
|
-
body = response_base.merge(
|
33
|
-
"results" => needs
|
34
|
-
)
|
35
|
-
stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
|
36
|
-
end
|
37
|
-
|
38
|
-
def need_api_has_need_ids(needs)
|
39
|
-
ids = needs.map { |need| (need["id"] || need[:id]).to_i }.sort.join(',')
|
40
|
-
url = NEED_API_ENDPOINT + "/needs?ids=#{ids}"
|
41
|
-
|
42
|
-
body = response_base.merge(
|
43
|
-
"results" => needs
|
44
|
-
)
|
45
|
-
stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
|
46
|
-
end
|
47
|
-
|
48
|
-
def need_api_has_need(need)
|
49
|
-
need_id = need["id"] || need[:id]
|
50
|
-
raise ArgumentError, "Test need is missing an ID" unless need_id
|
51
|
-
|
52
|
-
url = NEED_API_ENDPOINT + "/needs/#{need_id}"
|
53
|
-
stub_request(:get, url).to_return(status: 200, body: need.to_json, headers: {})
|
54
|
-
end
|
55
|
-
|
56
|
-
def need_api_has_content_id_for_need(need)
|
57
|
-
need_id = need["id"] || need[:id]
|
58
|
-
|
59
|
-
url = NEED_API_ENDPOINT + "/needs/#{need_id}/content_id"
|
60
|
-
stub_request(:get, url).to_return(body: need[:content_id])
|
61
|
-
end
|
62
|
-
|
63
|
-
def need_api_has_raw_response_for_page(response, page = nil)
|
64
|
-
url = NEED_API_ENDPOINT + "/needs"
|
65
|
-
url << "?page=#{page}" unless page.nil?
|
66
|
-
|
67
|
-
stub_request(:get, url).to_return(status: 200, body: response, headers: {})
|
68
|
-
end
|
69
|
-
|
70
|
-
def need_api_has_no_need(need_id)
|
71
|
-
url = NEED_API_ENDPOINT + "/needs/#{need_id}"
|
72
|
-
not_found_body = {
|
73
|
-
"_response_info" => { "status" => "not_found" },
|
74
|
-
"error" => "No need exists with this ID"
|
75
|
-
}
|
76
|
-
stub_request(:get, url).to_return(
|
77
|
-
status: 404,
|
78
|
-
body: not_found_body.to_json,
|
79
|
-
headers: {}
|
80
|
-
)
|
81
|
-
end
|
82
|
-
|
83
|
-
def stub_create_note(note_details = nil)
|
84
|
-
post_stub = stub_request(:post, NEED_API_ENDPOINT + "/notes")
|
85
|
-
post_stub.with(body: note_details.to_json) unless note_details.nil?
|
86
|
-
post_stub.to_return(status: 201)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|