gds-api-adapters 29.0.0 → 29.1.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: 71362128a4913b6fa7588f899cb6ec02ce1b9f8f
4
- data.tar.gz: a401050ecf364fbc755e53d0abf0757e64ffbed7
3
+ metadata.gz: 7eba58aeeebf0ea1b6be0bffa08238c5a96ce163
4
+ data.tar.gz: b4f7113077a1275bab3cb7fa1ac988ee6c6590df
5
5
  SHA512:
6
- metadata.gz: a095ca287ef2049fa280105ffa09f4cd03397261a3c1b8e92e34db4603a00d16952339058fc8d82ef492bf22f3c855dfc170089de18965381e3530f3bb613a3f
7
- data.tar.gz: 8935835598a80361fbb7392b5f2b57bea283f463920a985e344f8418f846de6544218642216941115d1d61e97943f7b81dbde35c50473e08f75019e77ed32b70
6
+ metadata.gz: ed3922b6fb4140eb2d898c37a445d599abd07b27373d99f460c74729aa571a3c32101e7c28994439528b14988ba5b3a006bc9dfa65fcf12dd468f26d60f321c7
7
+ data.tar.gz: babd4186cd34303667edefc54919cceaab5dd750505228da12425ce2d83e3cbfd8228ca330998403f448f9cef591e6d92ae2d2d389568dc24464b92e5e119afd
@@ -78,6 +78,10 @@ class GdsApi::PublishingApiV2 < GdsApi::Base
78
78
  get_json("#{endpoint}/v2/content#{query}")
79
79
  end
80
80
 
81
+ def get_linkables(format:)
82
+ get_json("#{endpoint}/v2/linkables?format=#{format}")
83
+ end
84
+
81
85
  def get_linked_items(content_id, params = {})
82
86
  query = query_string(params)
83
87
  validate_content_id(content_id)
@@ -148,6 +148,11 @@ module GdsApi
148
148
  stub_request(:get, url).to_return(:status => 200, :body => body.to_json, :headers => {})
149
149
  end
150
150
 
151
+ def publishing_api_has_linkables(linkables, format:)
152
+ url = PUBLISHING_API_V2_ENDPOINT + "/linkables?format=#{format}"
153
+ stub_request(:get, url).to_return(:status => 200, :body => linkables.to_json, :headers => {})
154
+ end
155
+
151
156
  def publishing_api_has_item(item)
152
157
  item = item.with_indifferent_access
153
158
  url = PUBLISHING_API_V2_ENDPOINT + "/content/" + item[:content_id]
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '29.0.0'
2
+ VERSION = '29.1.0'
3
3
  end
@@ -855,6 +855,50 @@ describe GdsApi::PublishingApiV2 do
855
855
  end
856
856
  end
857
857
 
858
+ describe "#get_linkables" do
859
+ let(:linkables) {
860
+ [
861
+ {
862
+ "title" => "Content Item A",
863
+ "internal_name" => "an internal name",
864
+ "content_id" => "aaaaaaaa-aaaa-1aaa-aaaa-aaaaaaaaaaaa",
865
+ "publication_state" => "draft",
866
+ "base_path" => "/a-base-path",
867
+ },
868
+ {
869
+ "title" => "Content Item B",
870
+ "internal_name" => "Content Item B",
871
+ "content_id" => "bbbbbbbb-bbbb-2bbb-bbbb-bbbbbbbbbbbb",
872
+ "publication_state" => "live",
873
+ "base_path" => "/another-base-path",
874
+ },
875
+ ]
876
+ }
877
+
878
+ it "returns the content items of a given format" do
879
+ publishing_api
880
+ .given("there is content with format 'topic'")
881
+ .upon_receiving("a get linkables request")
882
+ .with(
883
+ method: :get,
884
+ path: "/v2/linkables",
885
+ query: "format=topic",
886
+ headers: {
887
+ "Content-Type" => "application/json",
888
+ },
889
+ )
890
+ .will_respond_with(
891
+ status: 200,
892
+ body: linkables,
893
+ )
894
+
895
+ response = @api_client.get_linkables(format: "topic")
896
+
897
+ assert_equal 200, response.code
898
+ assert_equal linkables, response.to_a
899
+ end
900
+ end
901
+
858
902
  describe "#get_content_items" do
