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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28fdb9aa5f03109f651caa65a00eefcbf488473ae40a0a5ca671a4bb49506c0b
4
- data.tar.gz: daf953f3e6f81eb98c61198cd25611378f0ee86f95bc82980b1f442637c2bf30
3
+ metadata.gz: eb06e96900e7260378d6eb0ce9164993bfe4979273494f4ef415c55897b7d0bd
4
+ data.tar.gz: f2d65f90b0f193705dd5d3d68550f29f19226b903b3c55da48736230732b5fc4
5
5
  SHA512:
6
- metadata.gz: e3dcc1d0b4e5cc2f37d0dc70b179a5523add55295a3713fe4214417f416c494ddb99c439dc329af764be9af3f00185e0126ae6770a48f5b126950703e58f2daf
7
- data.tar.gz: fd4c5bbdff4794567c2aadf420e1e7f30eb2e22a583570d911968fe7678525b7bbd6e8545a8d99fef8b305262db47dc5185ca16321a128290ca486203937ed59
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
- ORGANISATIONS_API_ENDPOINT = Plek.current.find('whitehall-admin')
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: "#{ORGANISATIONS_API_ENDPOINT}/api/organisations?page=#{i + 1}" }
45
- links[:next] = "#{ORGANISATIONS_API_ENDPOINT}/api/organisations?page=#{i + 2}" if pages[i + 1]
46
- links[:previous] = "#{ORGANISATIONS_API_ENDPOINT}/api/organisations?page=#{i}" unless i == 0
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, "#{ORGANISATIONS_API_ENDPOINT}/api/organisations").to_return(status: 200, body: plural_response_base.to_json, headers: {})
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, "#{ORGANISATIONS_API_ENDPOINT}/api/organisations/#{organisation_slug}").
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, "#{ORGANISATIONS_API_ENDPOINT}/api/organisations/#{organisation_slug}").to_return(status: 404)
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" => "#{ORGANISATIONS_API_ENDPOINT}/api/organisations/#{slug}",
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" => "#{PUBLIC_HOST}/government/organisations/#{slug}",
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" => "#{ORGANISATIONS_API_ENDPOINT}/api/organisations/#{slug}-parent-1",
107
- "web_url" => "#{PUBLIC_HOST}/government/organisations/#{slug}-parent-1"
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" => "#{ORGANISATIONS_API_ENDPOINT}/api/organisations/#{slug}-child-1",
113
- "web_url" => "#{PUBLIC_HOST}/government/organisations/#{slug}-child-1"
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
  }
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '53.2.0'.freeze
2
+ VERSION = '54.0.0'.freeze
3
3
  end
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: 53.2.0
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-25 00:00:00.000000000 Z
11
+ date: 2018-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable