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: 112097c40a5e35ada1bb98ad15fdfc7c3fadbb5c
4
- data.tar.gz: 4926ff9614056c0541fc9bb937576abe2e9966d2
3
+ metadata.gz: d0e88f83c00eb71b470fd73fe93cb8e99ae07074
4
+ data.tar.gz: 28cfc60d54b9d5cdbe92a0110e280d13741231ac
5
5
  SHA512:
6
- metadata.gz: c3dc002e7c6c966cd48f8901db83e6a2aec9b2f7b475c9043c77f07d1fa401ee51784d2e38c5a9698e915622fb3843dc0dfb087296b678c31a1bf030117edab9
7
- data.tar.gz: bf2700d0847e84b52c24caa645b2bb2d30fd51c7f880de7e22b261123e1ab4e34a923e08c558d9955e62c1135969c5eddcddd301515751e4eff9f7fee3e405be
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'] = "#{ENV['ApplicationInsights.request.id']}description-#{store.keys.length + 1}" if ENV['ApplicationInsights.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
@@ -1,5 +1,5 @@
1
1
  module Parliament
2
2
  module OpenSearch
3
- VERSION = '0.5.0'.freeze
3
+ VERSION = '0.5.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-opensearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard