gds-api-adapters 39.2.0 → 40.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 514ed0bf0b20cf6fb1b1f83552a5fc849ffebde6
4
- data.tar.gz: 2cb109d81ceac22dd0b4c03d10076fc317365f04
3
+ metadata.gz: df001ff7888ac972186ea28ff977f854221a96d3
4
+ data.tar.gz: b6c8e1d290e996f937ee5a9f020177e4e054a772
5
5
  SHA512:
6
- metadata.gz: f34e133b44b931a0d371448e106546535811e6ad9983cda84e10505da269b7f648a7e8b19b815cf84a410a9aa86a57a697f28151da370733b2f32d8ea03b5a75
7
- data.tar.gz: 5697109b3530b175c6125af6acbf4fad1b60a9b6359c6e194053da6c85d393cf3f1a872e28c1eee4b2867ecbb854317e065a20ddde5a05672de8bcec6a9dcff2
6
+ metadata.gz: f7dc6090daf47c209578f786a9154707f9f8053814d596d64f37a1306474c418081914d3f749a13c562c8e0dab4f632bc937ca45460c3f7c372d17d5d0e4c694
7
+ data.tar.gz: f31e164bb4935e769c4b25a0d119f742d09cad99d2882a16f8af35749c120b00f900db103f8b93ee0d7c2af0e0a008ca070b6f88701e8f55366f45390e5a47f2
data/README.md CHANGED
@@ -79,33 +79,11 @@ downstream service can optionally use the identifier to perform authorisation
79
79
  on the request. This will be used by content-store as a mechanism to only
80
80
  return access-limited content to authenticated and authorised users.
81
81
 
82
- ## App-level Authentication
83
-
84
- The API Adapters currently support either HTTP Basic or OAuth2 (bearer token)
85
- authentication. This allows an application to identify itself to another where
86
- required. This is currently used by the `GdsApi::Panopticon::Registerer`
87
- adapter, which expects a constant called `PANOPTICON_API_CREDENTIALS` to be
88
- defined that identifies the calling application to Panopticon:
89
-
90
- PANOPTICON_API_CREDENTIALS = { bearer_token: 'MY_BEARER_TOKEN' }
91
-
92
82
  ## Test Helpers
93
83
 
94
84
  There are also test helpers for stubbing various requests in other apps.
95
- Example usage of the panopticon helper:
96
-
97
- In `test_helper.rb`:
98
-
99
- require 'gds_api/test_helpers/panopticon'
100
-
101
- class ActiveSupport::TestCase
102
- include GdsApi::TestHelpers::Panopticon
103
- end
104
-
105
- In the test:
106
85
 
107
- panopticon_has_metadata('id' => 12345, 'need_ids' => [need.id],
108
- 'slug' => 'my_slug')
86
+ See [all the test helpers in lib/gds_api/test_helpers](/lib/gds_api/test_helpers).
109
87
 
110
88
  ### Dependencies
111
89
 
@@ -5,7 +5,6 @@ require 'gds_api/content_store'
5
5
  require 'gds_api/imminence'
6
6
  require 'gds_api/licence_application'
7
7
  require 'gds_api/need_api'
8
- require 'gds_api/panopticon'
9
8
  require 'gds_api/worldwide'
10
9
  require 'gds_api/email_alert_api'
11
10
 
@@ -39,14 +38,6 @@ module GdsApi
39
38
  @need_api ||= GdsApi::NeedApi.new(Plek.current.find("needapi"), options)
40
39
  end
41
40
 
42
- def panopticon_api(options = {})
43
- @panopticon_api ||= GdsApi::Panopticon.new(Plek.current.find("panopticon"), panopticon_api_credentials.merge(options))
44
- end
45
-
46
- def panopticon_api_credentials
47
- Object::const_defined?(:PANOPTICON_API_CREDENTIALS) ? PANOPTICON_API_CREDENTIALS : {}
48
- end
49
-
50
41
  def worldwide_api(options = {})
