parliament-utils 0.8.2 → 0.8.3

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: c6b4ce12878d5fe1c90e193a370f0a917729fec0
4
- data.tar.gz: d0f85799c92f964fbc43a5fe447f4904af47bbac
3
+ metadata.gz: e5621a8e55189bd1d6fbba37ca9556e20699be33
4
+ data.tar.gz: dd6c025a5f139e131f0d7deb787655c0691cbdb1
5
5
  SHA512:
6
- metadata.gz: 1d9525cff15f63470678d51a9b3c5329af8526b9554105ec9bc1d2385fc01ba7341c895ee603f45934500fe38ce4463f1ade1ba920e917d18c79df01854cc0eb
7
- data.tar.gz: 6ee4c3d99fd68d9f9165b810365b78e8b9f6c8155d70a0abeab7bfab8f9384e290c4af47ae054eb159b97ac9a9c4ed52e18091b6fef983b1a3b2685cbe914566
6
+ metadata.gz: 4851a595427733248ff294d304eec8108300bd98c97a362ec98e786e23b8624bc35bf37a186d3316d7a68724f62ef6359190da88d68ecacc1ff2451afa1ed58c
7
+ data.tar.gz: 23547f2af26403b52671ac10078b8d64842fa2d0dc288bf79b38aee0adfdced7da985e40c42fa750df065072e3cfa57223c5fd288098249a9bf78947a0b16398
data/.gitignore CHANGED
@@ -13,3 +13,5 @@
13
13
 
14
14
  # rspec failure tracking
15
15
  .rspec_status
16
+
17
+ spec/dummy/log/*
@@ -1,4 +1,4 @@
1
- if ENV['AIRBRAKE_PROJECT_ID'].present? && ENV['AIRBRAKE_PROJECT_KEY'].present?
1
+ if defined?(Airbrake) && ENV['AIRBRAKE_PROJECT_ID'].present? && ENV['AIRBRAKE_PROJECT_KEY'].present?
2
2
  # Airbrake is an online tool that provides robust exception tracking in your Rails
3
3
  # applications. In doing so, it allows you to easily review errors, tie an error
4
4
  # to an individual piece of code, and trace the cause back to recent
@@ -116,6 +116,11 @@ module Parliament
116
116
  Pugin.alternates = alternates
117
117
  end
118
118
 
119
+ # Populates @app_insights_request_id if present
120
+ def populate_request_id
121
+ @app_insights_request_id = request.env['ApplicationInsights.request.id']
122
+ end
123
+
119
124
  private
120
125
 
121
126
  # Before every request, reset Pugin's list of alternates to prevent showing rel-alternate tags on pages without data
@@ -5,9 +5,9 @@ module Parliament
5
5
  module Utils
6
6
  module Helpers
7
7
  module ParliamentHelper
8
- def self.parliament_request(request_number: 1)
8
+ def self.parliament_request(request_id = nil, request_number = 1)
9
9
  headers = {'Ocp-Apim-Subscription-Key' => ENV['PARLIAMENT_AUTH_TOKEN'] }
10
- headers['Request-Id'] = "#{ENV['ApplicationInsights.request.id']}#{request_number}" if ENV['ApplicationInsights.request.id']
10
+ headers['Request-Id'] = "#{request_id}#{request_number}" if request_id
11
11
 
12
12
  Parliament::Request::UrlRequest.new(
13
13
  builder: Parliament::Builder::NTripleResponseBuilder,
@@ -16,8 +16,8 @@ module Parliament
16
16
  )
17
17
  end
18
18
 
19
- def parliament_request(request_number: 1)
20
- Parliament::Utils::Helpers::ParliamentHelper.parliament_request(request_number)
19
+ def parliament_request(request_id = nil, request_number = 1)
20
+ Parliament::Utils::Helpers::ParliamentHelper.parliament_request(request_id, request_number)
21
21
  end
22
22
  end
23
23
  end
@@ -1,5 +1,5 @@
1
1
  module Parliament
2
2
  module Utils
3
- VERSION = '0.8.2'.freeze
3
+ VERSION = '0.8.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parliament-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rebecca Appleyard