parliament-opensearch 0.5.0 → 0.5.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0e88f83c00eb71b470fd73fe93cb8e99ae07074
|
4
|
+
data.tar.gz: 28cfc60d54b9d5cdbe92a0110e280d13741231ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a79259b3a99bc1030a820d46cb9854a2a71fd7fca16085c29fa53e58696dfbbcf99d9075a1b985383366f404365da1f6fcffba5574383dfd112fc7fdc22a74e
|
7
|
+
data.tar.gz: '0322481c8ab170b7f4d1e8c112974e52f6842ce38f3d3a59f47a2f9907f41d5dcdbd5d16da5c7597efe3e82bc1dd1c002386f804b8f3541da46d297dda608633'
|
@@ -9,14 +9,15 @@ module Parliament
|
|
9
9
|
# Given a description uri, either download the file or serve it from our cache
|
10
10
|
#
|
11
11
|
# @param [String] uri the uri of our description file
|
12
|
+
# @param [optional, String] request_id a Request-Id base value
|
12
13
|
# @return [String] our description file
|
13
|
-
def fetch(uri)
|
14
|
+
def fetch(uri, request_id = nil)
|
14
15
|
store
|
15
16
|
|
16
17
|
if cache_valid?(store[uri])
|
17
18
|
templates = @store[uri][:templates]
|
18
19
|
else
|
19
|
-
templates = download_description_templates(uri)
|
20
|
+
templates = download_description_templates(uri, request_id)
|
20
21
|
|
21
22
|
@store[uri] = { timestamp: Time.now, templates: templates }
|
22
23
|
end
|
@@ -58,7 +59,7 @@ module Parliament
|
|
58
59
|
#
|
59
60
|
# @param [String] uri the uri of our certificates
|
60
61
|
# @return [String] certificate data
|
61
|
-
def download_description_templates(uri)
|
62
|
+
def download_description_templates(uri, request_id = nil)
|
62
63
|
return if uri.nil?
|
63
64
|
|
64
65
|
begin
|
@@ -71,7 +72,7 @@ module Parliament
|
|
71
72
|
'Accept' => 'application/opensearchdescription+xml',
|
72
73
|
'Ocp-Apim-Subscription-Key' => ENV['OPENSEARCH_AUTH_TOKEN']
|
73
74
|
}
|
74
|
-
headers['Request-Id'] = "#{
|
75
|
+
headers['Request-Id'] = "#{request_id}description-#{store.keys.length + 1}" if request_id
|
75
76
|
request = Parliament::Request::BaseRequest.new(base_url: uri,
|
76
77
|
headers: headers)
|
77
78
|
xml_response = request.get
|