bitfab 0.64.19 → 0.64.21

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: a4949c6f7ebe457c48b386ae3243b7b5f4735f9fb0e8c2248db559328ca2d532
4
- data.tar.gz: cd72bfba1753c4c2a4baee978f2fd401fe9cecfccdf56b90dd01a70a49aea85d
3
+ metadata.gz: 01e0c3dff10bb4315c2d7501e397c6e466679dd8a26ae99c98f682f7f91d0584
4
+ data.tar.gz: 9135b87f009d87e024b567bbf795fb78f3ca2da88560eca0c8f4a81ca9054223
5
5
  SHA512:
6
- metadata.gz: 525e777fd4ae7517aa2bec6efabb08afd0d944efb17a270952ec8bd762e04c5f78dba6070fe0e2b33f7174ec0c198c5c55bf3c20a2e55511f7b0c9ae2232745e
7
- data.tar.gz: d68cbd2fd4dbc0c84e50c773f3e99b3e7edc5bf7e7cd481734db313e62c63169fe2332c1dbbcaedf5172760aa840dd7db8aa100cdb6fe6c46b8034569e4b35eb
6
+ metadata.gz: 8cf6468e184bcc18a6de04a739f55fcc4f35e31c8e95664ab5f054e6a260933ceaf6f3f8aea3478b0ac91756b16e84d69b6971b76549ce1152403ff3f37b6f5c
7
+ data.tar.gz: 4fa5a6541e6f234ae28637aba7371c40a1dd80a1800e2d4113d4fda5a507d0652fe12650458a02557661d67d1161225f66ce483daee4d6ce988d068d5494429b
@@ -58,6 +58,21 @@ module Bitfab
58
58
  @http_client.get(dataset_path(dataset_id))["dataset"]
59
59
  end
60
60
 
61
+ # Rename the dataset or change its description, and return the updated
62
+ # dataset. It keeps its id, traces, and graders. A nil argument leaves that
63
+ # field untouched, and an empty description clears it. Raises ArgumentError
64
+ # when both are nil. A blank name, or one another dataset under the same
65
+ # trace function already uses, raises Net::HTTPError with a 400. A dataset
66
+ # outside this organization raises Net::HTTPError with a 404.
67
+ def update(dataset_id, name: nil, description: nil)
68
+ raise ArgumentError, "Provide name and/or description to update." if name.nil? && description.nil?
69
+
70
+ payload = {}
71
+ payload["name"] = name unless name.nil?
72
+ payload["description"] = description unless description.nil?
73
+ @http_client.request(dataset_path(dataset_id), payload, method: "PATCH")["dataset"]
74
+ end
75
+
61
76
  # The ids of every trace in the dataset, the same membership a replay with
62
77
  # dataset_id: selects. Fetches all pages automatically.
63
78
  def list_traces(dataset_id)
@@ -4,11 +4,25 @@ require "uri"
4
4
 
5
5
  module Bitfab
6
6
  class Traces
7
+ UNSET = Object.new.freeze
8
+ private_constant :UNSET
9
+
7
10
  def get_scenario(trace_id)
8
11
  @http_client.get(scenario_path(trace_id))["scenario"]
9
12
  end
10
13
 
11
- def save_scenario(trace_id, name: nil, description: nil, trigger: nil, data: nil, append_data: nil)
14
+ # Updates the scenario built from trace_id and returns the saved hash.
15
+ #
16
+ # name:, description:, trigger:, and data: each replace the saved value whole. Keywords left out are kept.
17
+ # append_data: adds history and missing entries after the saved ones. Pass data: or append_data:, not both.
18
+ #
19
+ # actual_outcome: is what the run actually did in this one example, never what it should have done.
20
+ # Bitfab never fills it in, so only the caller sets it. It takes
21
+ # {"summary" => String, "actions" => [{"name", "details", "result", "failed", "at"}], "source" => Hash or nil}
22
+ # and replaces the saved value whole. Passing nil clears it. Leaving it out keeps it.
23
+ #
24
+ # Raises ArgumentError before any request when nothing is passed, or when data: and append_data: are both passed.
25
+ def save_scenario(trace_id, name: nil, description: nil, trigger: nil, data: nil, append_data: nil, actual_outcome: UNSET)
12
26
  if !data.nil? && !append_data.nil?
13
27
  raise ArgumentError, "Pass data or append_data, not both: data replaces the saved data whole."
14
28
  end
@@ -19,8 +33,9 @@ module Bitfab
19
33
  payload["trigger"] = trigger unless trigger.nil?
20
34
  payload["data"] = data unless data.nil?
21
35
  payload["appendData"] = append_data unless append_data.nil?
36
+ payload["actualOutcome"] = actual_outcome unless actual_outcome.equal?(UNSET)
22
37
  if payload.empty?
23
- raise ArgumentError, "Pass at least one of name, description, trigger, data, or append_data: there is nothing to save otherwise."
38
+ raise ArgumentError, "Pass at least one of name, description, trigger, data, append_data, or actual_outcome: there is nothing to save otherwise."
24
39
  end
25
40
 
26
41
  @http_client.request(scenario_path(trace_id), payload)["scenario"]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.64.19"
4
+ VERSION = "0.64.21"
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.64.19
4
+ version: 0.64.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team