gds-api-adapters 26.6.0 → 26.7.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 +4 -4
- data/lib/gds_api/rummager.rb +27 -0
- data/lib/gds_api/version.rb +1 -1
- data/test/rummager_test.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3d2ca1a419c3c02ca167c8621c8b440d213e76e
|
4
|
+
data.tar.gz: 8a708d6d4dc5ac48ca24ad01b488944a72b748cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a3f65b48e7112783b34c1b5270cf08450a6b402405f5213e6b4334f14aa7be0010513487a302fe693eed7e50084969e5a6a4e482d7c977eaa2803f638c2f7c
|
7
|
+
data.tar.gz: a5f6d328d1d71be9534a6d5b57adf923840a558935980e85f3cba49a2ac845ecf141ca1dede7ea2a5ab23c67989639f8244ef58c0c1cd9f8e800461f67bfb972
|
data/lib/gds_api/rummager.rb
CHANGED
@@ -25,6 +25,33 @@ module GdsApi
|
|
25
25
|
)
|
26
26
|
end
|
27
27
|
|
28
|
+
# Deletes a content-document from the index. Content documents are pages
|
29
|
+
# on GOV.UK returned by search index. They don't include best bets and other
|
30
|
+
# "meta" documents that are stored in Rummager.
|
31
|
+
#
|
32
|
+
# @param base_path Base path of the page on GOV.UK.
|
33
|
+
# @see https://github.com/alphagov/rummager/blob/master/docs/content-api.md
|
34
|
+
def delete_content!(base_path)
|
35
|
+
request_url = "#{base_url}/content?link=#{base_path}"
|
36
|
+
delete_json!(request_url)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Retrieves a content-document from the index. Content documents are pages
|
40
|
+
# on GOV.UK returned by search index.
|
41
|
+
#
|
42
|
+
# @param base_path Base path of the page on GOV.UK.
|
43
|
+
# @see https://github.com/alphagov/rummager/blob/master/docs/content-api.md
|
44
|
+
def get_content!(base_path)
|
45
|
+
request_url = "#{base_url}/content?link=#{base_path}"
|
46
|
+
get_json!(request_url)
|
47
|
+
end
|
48
|
+
|
49
|
+
# delete_document(type, id) (DEPRECATED)
|
50
|
+
#
|
51
|
+
# Delete any document from the search index. Unlike `delete_content!` this
|
52
|
+
# needs a type, but can be used to delete non-content documents from the
|
53
|
+
# index.
|
54
|
+
# @deprecated
|
28
55
|
def delete_document(type, id)
|
29
56
|
delete_json!(
|
30
57
|
"#{documents_url}/#{id}",
|
data/lib/gds_api/version.rb
CHANGED
data/test/rummager_test.rb
CHANGED
@@ -132,4 +132,19 @@ describe GdsApi::Rummager do
|
|
132
132
|
assert_requested :get, /order=-public_timestamp/
|
133
133
|
end
|
134
134
|
|
135
|
+
it "#delete_content removes a document" do
|
136
|
+
request = stub_request(:delete, "http://example.com/content?link=/foo/bar")
|
137
|
+
|
138
|
+
GdsApi::Rummager.new("http://example.com").delete_content!("/foo/bar")
|
139
|
+
|
140
|
+
assert_requested(request)
|
141
|
+
end
|
142
|
+
|
143
|
+
it "#get_content Retrieves a document" do
|
144
|
+
request = stub_request(:get, "http://example.com/content?link=/foo/bar")
|
145
|
+
|
146
|
+
GdsApi::Rummager.new("http://example.com").get_content!("/foo/bar")
|
147
|
+
|
148
|
+
assert_requested(request)
|
149
|
+
end
|
135
150
|
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: 26.
|
4
|
+
version: 26.7.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: 2015-12-
|
11
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: plek
|