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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8d7b393a8c8e038d9ec952cea42d257685e93e68d8e00a1dcd6c5be2c46272c
4
- data.tar.gz: 9aeba81b92f75f43557cbb891b9cee1927e46d03683927d8cfabaad8caf10d46
3
+ metadata.gz: a0d326e9f18a89a72e6a251e92b1a2c4d99a44288c1e695570327675017e5328
4
+ data.tar.gz: 83efe304d0dac5797b63ad4dea23516df89ab211a0aa5809554c9b3fce5dfa82
5
5
  SHA512:
6
- metadata.gz: 466d704e4b97b84c5ae198e997292c3207179cdd185e3087a2067365223cfcb6971b691decb78d7eeb8ed08be88a718c5a448aca5c3abe01c1ff4a76069a9757
7
- data.tar.gz: 0c6b6c7db5364d591c0fbcbcd74e61c04aadebcca9e3ef3dd02b44ae952a6e86e0a800a9110db819bc4cf0d66cd5d43691ad42ad8c157049ba68a1e42ea957f9
6
+ metadata.gz: 3588eb3a0fc1c70afa925b61feaf92ee95b7169476e0008abac2ee83413a7ad0a02726876fda490089fb2008d17861f71cebd297dc78744de049fc62a82c2022
7
+ data.tar.gz: ee29788c3d877f9cd0079615c30da437490cc3a4c6fb74ed7a0454d44b405ef041965c648b4e3d5162f775c13d8661165c578fa57993de090d39be253f34a139
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coverband-service-client (0.0.10)
4
+ coverband-service-client (0.0.11)
5
5
  coverband (~> 4.2.4)
6
6
 
7
7
  GEM
@@ -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
- uri = URI("#{coverband_url}/api/coverage/#{ENV['COVERBAND_ID']}?type=#{local_type}")
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
- puts "Coverband: Error while retrieving coverage #{e}"
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' => ENV['COVERBAND_API_KEY'])
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: {
@@ -1,7 +1,7 @@
1
1
  module Coverband
2
2
  module Service
3
3
  module Client
4
- VERSION = '0.0.10'
4
+ VERSION = '0.0.11'
5
5
  end
6
6
  end
7
7
  end
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.10
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-21 00:00:00.000000000 Z
12
+ date: 2020-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler