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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 14cea6f36c1e38e0abcddbf7d173847e6981e22c98381b45ffeba213a982e45c
|
|
4
|
+
data.tar.gz: 84363cb367d0b5a275f54f8413ce8ce38b463d213de1bd21b4ba4cb672266597
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
@@ -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.
|
|
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.
|
|
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: []
|