gds-api-adapters 7.12.0 → 7.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gds_api/need_api.rb +4 -2
- data/lib/gds_api/test_helpers/need_api.rb +9 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/need_api_test.rb +50 -0
- metadata +4 -4
data/lib/gds_api/need_api.rb
CHANGED
@@ -22,6 +22,15 @@ module GdsApi
|
|
22
22
|
stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
|
23
23
|
end
|
24
24
|
|
25
|
+
def need_api_has_needs_for_organisation(organisation, needs)
|
26
|
+
url = NEED_API_ENDPOINT + "/needs?organisation_id=#{organisation}"
|
27
|
+
|
28
|
+
body = response_base.merge(
|
29
|
+
"results" => needs
|
30
|
+
)
|
31
|
+
stub_request(:get, url).to_return(status: 200, body: body.to_json, headers: {})
|
32
|
+
end
|
33
|
+
|
25
34
|
def need_api_has_needs(needs)
|
26
35
|
url = NEED_API_ENDPOINT + "/needs"
|
27
36
|
|
data/lib/gds_api/version.rb
CHANGED
data/test/need_api_test.rb
CHANGED
@@ -79,6 +79,56 @@ describe GdsApi::NeedApi do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
+
describe "filtering needs by organisation" do
|
83
|
+
it "should return a subset of needs" do
|
84
|
+
req = need_api_has_needs_for_organisation("ministry-of-justice", [
|
85
|
+
{
|
86
|
+
"role" => "parent",
|
87
|
+
"goal" => "apply for a primary school place",
|
88
|
+
"benefit" => "my child can start school",
|
89
|
+
"organisation_ids" => ["ministry-of-justice"],
|
90
|
+
"organisations" => [
|
91
|
+
{
|
92
|
+
"id" => "ministry-of-justice",
|
93
|
+
"name" => "Ministry of Justice",
|
94
|
+
}
|
95
|
+
],
|
96
|
+
"justifications" => [
|
97
|
+
"it's something only government does",
|
98
|
+
"the government is legally obliged to provide it"
|
99
|
+
],
|
100
|
+
"impact" => "Has serious consequences for the day-to-day lives of your users",
|
101
|
+
"met_when" => [
|
102
|
+
"The user applies for a school place"
|
103
|
+
]
|
104
|
+
},
|
105
|
+
{
|
106
|
+
"role" => "user",
|
107
|
+
"goal" => "find out about becoming a British citizen",
|
108
|
+
"benefit" => "i can take the correct steps to apply for citizenship",
|
109
|
+
"organisation_ids" => ["ministry-of-justice"],
|
110
|
+
"organisations" => [
|
111
|
+
{
|
112
|
+
"id" => "ministry-of-justice",
|
113
|
+
"name" => "Ministry of Justice",
|
114
|
+
}
|
115
|
+
],
|
116
|
+
"justifications" => [
|
117
|
+
"it's something only government does",
|
118
|
+
"the government is legally obliged to provide it"
|
119
|
+
],
|
120
|
+
"impact" => "Has serious consequences for the day-to-day lives of your users",
|
121
|
+
"met_when" => [
|
122
|
+
"The user finds information about the citizenship test and the next steps"
|
123
|
+
]
|
124
|
+
}
|
125
|
+
])
|
126
|
+
|
127
|
+
@api.needs(organisation_id: "ministry-of-justice")
|
128
|
+
assert_requested(req)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
82
132
|
describe "viewing organisations" do
|
83
133
|
it "should return a list of organisations" do
|
84
134
|
request_stub = need_api_has_organisations(
|
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: 7.
|
4
|
+
version: 7.13.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: plek
|
@@ -338,7 +338,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
338
338
|
version: '0'
|
339
339
|
segments:
|
340
340
|
- 0
|
341
|
-
hash: -
|
341
|
+
hash: -3882474794805816869
|
342
342
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
343
343
|
none: false
|
344
344
|
requirements:
|
@@ -347,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
347
347
|
version: '0'
|
348
348
|
segments:
|
349
349
|
- 0
|
350
|
-
hash: -
|
350
|
+
hash: -3882474794805816869
|
351
351
|
requirements: []
|
352
352
|
rubyforge_project:
|
353
353
|
rubygems_version: 1.8.23
|