gds-api-adapters 53.2.0 → 54.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/test_helpers/organisations.rb +13 -14
- data/lib/gds_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb06e96900e7260378d6eb0ce9164993bfe4979273494f4ef415c55897b7d0bd
|
4
|
+
data.tar.gz: f2d65f90b0f193705dd5d3d68550f29f19226b903b3c55da48736230732b5fc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f05d27784ba25acccd2a17234a2e7c99caa164920f1a42cb30d83a255a654f8d9d75defe0b1d0581b2621d2732cacd45d82112bc6f9840508c3ebaa07d646823
|
7
|
+
data.tar.gz: f773e4c3a7d296567a043dd7ca306d169b58788eb9f1ead5a6c036ff2b5ffee09a7e1fec0d3aecc29f5eee8b923b41e800d5a52e53e636f2bdacea425c29a1eb
|
@@ -8,8 +8,7 @@ module GdsApi
|
|
8
8
|
module Organisations
|
9
9
|
include GdsApi::TestHelpers::CommonResponses
|
10
10
|
|
11
|
-
|
12
|
-
PUBLIC_HOST = Plek.current.find('www')
|
11
|
+
WEBSITE_ROOT = Plek.new.website_root
|
13
12
|
|
14
13
|
def organisations_api_has_organisations(organisation_slugs)
|
15
14
|
bodies = organisation_slugs.map { |slug| organisation_for_slug(slug) }
|
@@ -41,9 +40,9 @@ module GdsApi
|
|
41
40
|
"page_size" => 20,
|
42
41
|
"start_index" => i * 20 + 1)
|
43
42
|
|
44
|
-
links = { self: "#{
|
45
|
-
links[:next] = "#{
|
46
|
-
links[:previous] = "#{
|
43
|
+
links = { self: "#{WEBSITE_ROOT}/api/organisations?page=#{i + 1}" }
|
44
|
+
links[:next] = "#{WEBSITE_ROOT}/api/organisations?page=#{i + 2}" if pages[i + 1]
|
45
|
+
links[:previous] = "#{WEBSITE_ROOT}/api/organisations?page=#{i}" unless i.zero?
|
47
46
|
page_details["_response_info"]["links"] = []
|
48
47
|
link_headers = []
|
49
48
|
links.each do |rel, href|
|
@@ -62,18 +61,18 @@ module GdsApi
|
|
62
61
|
|
63
62
|
if pages.empty?
|
64
63
|
# If there are no pages - and so no organisations specified - then stub /api/organisations.
|
65
|
-
stub_request(:get, "#{
|
64
|
+
stub_request(:get, "#{WEBSITE_ROOT}/api/organisations").to_return(status: 200, body: plural_response_base.to_json, headers: {})
|
66
65
|
end
|
67
66
|
end
|
68
67
|
|
69
68
|
def organisations_api_has_organisation(organisation_slug, details = nil)
|
70
69
|
details ||= organisation_for_slug(organisation_slug)
|
71
|
-
stub_request(:get, "#{
|
70
|
+
stub_request(:get, "#{WEBSITE_ROOT}/api/organisations/#{organisation_slug}").
|
72
71
|
to_return(status: 200, body: details.to_json)
|
73
72
|
end
|
74
73
|
|
75
74
|
def organisations_api_does_not_have_organisation(organisation_slug)
|
76
|
-
stub_request(:get, "#{
|
75
|
+
stub_request(:get, "#{WEBSITE_ROOT}/api/organisations/#{organisation_slug}").to_return(status: 404)
|
77
76
|
end
|
78
77
|
|
79
78
|
def organisation_for_slug(slug)
|
@@ -86,11 +85,11 @@ module GdsApi
|
|
86
85
|
# otherwise it will be set to 'Executive agency'
|
87
86
|
def organisation_details_for_slug(slug, content_id = SecureRandom.uuid)
|
88
87
|
{
|
89
|
-
"id" => "#{
|
88
|
+
"id" => "#{WEBSITE_ROOT}/api/organisations/#{slug}",
|
90
89
|
"title" => titleize_slug(slug, title_case: true),
|
91
90
|
"format" => (slug =~ /ministry/ ? "Ministerial department" : "Executive agency"),
|
92
91
|
"updated_at" => "2013-03-25T13:06:42+00:00",
|
93
|
-
"web_url" => "#{
|
92
|
+
"web_url" => "#{WEBSITE_ROOT}/government/organisations/#{slug}",
|
94
93
|
"details" => {
|
95
94
|
"slug" => slug,
|
96
95
|
"abbreviation" => acronymize_slug(slug),
|
@@ -103,14 +102,14 @@ module GdsApi
|
|
103
102
|
},
|
104
103
|
"parent_organisations" => [
|
105
104
|
{
|
106
|
-
"id" => "#{
|
107
|
-
"web_url" => "#{
|
105
|
+
"id" => "#{WEBSITE_ROOT}/api/organisations/#{slug}-parent-1",
|
106
|
+
"web_url" => "#{WEBSITE_ROOT}/government/organisations/#{slug}-parent-1"
|
108
107
|
},
|
109
108
|
],
|
110
109
|
"child_organisations" => [
|
111
110
|
{
|
112
|
-
"id" => "#{
|
113
|
-
"web_url" => "#{
|
111
|
+
"id" => "#{WEBSITE_ROOT}/api/organisations/#{slug}-child-1",
|
112
|
+
"web_url" => "#{WEBSITE_ROOT}/government/organisations/#{slug}-child-1"
|
114
113
|
},
|
115
114
|
],
|
116
115
|
}
|
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: 54.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|