publishing_platform_api_adapters 0.12.0 → 0.13.1

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
  SHA256:
3
- metadata.gz: 7d98513bb44934332a9fe5a7e64933d721d2978aae2244b3f482ce8940ee81fe
4
- data.tar.gz: 9472ad4033345b101e7e39291b7658f1d3c9d7abb9e436f99ad94411e4c6c651
3
+ metadata.gz: 14cea6f36c1e38e0abcddbf7d173847e6981e22c98381b45ffeba213a982e45c
4
+ data.tar.gz: 84363cb367d0b5a275f54f8413ce8ce38b463d213de1bd21b4ba4cb672266597
5
5
  SHA512:
6
- metadata.gz: c0eccb8a41e6b80059a13c772f9943b4a1989df6e36e4e47abfe71db925c8402758dea35db9ce35709b80de34ec29ef2ae30377a3ef2e5ecf080c4b9c36ed7d5
7
- data.tar.gz: 98294ca2cf9e577ccd4a3708268d584dbdb20385eb7b8c182a31bf8ee87da7b4f1c24eddb967ce1766da847d362ba258e1ac110aa41eceadab35a3c4361baea5
6
+ metadata.gz: 6388d75747f5ec861a932782994d259b8eaa80bb954d1575368f7ca4ea6c46a9d8bebeb2556c912996127eac32a762a1ac073e275cc070a13d51a83b7d90329e
7
+ data.tar.gz: 6e5a5a42b40950bf04dbc74038759c3837ce4b08e11f66108212513a76a338a13eb2119f573218c9a69e7098daada2b4aa9408cf5d429453bca6956f40a65ae9
@@ -0,0 +1,15 @@
1
+ require_relative "base"
2
+ require "rack/utils"
3
+
4
+ module PublishingPlatformApi
5
+ # @api documented
6
+ class Search < Base
7
+ # Perform a search.
8
+ #
9
+ # @param args [Hash] A valid search query. See search-api documentation for options.
10
+ def search(args, additional_headers = {})
11
+ request_url = "#{endpoint}/search.json?#{Rack::Utils.build_nested_query(args)}"
12
+ get_json(request_url, additional_headers)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,15 @@
1
+ module PublishingPlatformApi
2
+ module TestHelpers
3
+ module Search
4
+ SEARCH_ENDPOINT = PublishingPlatformLocation.find("search-api")
5
+
6
+ def stub_any_search
7
+ stub_request(:get, %r{#{SEARCH_ENDPOINT}/search.json})
8
+ end
9
+
10
+ def stub_any_search_to_return_no_results
11
+ stub_any_search.to_return(body: { results: [] }.to_json)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PublishingPlatformApi
4
- VERSION = "0.12.0"
4
+ VERSION = "0.13.1"
5
5
  end
@@ -6,6 +6,7 @@ require "publishing_platform_api/content_store"
6
6
  require "publishing_platform_api/publishing_api"
7
7
  require "publishing_platform_api/organisations"
8
8
  require "publishing_platform_api/router"
9
+ require "publishing_platform_api/search"
9
10
 
10
11
  # @api documented
11
12
  module PublishingPlatformApi
@@ -72,4 +73,14 @@ module PublishingPlatformApi
72
73
  { bearer_token: ENV["ROUTER_API_BEARER_TOKEN"] }.merge(options),
73
74
  )
74
75
  end
76
+
77
+ # Creates a PublishingPlatformApi::Search adapter to access via a search.* hostname
78
+ #
79
+ # @return [PublishingPlatformApi::Search]
80
+ def self.search(options = {})
81
+ PublishingPlatformApi::Search.new(
82
+ PublishingPlatformLocation.find("search-api"),
83
+ options,
84
+ )
85
+ end
75
86
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: publishing_platform_api_adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Publishing Platform
@@ -199,6 +199,7 @@ files:
199
199
  - lib/publishing_platform_api/railtie.rb
200
200
  - lib/publishing_platform_api/response.rb
201
201
  - lib/publishing_platform_api/router.rb
202
+ - lib/publishing_platform_api/search.rb
202
203
  - lib/publishing_platform_api/test_helpers/asset_manager.rb
203
204
  - lib/publishing_platform_api/test_helpers/common_responses.rb
204
205
  - lib/publishing_platform_api/test_helpers/content_item_helpers.rb
@@ -206,6 +207,7 @@ files:
206
207
  - lib/publishing_platform_api/test_helpers/organisations.rb
207
208
  - lib/publishing_platform_api/test_helpers/publishing_api.rb
208
209
  - lib/publishing_platform_api/test_helpers/router.rb
210
+ - lib/publishing_platform_api/test_helpers/search.rb
209
211
  - lib/publishing_platform_api/version.rb
210
212
  - lib/publishing_platform_api_adapters.rb
211
213
  licenses:
@@ -225,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
227
  - !ruby/object:Gem::Version
226
228
  version: '0'
227
229
  requirements: []
228
- rubygems_version: 4.0.2
230
+ rubygems_version: 4.0.6
229
231
  specification_version: 4
230
232
  summary: Adapters to work with Publishing Platform APIs
231
233
  test_files: []