standard_procedure_operations 0.2.0 → 0.2.1

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: d19a26ed4cb26b809efc2e4d551a4895613608348f3524f1764c000aceb6aeca
4
- data.tar.gz: 2290a93af8caeacfa00fd941e62e4785366e4efa80d59579201bfe93cd85fa0a
3
+ metadata.gz: 01add4a31dd9bc5fadf9c8c133ab46ad0ce7d562061bcf176324d3b5bb7bcdcc
4
+ data.tar.gz: b807c6c826e7f572581bfc93eb1676d1c472377771ae872ff882d0ff6360ab7e
5
5
  SHA512:
6
- metadata.gz: 898f19eb0c69a359a939f5f3b563645dd36d8d6bc2e77707ecc1099698541c02210cbc351866d255a3a6747fb957fbb5f82146a120e53c1ba7d87cd68b280e61
7
- data.tar.gz: 8b44ab81583ce10937a02d9cc9cbe7e6d7c153a83b29661d4cb1055876b39f181de7aa022aa9a3bbb2adf0e97aa618034582512bb72465172908b388243d11b1
6
+ metadata.gz: 15c50c2237db2c236f256071035e74795f345f632550b8c1dab4878e02914c698819252b75977630e52c47b607dc312b0b42abd44646e36ef285c82d024e23aa
7
+ data.tar.gz: 430746923c58ff6e3081f4aaf4dd5fb9e69a3fd38927af926282136fc2ea4594756e5e99d813303754a23fcbaf560f1aecc884a91999b6d97c76232365eba13b
@@ -34,7 +34,7 @@ module Operations::Task::StateManagement
34
34
  private def process_current_state(data)
35
35
  handler_for(state).call(self, data)
36
36
  rescue => ex
37
- update! status: "failed", results: OpenStruct.new(failure_message: ex.message, exception_class: ex.class.name, exception_backtrace: ex.backtrace)
37
+ update! status: "failed", status_message: ex.message.to_s.truncate(240), results: OpenStruct.new(failure_message: ex.message, exception_class: ex.class.name, exception_backtrace: ex.backtrace)
38
38
  end
39
39
  private def state_is_valid
40
40
  errors.add :state, :invalid if state.blank? || handler_for(state.to_sym).nil?
@@ -9,18 +9,18 @@ module Operations
9
9
 
10
10
  def self.call(data = {})
11
11
  raise MissingInputsError, "Missing inputs: #{missing_inputs_from(data).join(", ")}" unless required_inputs_are_present_in?(data)
12
- create!(state: initial_state).tap do |task|
12
+ create!(state: initial_state, status_message: "").tap do |task|
13
13
  task.send(:process_current_state, DataCarrier.new(data.merge(task: task)))
14
14
  end
15
15
  end
16
16
 
17
17
  def go_to(state, data = {}, message = nil)
18
- update!(state: state, status_message: message || state.to_s)
18
+ update!(state: state, status_message: (message || state).to_s.truncate(240))
19
19
  process_current_state(data)
20
20
  end
21
21
 
22
- def fail_with(message) = update! status: "failed", results: {failure_message: message.to_s}
22
+ def fail_with(message) = update! status: "failed", status_message: message.to_s.truncate(240), results: {failure_message: message.to_s}
23
23
 
24
- def complete(results) = update!(status: "completed", results: results)
24
+ def complete(results) = update!(status: "completed", status_message: "completed", results: results)
25
25
  end
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module Operations
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_procedure_operations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rahoul Baruah
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-29 00:00:00.000000000 Z
10
+ date: 2025-01-31 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails