coverband-service-client 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/coverband-service-client.rb +8 -6
- data/lib/coverband/service/client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0d326e9f18a89a72e6a251e92b1a2c4d99a44288c1e695570327675017e5328
|
4
|
+
data.tar.gz: 83efe304d0dac5797b63ad4dea23516df89ab211a0aa5809554c9b3fce5dfa82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3588eb3a0fc1c70afa925b61feaf92ee95b7169476e0008abac2ee83413a7ad0a02726876fda490089fb2008d17861f71cebd297dc78744de049fc62a82c2022
|
7
|
+
data.tar.gz: ee29788c3d877f9cd0079615c30da437490cc3a4c6fb74ed7a0454d44b405ef041965c648b4e3d5162f775c13d8661165c578fa57993de090d39be253f34a139
|
data/Gemfile.lock
CHANGED
@@ -68,20 +68,18 @@ module Coverband
|
|
68
68
|
ENV['COVERBAND_API_KEY'] || Coverband.configuration.api_key
|
69
69
|
end
|
70
70
|
|
71
|
-
# TODO: no longer get by type just get both reports in a single request
|
72
71
|
def coverage(local_type = nil, opts = {})
|
73
72
|
local_type ||= opts.key?(:override_type) ? opts[:override_type] : type
|
74
|
-
|
73
|
+
env_filter = opts.key?(:env_filter) ? opts[:env_filter] : 'production'
|
74
|
+
uri = URI("#{coverband_url}/api/coverage?type=#{local_type}&env_filter=#{env_filter}",)
|
75
75
|
req = Net::HTTP::Get.new(uri, 'Content-Type' => 'application/json', 'Coverband-Token' => api_key)
|
76
76
|
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
|
77
77
|
http.request(req)
|
78
78
|
end
|
79
79
|
coverage_data = JSON.parse(res.body)
|
80
|
-
# puts "coverage data: "
|
81
|
-
# puts coverage_data
|
82
80
|
coverage_data
|
83
81
|
rescue StandardError => e
|
84
|
-
|
82
|
+
logger&.error "Coverband: Error while retrieving coverage #{e}" if Coverband.configuration.verbose || COVERBAND_ENABLE_DEV_MODE
|
85
83
|
end
|
86
84
|
|
87
85
|
def save_report(report)
|
@@ -174,13 +172,17 @@ module Coverband
|
|
174
172
|
|
175
173
|
private
|
176
174
|
|
175
|
+
def api_key
|
176
|
+
ENV['COVERBAND_API_KEY'] || Coverband.configuration.api_key
|
177
|
+
end
|
178
|
+
|
177
179
|
def logger
|
178
180
|
Coverband.configuration.logger
|
179
181
|
end
|
180
182
|
|
181
183
|
def save_tracked_views(views:, reported_time:)
|
182
184
|
uri = URI("#{COVERBAND_SERVICE_URL}/api/collector")
|
183
|
-
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json', 'Coverband-Token' =>
|
185
|
+
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json', 'Coverband-Token' => api_key)
|
184
186
|
data = {
|
185
187
|
collection_type: 'view_tracker_delta',
|
186
188
|
collection_data: {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coverband-service-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Mayer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-05-
|
12
|
+
date: 2020-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|