gds-api-adapters 29.6.0 → 30.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
  SHA1:
3
- metadata.gz: 9740e0fbf18097b3bda609a31d95238d536d5f19
4
- data.tar.gz: f32388c9c90841aca6e94ac516cbddf429e2a92a
3
+ metadata.gz: 6ab8783155352f11f32c97275ef35508aa27d8d4
4
+ data.tar.gz: a15871cab7d6e04b6bac22c40d31085545ab3323
5
5
  SHA512:
6
- metadata.gz: 1dc950579af1a75714fa5b17133a64720b070bbe88867f23eb1b62de5bf447979c7c5042aa478b69bb5b657f2b752e3d1f0131dda67c1c35604cedd709a83ef3
7
- data.tar.gz: e1fc3c89d8bb44abb11b5b6f4bbd06e288983abf93cb416dc00b73ae39f456bf1ae82d57f8cc8a5be0fdf47fd20e69412a3a6a9d3e318f4f63e209be87311538
6
+ metadata.gz: 11c3b21520b1de0e6a0793304b237b8803e2a60866b6a12d13123160457b287e8320995c571b489f1f40344c899ea4ef7b5e9117223bf2c62fb881b92c108935
7
+ data.tar.gz: a9ba8f5bfca018a8b2861d3e58f3e752481f876725895863bec0d2d655e1ddd06289415bf5c55b11389fa942ac5fcc260e700a333a266705dac886fb7f874256
@@ -134,7 +134,7 @@ module GdsApi
134
134
  end
135
135
  end
136
136
 
137
- def publishing_api_has_fields_for_format(format, items, fields)
137
+ def publishing_api_has_fields_for_document(format, items, fields)
138
138
  body = Array(items).map { |item|
139
139
  item.with_indifferent_access.slice(*fields)
140
140
  }
@@ -143,9 +143,9 @@ module GdsApi
143
143
  "&fields%5B%5D=#{f}"
144
144
  }
145
145
 
146
- url = PUBLISHING_API_V2_ENDPOINT + "/content?content_format=#{format}#{query_params.join('')}"
146
+ url = PUBLISHING_API_V2_ENDPOINT + "/content?document_type=#{format}#{query_params.join('')}"
147
147
 
148
- stub_request(:get, url).to_return(:status => 200, :body => body.to_json, :headers => {})
148
+ stub_request(:get, url).to_return(:status => 200, :body => { results: body }.to_json, :headers => {})
149
149
  end
150
150
 
151
151
  def publishing_api_has_linkables(linkables, document_type:)
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '29.6.0'
2
+ VERSION = '30.0.0'
3
3
  end
@@ -918,10 +918,19 @@ describe GdsApi::PublishingApiV2 do
918
918
  )
919
919
  .will_respond_with(
920
920
  status: 200,
921
- body: [
922
- { title: 'Content Item A', base_path: '/a-base-path' },
923
- { title: 'Content Item B', base_path: '/another-base-path' },
924
- ]
921
+ body: {
922
+ total: 2,
923
+ pages: 1,
924
+ current_page: 1,
925
+ links: [{
926
+ href: "http://example.org/v2/content?content_format=topic&fields[]=title&fields[]=base_path&page=1",
927
+ rel: "self"
928
+ }],
929
+ results: [
930
+ { public_updated_at: Pact.like("2015-07-30T13:58:11.000Z"), title: 'Content Item A', base_path: '/a-base-path' },
931
+ { public_updated_at: Pact.like("2015-07-30T13:58:11.000Z"), title: 'Content Item B', base_path: '/another-base-path' },
932
+ ]
933
+ }
925
934
  )
926
935
 
927
936
  response = @api_client.get_content_items(
@@ -930,10 +939,15 @@ describe GdsApi::PublishingApiV2 do
930
939
  )
931
940
 
932
941
  assert_equal 200, response.code
942
+
933
943
  assert_equal [
934
- { 'title' => 'Content Item A', 'base_path' => '/a-base-path' },
935
- { 'title' => 'Content Item B', 'base_path' => '/another-base-path' },
944
+ ["total", 2],
945
+ ["pages", 1],
946
+ ["current_page", 1],
947
+ ["links", [{"href"=>"http://example.org/v2/content?content_format=topic&fields[]=title&fields[]=base_path&page=1", "rel"=>"self"}]],
948
+ ["results", [{"public_updated_at"=>"2015-07-30T13:58:11.000Z", "title"=>"Content Item A", "base_path"=>"/a-base-path"}, {"public_updated_at"=>"2015-07-30T13:58:11.000Z", "title"=>"Content Item B", "base_path"=>"/another-base-path"}]]
936
949
  ], response.to_a