859
903
  it "returns the content items of a certain format" do
860
904
  publishing_api
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: 29.0.0
4
+ version: 29.1.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: 2016-02-29 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek
@@ -458,51 +458,51 @@ signing_key:
458
458
  specification_version: 4
459
459
  summary: Adapters to work with GDS APIs
460
460
  test_files:
461
- - test/content_api_test.rb
462
- - test/json_client_test.rb
463
- - test/content_store_test.rb
461
+ - test/support_api_test.rb
462
+ - test/mapit_test.rb
464
463
  - test/publishing_api_test.rb
465
- - test/business_support_api_test.rb
466
- - test/middleware/govuk_header_sniffer_test.rb
467
464
  - test/whitehall_admin_api_test.rb
468
- - test/list_response_test.rb
469
- - test/maslow_test.rb
470
- - test/panopticon_registerer_test.rb
471
- - test/support_test.rb
472
- - test/asset_manager_test.rb
473
- - test/helpers_test.rb
474
- - test/licence_application_api_test.rb
475
- - test/test_helper.rb
476
- - test/publisher_api_test.rb
477
- - test/mapit_test.rb
478
- - test/rummager_helpers_test.rb
479
- - test/publishing_api_v2_test.rb
480
- - test/support_api_test.rb
481
- - test/organisations_api_test.rb
482
- - test/gds_api_base_test.rb
483
- - test/router_test.rb
465
+ - test/pp_data_in_test.rb
484
466
  - test/publishing_api/special_route_publisher_test.rb
485
- - test/external_link_tracker_test.rb
486
- - test/fact_cave_test.rb
487
467
  - test/need_api_test.rb
468
+ - test/publisher_api_test.rb
469
+ - test/rummager_helpers_test.rb
470
+ - test/support_test.rb
488
471
  - test/content_register_test.rb
472
+ - test/fact_cave_test.rb
473
+ - test/test_helpers/publishing_api_test.rb
474
+ - test/test_helpers/pact_helper.rb
475
+ - test/test_helpers/panopticon_test.rb
476
+ - test/test_helpers/email_alert_api_test.rb
477
+ - test/licence_application_api_test.rb
478
+ - test/gov_uk_delivery_test.rb
479
+ - test/maslow_test.rb
480
+ - test/helpers_test.rb
481
+ - test/panopticon_registerer_test.rb
489
482
  - test/panopticon_test.rb
490
- - test/pp_data_in_test.rb
483
+ - test/middleware/govuk_header_sniffer_test.rb
484
+ - test/rummager_test.rb
485
+ - test/json_client_test.rb
486
+ - test/email_alert_api_test.rb
487
+ - test/content_api_test.rb
488
+ - test/response_test.rb
489
+ - test/organisations_api_test.rb
490
+ - test/imminence_api_test.rb
491
+ - test/content_store_test.rb
492
+ - test/asset_manager_test.rb
491
493
  - test/fixtures/hello.txt
492
494
  - test/fixtures/new_policies_for_dwp.json
495
+ - test/fixtures/world_organisations_australia.json
493
496
  - test/fixtures/no_services_and_info_data_found_fixture.json
494
- - test/fixtures/services_and_info_fixture.json
495
497
  - test/fixtures/old_policies_for_dwp.json
496
- - test/fixtures/world_organisations_australia.json
498
+ - test/fixtures/services_and_info_fixture.json
497
499
  - test/fixtures/sub_sector_organisations.json
498
500
  - test/fixtures/finder_api/cma-case-schema.json
501
+ - test/router_test.rb
502
+ - test/list_response_test.rb
503
+ - test/external_link_tracker_test.rb
504
+ - test/gds_api_base_test.rb
499
505
  - test/worldwide_api_test.rb
500
- - test/test_helpers/publishing_api_test.rb
501
- - test/test_helpers/pact_helper.rb
502
- - test/test_helpers/panopticon_test.rb
503
- - test/test_helpers/email_alert_api_test.rb
504
- - test/gov_uk_delivery_test.rb
505
- - test/imminence_api_test.rb
506
- - test/email_alert_api_test.rb
507
- - test/response_test.rb
508
- - test/rummager_test.rb
506
+ - test/test_helper.rb
507
+ - test/publishing_api_v2_test.rb
508
+ - test/business_support_api_test.rb