51
42
  @worldwide_api ||= GdsApi::Worldwide.new(Plek.current.find("whitehall-admin"), options)
52
43
  end
@@ -57,7 +48,7 @@ module GdsApi
57
48
 
58
49
  def self.included(klass)
59
50
  if klass.respond_to?(:helper_method)
60
- klass.helper_method :panopticon_api, :imminence_api, :content_api, :licence_application_api
51
+ klass.helper_method :imminence_api, :content_api, :licence_application_api
61
52
  end
62
53
  end
63
54
  end
@@ -1,5 +1,5 @@
1
1
  class GdsApi::Maslow < GdsApi::Base
2
- def need_page_url(need_id)
3
- "#{endpoint}/needs/#{need_id}"
2
+ def need_page_url(content_id)
3
+ "#{endpoint}/needs/#{content_id}"
4
4
  end
5
5
  end
@@ -442,6 +442,7 @@ module GdsApi
442
442
  # }
443
443
  # }
444
444
  def publishing_api_has_expanded_links(links)
445
+ links = deep_transform_keys(links, &:to_sym)
445
446
  url = PUBLISHING_API_V2_ENDPOINT + "/expanded-links/" + links[:content_id]
446
447
  stub_request(:get, url).to_return(status: 200, body: links.to_json, headers: {})
447
448
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '39.2.0'.freeze
2
+ VERSION = '40.0.0'.freeze
3
3
  end