950
+
937
951
  end
938
952
 
939
953
  it "returns the content items in english locale by default" do
@@ -950,9 +964,18 @@ describe GdsApi::PublishingApiV2 do
950
964
  )
951
965
  .will_respond_with(
952
966
  status: 200,
953
- body: [
954
- { content_id: @content_id, locale: "en" },
955
- ]
967
+ body: {
968
+ total: 1,
969
+ pages: 1,
970
+ current_page: 1,
971
+ links: [{
972
+ href: "http://example.org/v2/content?content_format=topic&fields[]=content_id&fields[]=locale&page=1",
973
+ rel: "self"
974
+ }],
975
+ results: [
976
+ { public_updated_at: Pact.like("2015-07-30T13:58:11.000Z"), content_id: @content_id, locale: "en" }
977
+ ]
978
+ }
956
979
  )
957
980
 
958
981
  response = @api_client.get_content_items(
@@ -961,8 +984,13 @@ describe GdsApi::PublishingApiV2 do
961
984
  )
962
985
 
963
986
  assert_equal 200, response.code
987
+
964
988
  assert_equal [
965
- { 'content_id' => @content_id, 'locale' => 'en' },
989
+ ["total", 1],
990
+ ["pages", 1],
991
+ ["current_page", 1],
992
+ ["links", [{"href"=>"http://example.org/v2/content?content_format=topic&fields[]=content_id&fields[]=locale&page=1", "rel"=>"self"}]],
993
+ ["results", [{"public_updated_at"=>"2015-07-30T13:58:11.000Z", "content_id"=>"bed722e6-db68-43e5-9079-063f623335a7", "locale"=>"en"}]]
966
994
  ], response.to_a
967
995
  end
968
996
 
@@ -980,9 +1008,18 @@ describe GdsApi::PublishingApiV2 do
980
1008
  )
981
1009
  .will_respond_with(
982
1010
  status: 200,
983
- body: [
984
- { content_id: @content_id, locale: "fr" },
985
- ]
1011
+ body: {
1012
+ total: 1,
1013
+ pages: 1,
1014
+ current_page: 1,
1015
+ links: [{
1016
+ href: "http://example.org/v2/content?content_format=topic&fields[]=content_id&fields[]=locale&locale=fr&page=1",
1017
+ rel: "self"
1018
+ }],
1019
+ results: [
1020
+ { public_updated_at: Pact.like("2015-07-30T13:58:11.000Z"), content_id: @content_id, locale: "fr" }
1021
+ ]
1022
+ }
986
1023
  )
987
1024
 
988
1025
  response = @api_client.get_content_items(
@@ -993,7 +1030,11 @@ describe GdsApi::PublishingApiV2 do
993
1030
 
994
1031
  assert_equal 200, response.code
995
1032
  assert_equal [
996
- { 'content_id' => @content_id, 'locale' => 'fr' },
1033
+ ["total", 1],
1034
+ ["pages", 1],
1035
+ ["current_page", 1],
1036
+ ["links", [{"href"=>"http://example.org/v2/content?content_format=topic&fields[]=content_id&fields[]=locale&locale=fr&page=1", "rel"=>"self"}]],
1037
+ ["results", [{"public_updated_at"=>"2015-07-30T13:58:11.000Z", "content_id"=>"bed722e6-db68-43e5-9079-063f623335a7", "locale"=>"fr"}]]
997
1038
  ], response.to_a
998
1039
  end
999
1040
 
@@ -1011,11 +1052,20 @@ describe GdsApi::PublishingApiV2 do
1011
1052
  )
