bitfab 0.57.3 → 0.57.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e0ff237a0edb323605b58c1b1e9befb6b82f905c6182eae3b18834ef2aa74572
4
- data.tar.gz: 226b86cb062a7f040bd7c22ed2a20536419434c788db9de103e8db81481f5778
3
+ metadata.gz: ba510678769346664b90c514ef3f2bf4f062f4d50cbdc84563247224715795f6
4
+ data.tar.gz: 4e1acdbd642f6a49359354f1942c09b4559c75b035f43ed44c8aae5f9076f669
5
5
  SHA512:
6
- metadata.gz: 90543732de9630e51151d2bebe23ad1a8947de7571d94ecd4c5d697cf6d194029d97722bddc460901628d3f9deefe47c09555150188bc5f3c1ad277ef3b3f43a
7
- data.tar.gz: 6aa001f7731011af814280047cfd83e15060a91458dd92d5b7ef2078049cb7bddca00250895ee6747413088237712df1b8e619423188107224e681a01a9189dd
6
+ metadata.gz: 69af59d763069101a1bdc3eb026789fe1cb66bf8967b39f08368e75cae2ceb3301ce2007ffe0e746fe8a74913ca93b07609f42786c1a333762d6da77df30bc73
7
+ data.tar.gz: ffaeadd367ec46fd26506fcfe5b39692fcc7e86b1248c8d1eceb4ecc1da00cb0b87ad4bba671c372cfc3fdd12e7d89be37fb6430af4bac9c49f30c8923c95c64
data/lib/bitfab/labels.rb CHANGED
@@ -6,17 +6,22 @@ module Bitfab
6
6
  class Labels
7
7
  LABELS_PATH = "/api/sdk/traces/labels"
8
8
  HUMAN_LABELS_PATH = "#{LABELS_PATH}/human"
9
+ LABEL_EVIDENCE_PATH = "#{LABELS_PATH}/label-evidence"
10
+ EVIDENCE_UNSET = Object.new.freeze
11
+
12
+ private_constant :EVIDENCE_UNSET
9
13
 
10
14
  def initialize(http_client)
11
15
  @http_client = http_client
12
16
  end
13
17
 
14
18
  def save(label:, annotation:, trace_id: nil, original_trace_id: nil, attempt: nil,
15
- confidence: nil, test_run_id: nil, assertion_id: nil)
19
+ confidence: nil, test_run_id: nil, assertion_id: nil, evidence: EVIDENCE_UNSET)
16
20
  update = label_target(trace_id:, original_trace_id:, attempt:, assertion_id:)
17
21
  update["label"] = label
18
22
  update["annotation"] = annotation
19
23
  update["confidence"] = confidence unless confidence.nil?
24
+ update["evidence"] = evidence unless evidence.equal?(EVIDENCE_UNSET)
20
25
  save_all([update], test_run_id:).first
21
26
  end
22
27
 
@@ -36,10 +41,12 @@ module Bitfab
36
41
  save_all([update.merge("archive" => true)], test_run_id:).first
37
42
  end
38
43
 
39
- def save_human(label:, annotation:, trace_id:, confidence: nil, assertion_id: nil)
44
+ def save_human(label:, annotation:, trace_id:, confidence: nil, assertion_id: nil,
45
+ evidence: EVIDENCE_UNSET)
40
46
  update = {"traceId" => trace_id, "label" => label, "annotation" => annotation}
41
47
  update["assertionId"] = assertion_id unless assertion_id.nil?
42
48
  update["confidence"] = confidence unless confidence.nil?
49
+ update["evidence"] = evidence unless evidence.equal?(EVIDENCE_UNSET)
43
50
  save_human_all([update]).first
44
51
  end
45
52
 
@@ -58,6 +65,13 @@ module Bitfab
58
65
  @http_client.get("#{LABELS_PATH}?#{query}")["labels"]
59
66
  end
60
67
 
68
+ def get_label_evidence(trace_id, assertion_id: nil)
69
+ params = {"traceId" => trace_id}
70
+ params["assertionId"] = assertion_id unless assertion_id.nil?
71
+ query = URI.encode_www_form(params)
72
+ @http_client.get("#{LABEL_EVIDENCE_PATH}?#{query}")["evidence"]
73
+ end
74
+
61
75
  private
62
76
 
63
77
  def label_target(trace_id:, original_trace_id:, attempt:, assertion_id:)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.57.3"
4
+ VERSION = "0.57.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.57.3
4
+ version: 0.57.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team