@@ -0,0 +1,103 @@
1
+ {
2
+ "slug": "cma-cases",
3
+ "name": "Competition and Markets Authority cases",
4
+ "document_noun": "case",
5
+ "facets": [
6
+ {
7
+ "key": "case_type",
8
+ "name": "Case type",
9
+ "type": "single-select",
10
+ "include_blank": "All case types",
11
+ "allowed_values": [
12
+ {"label": "CA98 and civil cartels", "value": "ca98-and-civil-cartels"},
13
+ {"label": "Consumer enforcement", "value": "consumer-enforcement"},
14
+ {"label": "Criminal cartels", "value": "criminal-cartels"},
15
+ {"label": "Markets", "value": "markets"},
16
+ {"label": "Mergers", "value": "mergers"},
17
+ {"label": "Regulatory references and appeals", "value": "regulatory-references-and-appeals"},
18
+ {"label": "Reviews of orders and undertakings", "value": "review-of-orders-and-undertakings"}
19
+ ]
20
+ },
21
+
22
+ {
23
+ "key": "case_state",
24
+ "name": "Case state",
25
+ "type": "single-select",
26
+ "include_blank": false,
27
+ "allowed_values": [
28
+ {"label": "Open", "value": "open"},
29
+ {"label": "Closed", "value": "closed"}
30
+ ]
31
+ },
32
+
33
+ {
34
+ "key": "market_sector",
35
+ "name": "Market sector",
36
+ "type": "single-select",
37
+ "include_blank": false,
38
+ "allowed_values": [
39
+ {"label": "Aerospace", "value": "aerospace"},
40
+ {"label": "Agriculture, environment and natural resources", "value": "agriculture-environment-and-natural-resources"},
41
+ {"label": "Building and construction", "value": "building-and-construction"},
42
+ {"label": "Chemicals", "value": "chemicals"},
43
+ {"label": "Clothing, footwear and fashion", "value": "clothing-footwear-and-fashion"},
44
+ {"label": "Communications", "value": "communications"},
45
+ {"label": "Defence", "value": "defence"},
46
+ {"label": "Distribution and Service Industries", "value": "distribution-and-service-industries"},
47
+ {"label": "Electronics Industry", "value": "electronics-industry"},
48
+ {"label": "Energy", "value": "energy"},
49
+ {"label": "Engineering", "value": "engineering"},
50
+ {"label": "Financial services", "value": "financial-services"},
51
+ {"label": "Fire, police, and security", "value": "fire-police-and-security"},
52
+ {"label": "Food manufacturing", "value": "food-manufacturing"},
53
+ {"label": "Giftware, jewellery and tableware", "value": "giftware-jewellery-and-tableware"},
54
+ {"label": "Healthcare and medical equipment", "value": "healthcare-and-medical-equipment"},
55
+ {"label": "Household goods, furniture and furnishings", "value": "household-goods-furniture-and-furnishings"},
56
+ {"label": "Mineral extraction, mining and quarrying", "value": "mineral-extraction-mining-and-quarrying"},
57
+ {"label": "Motor Industry", "value": "motor-industry"},
58
+ {"label": "Oil and Gas refining and Petrochemicals", "value": "oil-and-gas-refining-and-petrochemicals"},
59
+ {"label": "Paper printing and packaging", "value": "paper-printing-and-packaging"},
60
+ {"label": "Pharmaceuticals", "value": "pharmaceuticals"},
61
+ {"label": "Public markets", "value": "public-markets"},
62
+ {"label": "Recreation and Leisure", "value": "recreation-and-leisure"},
63
+ {"label": "Retail and wholesale", "value": "retail-and-wholesale"},
64
+ {"label": "Telecommunications", "value": "telecommunications"},
65
+ {"label": "Textiles", "value": "textiles"},
66
+ {"label": "Transport", "value": "transport"},
67
+ {"label": "Utilities", "value": "utilities"}
68
+ ]
69
+ },
70
+
71
+ {
72
+ "key": "outcome_type",
73
+ "name": "Outcome",
74
+ "type": "single-select",
75
+ "include_blank": false,
76
+ "allowed_values": [
77
+ {"label": "CA98 - administrative priorities", "value": "ca98-administrative-priorities"},
78
+ {"label": "CA98 - commitment", "value": "ca98-commitment"},
79
+ {"label": "CA98 - infringement Chapter I", "value": "ca98-infringement-chapter-i"},
80
+ {"label": "CA98 - infringement Chapter II", "value": "ca98-infringement-chapter-ii"},
81
+ {"label": "CA98 - no grounds for action/non-infringement", "value": "ca98-no-grounds-for-action-non-infringement"},
82
+ {"label": "Consumer enforcement - court order", "value": "consumer-enforcement-court-order"},
83
+ {"label": "Consumer enforcement - no action", "value": "consumer-enforcement-no-action"},
84
+ {"label": "Consumer enforcement - undertakings", "value": "consumer-enforcement-undertakings"},
85
+ {"label": "Criminal cartels - verdict", "value": "criminal-cartels-verdict"},
86
+ {"label": "Markets - phase 1 no enforcement action", "value": "markets-phase-1-no-enforcement-action"},
87
+ {"label": "Markets - phase 1 referral", "value": "markets-phase-1-referral"},
88
+ {"label": "Markets - phase 1 undertakings in lieu of reference", "value": "markets-phase-1-undertakings-in-lieu-of-reference"},
89
+ {"label": "Markets - phase 2 adverse effect on competition leading to remedies", "value": "markets-phase-2-adverse-effect-on-competition-leading-to-remedies"},
90
+ {"label": "Markets - phase 2 clearance - no adverse effect on competition", "value": "markets-phase-2-clearance-no-adverse-effect-on-competition"},
91
+ {"label": "Markets - phase 2 decision to dispense with procedural obligations", "value": "markets-phase-2-decision-to-dispense-with-procedural-obligations"},
92
+ {"label": "Mergers - phase 1 clearance with undertakings in lieu", "value": "mergers-phase-1-clearance-with-undertakings-in-lieu"},
93
+ {"label": "Mergers - phase 1 clearance", "value": "mergers-phase-1-clearance"},
94
+ {"label": "Mergers - phase 1 found not to qualify", "value": "mergers-phase-1-found-not-to-qualify"},
95
+ {"label": "Mergers - phase 1 referral", "value": "mergers-phase-1-referral"},
96
+ {"label": "Mergers - phase 2 clearance with remedies", "value": "mergers-phase-2-clearance-with-remedies"},
97
+ {"label": "Mergers - phase 2 clearance", "value": "mergers-phase-2-clearance"},
98
+ {"label": "Mergers - phase 2 prohibition", "value": "mergers-phase-2-prohibition"},
99
+ {"label": "Regulatory references and appeals - final determination", "value": "regulatory-references-and-appeals-final-determination"}
100
+ ]
101
+ }
102
+ ]
103
+ }
@@ -0,0 +1 @@
1
+ Hello, world!
@@ -0,0 +1,298 @@
1
+ {
2
+ "results": [
3
+ {
4
+ "title": "Welfare reform",
5
+ "description": "The governments policy on welfare reform",
6
+ "link": "/government/policies/welfare-reform",
7
+ "slug": "welfare-reform",
8
+ "format": "policy",
9
+ "organisations": [
10
+ {
11
+ "slug": "department-for-work-pensions",
12
+ "link": "/government/organisations/department-for-work-pensions",
13
+ "title": "Department for Work and Pensions",
14
+ "acronym": "DWP",
15
+ "organisation_type": "Ministerial department",
16
+ "organisation_state": "live"
17
+ }
18
+ ],
19
+ "public_timestamp": "2015-04-23T09:31:18.369Z",
20
+ "index": "mainstream",
21
+ "es_score": null,
22
+ "_id": "/government/policies/welfare-reform",
23
+ "document_type": "policy"
24
+ },
25
+ {
26
+ "title": "State Pension simplification",
27
+ "description": "The governments policy on state pension simplification",
28
+ "link": "/government/policies/state-pension-simplification",
29
+ "slug": "state-pension-simplification",
30
+ "format": "policy",
31
+ "organisations": [
32
+ {
33
+ "slug": "department-for-work-pensions",
34
+ "link": "/government/organisations/department-for-work-pensions",
35
+ "title": "Department for Work and Pensions",
36
+ "acronym": "DWP",
37
+ "organisation_type": "Ministerial department",
38
+ "organisation_state": "live"
39
+ }
40
+ ],
41
+ "public_timestamp": "2015-04-23T09:31:16.374Z",
42
+ "index": "mainstream",
43
+ "es_score": null,
44
+ "_id": "/government/policies/state-pension-simplification",
45
+ "document_type": "policy"
46
+ },
47
+ {
48
+ "title": "State Pension age",
49
+ "description": "The governments policy on state pension age",
50
+ "link": "/government/policies/state-pension-age",
51
+ "slug": "state-pension-age",
52
+ "format": "policy",
53
+ "organisations": [
54
+ {
55
+ "slug": "department-for-work-pensions",
56
+ "link": "/government/organisations/department-for-work-pensions",
57
+ "title": "Department for Work and Pensions",
58
+ "acronym": "DWP",
59
+ "organisation_type": "Ministerial department",
60
+ "organisation_state": "live"
61
+ }
62
+ ],
63
+ "public_timestamp": "2015-04-23T09:31:16.279Z",
64
+ "index": "mainstream",
65
+ "es_score": null,
66
+ "_id": "/government/policies/state-pension-age",
67
+ "document_type": "policy"
68
+ },
69
+ {
70
+ "title": "Poverty and social justice",
71
+ "description": "The governments policy on poverty and social justice",
72
+ "link": "/government/policies/poverty-and-social-justice",
73
+ "slug": "poverty-and-social-justice",
74
+ "format": "policy",
75
+ "organisations": [
76
+ {
77
+ "slug": "department-for-work-pensions",
78
+ "link": "/government/organisations/department-for-work-pensions",
79
+ "title": "Department for Work and Pensions",
80
+ "acronym": "DWP",
81
+ "organisation_type": "Ministerial department",
82
+ "organisation_state": "live"
83
+ },
84
+ {
85
+ "slug": "department-for-education",
86
+ "link": "/government/organisations/department-for-education",
87
+ "title": "Department for Education",
88
+ "acronym": "DfE",
89
+ "organisation_type": "Ministerial department",
90
+ "organisation_state": "live"
91
+ }
92
+ ],
93
+ "public_timestamp": "2015-04-23T09:31:13.699Z",
94
+ "index": "mainstream",
95
+ "es_score": null,
96
+ "_id": "/government/policies/poverty-and-social-justice",
97
+ "document_type": "policy"
98
+ },
99
+ {
100
+ "title": "Older people",
101
+ "description": "The governments policy on older people",
102
+ "link": "/government/policies/older-people",
103
+ "slug": "older-people",
104
+ "format": "policy",
105
+ "organisations": [
106
+ {
107
+ "slug": "department-for-work-pensions",
108
+ "link": "/government/organisations/department-for-work-pensions",
109
+ "title": "Department for Work and Pensions",
110
+ "acronym": "DWP",
111
+ "organisation_type": "Ministerial department",
112
+ "organisation_state": "live"
113
+ }
114
+ ],
115
+ "public_timestamp": "2015-04-23T09:31:12.726Z",
116
+ "index": "mainstream",
117
+ "es_score": null,
118
+ "_id": "/government/policies/older-people",
119
+ "document_type": "policy"
120
+ },
121
+ {
122
+ "title": "Household energy",
123
+ "description": "The governments policy on household energy",
124
+ "link": "/government/policies/household-energy",
125
+ "slug": "household-energy",
126
+ "format": "policy",
127
+ "organisations": [
128
+ {
129
+ "slug": "ofgem",
130
+ "link": "/government/organisations/ofgem",
131
+ "title": "Ofgem",
132
+ "organisation_state": "exempt"
133
+ },
134
+ {
135
+ "slug": "department-for-work-pensions",
136
+ "link": "/government/organisations/department-for-work-pensions",
137
+ "title": "Department for Work and Pensions",
138
+ "acronym": "DWP",
139
+ "organisation_type": "Ministerial department",
140
+ "organisation_state": "live"
141
+ },
142
+ {
143
+ "slug": "department-for-communities-and-local-government",
144
+ "link": "/government/organisations/department-for-communities-and-local-government",
145
+ "title": "Department for Communities and Local Government",
146
+ "acronym": "DCLG",
147
+ "organisation_type": "Ministerial department",
148
+ "organisation_state": "live"
149
+ },
150
+ {
151
+ "slug": "department-of-energy-climate-change",
152
+ "link": "/government/organisations/department-of-energy-climate-change",
153
+ "title": "Department of Energy & Climate Change",
154
+ "acronym": "DECC",
155
+ "organisation_type": "Ministerial department",
156
+ "organisation_state": "live"
157
+ }
158
+ ],
159
+ "public_timestamp": "2015-04-23T09:31:09.099Z",
160
+ "index": "mainstream",
161
+ "es_score": null,
162
+ "_id": "/government/policies/household-energy",
163
+ "document_type": "policy"
164
+ },
165
+ {
166
+ "title": "Health and safety reform",
167
+ "description": "The governments policy on health and safety reform",
168
+ "link": "/government/policies/health-and-safety-reform",
169
+ "slug": "health-and-safety-reform",
170
+ "format": "policy",
171
+ "organisations": [
172
+ {
173
+ "slug": "department-for-work-pensions",
174
+ "link": "/government/organisations/department-for-work-pensions",
175
+ "title": "Department for Work and Pensions",
176
+ "acronym": "DWP",
177
+ "organisation_type": "Ministerial department",
178
+ "organisation_state": "live"
179
+ }
180
+ ],
181
+ "public_timestamp": "2015-04-23T09:31:08.391Z",
182
+ "index": "mainstream",
183
+ "es_score": null,
184
+ "_id": "/government/policies/health-and-safety-reform",
185
+ "document_type": "policy"
186
+ },
187
+ {
188
+ "title": "European funds",
189
+ "description": "The governments policy on european funds",
190
+ "link": "/government/policies/european-funds",
191
+ "slug": "european-funds",
192
+ "format": "policy",
193
+ "organisations": [
194
+ {
195
+ "slug": "department-for-work-pensions",
196
+ "link": "/government/organisations/department-for-work-pensions",
197
+ "title": "Department for Work and Pensions",
198
+ "acronym": "DWP",
199
+ "organisation_type": "Ministerial department",
200
+ "organisation_state": "live"
201
+ },
202
+ {
203
+ "slug": "department-for-communities-and-local-government",
204
+ "link": "/government/organisations/department-for-communities-and-local-government",
205
+ "title": "Department for Communities and Local Government",
206
+ "acronym": "DCLG",
207
+ "organisation_type": "Ministerial department",
208
+ "organisation_state": "live"
209
+ },
210
+ {
211
+ "slug": "department-for-environment-food-rural-affairs",
212
+ "link": "/government/organisations/department-for-environment-food-rural-affairs",
213
+ "title": "Department for Environment, Food & Rural Affairs",
214
+ "acronym": "Defra",
215
+ "organisation_type": "Ministerial department",
216
+ "organisation_state": "live"
217
+ },
218
+ {
219
+ "slug": "department-for-business-innovation-skills",
220
+ "link": "/government/organisations/department-for-business-innovation-skills",
221
+ "title": "Department for Business, Innovation & Skills",
222
+ "acronym": "BIS",
223
+ "organisation_type": "Ministerial department",
224
+ "organisation_state": "live"
225
+ },
226
+ {
227
+ "slug": "hm-treasury",
228
+ "link": "/government/organisations/hm-treasury",
229
+ "title": "HM Treasury",
230
+ "acronym": "HMT",
231
+ "organisation_type": "Ministerial department",
232
+ "organisation_state": "live"
233
+ }
234
+ ],
235
+ "public_timestamp": "2015-04-23T09:31:06.188Z",
236
+ "index": "mainstream",
237
+ "es_score": null,
238
+ "_id": "/government/policies/european-funds",
239
+ "document_type": "policy"
240
+ },
241
+ {
242
+ "title": "Employment",
243
+ "description": "The governments policy on employment",
244
+ "link": "/government/policies/employment",
245
+ "slug": "employment",
246
+ "format": "policy",
247
+ "organisations": [
248
+ {
249
+ "slug": "department-for-work-pensions",
250
+ "link": "/government/organisations/department-for-work-pensions",
251
+ "title": "Department for Work and Pensions",
252
+ "acronym": "DWP",
253
+ "organisation_type": "Ministerial department",
254
+ "organisation_state": "live"
255
+ },
256
+ {
257
+ "slug": "hm-treasury",
258
+ "link": "/government/organisations/hm-treasury",
259
+ "title": "HM Treasury",
260
+ "acronym": "HMT",
261
+ "organisation_type": "Ministerial department",
262
+ "organisation_state": "live"
263
+ }
264
+ ],
265
+ "public_timestamp": "2015-04-23T09:31:05.592Z",
266
+ "index": "mainstream",
267
+ "es_score": null,
268
+ "_id": "/government/policies/employment",
269
+ "document_type": "policy"
270
+ },
271
+ {
272
+ "title": "Child maintenance reform",
273
+ "description": "The governments policy on child maintenance reform",
274
+ "link": "/government/policies/child-maintenance-reform",
275
+ "slug": "child-maintenance-reform",
276
+ "format": "policy",
277
+ "organisations": [
278
+ {
279
+ "slug": "department-for-work-pensions",
280
+ "link": "/government/organisations/department-for-work-pensions",
281
+ "title": "Department for Work and Pensions",
282
+ "acronym": "DWP",
283
+ "organisation_type": "Ministerial department",
284
+ "organisation_state": "live"
285
+ }
286
+ ],
287
+ "public_timestamp": "2015-04-23T09:31:02.116Z",
288
+ "index": "mainstream",
289
+ "es_score": null,
290
+ "_id": "/government/policies/child-maintenance-reform",
291
+ "document_type": "policy"
292
+ }
293
+ ],
294
+ "total": 11,
295
+ "start": 0,
296
+ "facets": {},
297
+ "suggested_queries": []
298
+ }