1012
1053
  .will_respond_with(
1013
1054
  status: 200,
1014
- body: [
1015
- { content_id: @content_id, locale: "en" },
1016
- { content_id: @content_id, locale: "fr" },
1017
- { content_id: @content_id, locale: "ar" },
1018
- ]
1055
+ body: {
1056
+ total: 3,
1057
+ pages: 1,
1058
+ current_page: 1,
1059
+ links: [{
1060
+ href: "http://example.org/v2/content?content_format=topic&fields[]=content_id&fields[]=locale&locale=all&page=1",
1061
+ rel: "self"
1062
+ }],
1063
+ results: [
1064
+ { public_updated_at: Pact.like("2015-07-30T13:58:11.000Z"), content_id: @content_id, locale: "en" },
1065
+ { public_updated_at: Pact.like("2015-07-30T13:58:11.000Z"), content_id: @content_id, locale: "fr" },
1066
+ { public_updated_at: Pact.like("2015-07-30T13:58:11.000Z"), content_id: @content_id, locale: "ar" },
1067
+ ]
1068
+ }
1019
1069
  )
1020
1070
 
1021
1071
  response = @api_client.get_content_items(
@@ -1026,9 +1076,14 @@ describe GdsApi::PublishingApiV2 do
1026
1076
 
1027
1077
  assert_equal 200, response.code
1028
1078
  assert_equal [
1029
- { 'content_id' => @content_id, 'locale' => 'en' },
1030
- { 'content_id' => @content_id, 'locale' => 'fr' },
1031
- { 'content_id' => @content_id, 'locale' => 'ar' },
1079
+ ["total", 3],
1080
+ ["pages", 1], ["current_page", 1],
1081
+ ["links",
1082
+ [{"href"=>"http://example.org/v2/content?content_format=topic&fields[]=content_id&fields[]=locale&locale=all&page=1", "rel"=>"self"}]],
1083
+ ["results",
1084
+ [{"public_updated_at"=>"2015-07-30T13:58:11.000Z", "content_id"=>"bed722e6-db68-43e5-9079-063f623335a7", "locale"=>"en"},
1085
+ {"public_updated_at"=>"2015-07-30T13:58:11.000Z", "content_id"=>"bed722e6-db68-43e5-9079-063f623335a7", "locale"=>"fr"},
1086
+ {"public_updated_at"=>"2015-07-30T13:58:11.000Z", "content_id"=>"bed722e6-db68-43e5-9079-063f623335a7", "locale"=>"ar"}]]
1032
1087
  ], response.to_a
1033
1088
  end
1034
1089
 
@@ -1046,9 +1101,18 @@ describe GdsApi::PublishingApiV2 do
1046
1101
  )
1047
1102
  .will_respond_with(
1048
1103
  status: 200,
1049
- body: [
1050
- { content_id: @content_id, details: {foo: :bar} },
1051
- ]
1104
+ body: {
1105
+ total: 1,
1106
+ pages: 1,
1107
+ current_page: 1,
1108
+ links: [{
1109
+ href: "http://example.org/v2/content?content_format=topic&fields[]=content_id&fields[]=details&page=1",
1110
+ rel: "self"
1111
+ }],
1112
+ results: [
1113
+ { public_updated_at: Pact.like("2015-07-30T13:58:11.000Z"), content_id: @content_id, details: {foo: :bar} }
1114
+ ]
1115
+ }
1052
1116
  )
1053
1117
 
1054
1118
  response = @api_client.get_content_items(
@@ -1057,8 +1121,13 @@ describe GdsApi::PublishingApiV2 do
1057
1121
  )
1058
1122
 
1059
1123
  assert_equal 200, response.code
1124
+
1060
1125
  assert_equal [
1061
- { 'content_id' => @content_id, 'details' => {"foo"=>"bar"} },
1126
+ ["total", 1],
1127
+ ["pages", 1],
1128
+ ["current_page", 1],
1129
+ ["links", [{"href"=>"http://example.org/v2/content?content_format=topic&fields[]=content_id&fields[]=details&page=1", "rel"=>"self"}]],
1130
+ ["results", [{"public_updated_at"=>"2015-07-30T13:58:11.000Z", "content_id"=>"bed722e6-db68-43e5-9079-063f623335a7", "details"=>{"foo"=>"bar"}}]]
1062
1131
  ], response.to_a
1063
1132
  end
1064
1133
  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: 29.6.0
4
+ version: 30.0.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-03-14 00:00:00.000000000 Z
11
+ date: 2016-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: plek
@@ -460,54 +460,54 @@ signing_key:
460
460
  specification_version: 4
461
461
  summary: Adapters to work with GDS APIs
462
462
  test_files:
463
- - test/content_api_test.rb
464
- - test/json_client_test.rb
465
- - test/content_store_test.rb
466
- - test/publishing_api_test.rb
467
- - test/business_support_api_test.rb
468
- - test/middleware/govuk_header_sniffer_test.rb
469
- - test/whitehall_admin_api_test.rb
470
- - test/list_response_test.rb
471
- - test/maslow_test.rb
472
- - test/panopticon_registerer_test.rb
473
- - test/support_test.rb
474
- - test/asset_manager_test.rb
475
- - test/helpers_test.rb
476
- - test/licence_application_api_test.rb
477
- - test/test_helper.rb
478
- - test/publisher_api_test.rb
463
+ - test/support_api_test.rb
479
464
  - test/mapit_test.rb
480
- - test/rummager_helpers_test.rb
481
- - test/publishing_api_v2_test.rb
465
+ - test/publishing_api_test.rb
482
466
  - test/publishing_api_v2/lookup_test.rb
483
- - test/support_api_test.rb
484
- - test/organisations_api_test.rb
485
- - test/gds_api_base_test.rb
486
- - test/router_test.rb
467
+ - test/whitehall_admin_api_test.rb
468
+ - test/pp_data_in_test.rb
487
469
  - test/publishing_api/special_route_publisher_test.rb
488
- - test/external_link_tracker_test.rb
489
- - test/fact_cave_test.rb
490
470
  - test/need_api_test.rb
471
+ - test/publisher_api_test.rb
472
+ - test/rummager_helpers_test.rb
473
+ - test/support_test.rb
491
474
  - test/content_register_test.rb
475
+ - test/fact_cave_test.rb
476
+ - test/test_helpers/publishing_api_test.rb
477
+ - test/test_helpers/pact_helper.rb
478
+ - test/test_helpers/panopticon_test.rb
479
+ - test/test_helpers/email_alert_api_test.rb
480
+ - test/test_helpers/publishing_api_v2_test.rb
481
+ - test/licence_application_api_test.rb
482
+ - test/gov_uk_delivery_test.rb
483
+ - test/maslow_test.rb
484
+ - test/helpers_test.rb
485
+ - test/panopticon_registerer_test.rb
492
486
  - test/panopticon_test.rb
493
- - test/pp_data_in_test.rb
487
+ - test/middleware/govuk_header_sniffer_test.rb
488
+ - test/rummager_test.rb
489
+ - test/json_client_test.rb
490
+ - test/email_alert_api_test.rb
491
+ - test/content_api_test.rb
492
+ - test/response_test.rb
493
+ - test/organisations_api_test.rb
494
+ - test/imminence_api_test.rb
495
+ - test/content_store_test.rb
496
+ - test/asset_manager_test.rb
494
497
  - test/fixtures/hello.txt
495
498
  - test/fixtures/new_policies_for_dwp.json
499
+ - test/fixtures/world_organisations_australia.json
496
500
  - test/fixtures/no_services_and_info_data_found_fixture.json
497
- - test/fixtures/services_and_info_fixture.json
498
501
  - test/fixtures/old_policies_for_dwp.json
499
- - test/fixtures/world_organisations_australia.json
502
+ - test/fixtures/services_and_info_fixture.json
500
503
  - test/fixtures/sub_sector_organisations.json
501
504
  - test/fixtures/finder_api/cma-case-schema.json
505
+ - test/router_test.rb
506
+ - test/list_response_test.rb
507
+ - test/external_link_tracker_test.rb
508
+ - test/gds_api_base_test.rb
502
509
  - test/worldwide_api_test.rb
503
- - test/test_helpers/publishing_api_test.rb
504
- - test/test_helpers/publishing_api_v2_test.rb
505
- - test/test_helpers/pact_helper.rb
506
- - test/test_helpers/panopticon_test.rb
507
- - test/test_helpers/email_alert_api_test.rb
508
- - test/gov_uk_delivery_test.rb
509
- - test/imminence_api_test.rb
510
- - test/email_alert_api_test.rb
511
- - test/response_test.rb
512
- - test/rummager_test.rb
510
+ - test/test_helper.rb
511
+ - test/publishing_api_v2_test.rb
512
+ - test/business_support_api_test.rb
513
513
  has_rdoc: