close_encounters 0.2.1 → 0.2.2
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 +4 -4
- data/CHANGELOG.md +10 -11
- data/lib/close_encounters/version.rb +1 -1
- data/lib/close_encounters.rb +16 -9
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5a45c4e3e354b03b9079a8877bb298d552856412fb402378ea5070f2e904253
|
4
|
+
data.tar.gz: 11cc60f66488168126254be369d7a34e0a162d01c644c9f56f942685d232bb46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a560de8306f8e738f72fab9b070c2977301d07b4aa1e9b81ef959dbcc669d70a088f58af1fea9f640a8893ca559167758ab55ca2b8cab3cbaf2cf726d51180bd
|
7
|
+
data.tar.gz: 4e54a853db68694c94cbe3c339449ed460f6692a99df3c86a2aa11194bfd9520a0d29cf8f197e158202ff017132f2cf3de8c6a6483eed2b867976188bb3d880c
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
7
7
|
|
8
|
+
## [0.2.2] - 2025-09-04
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Update handling of the same status for multiple requests when creating events.
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
|
16
|
+
- Ensure that status is an integer when creating events and comparing results.
|
17
|
+
|
8
18
|
## [0.2.1] - 2025-03-05
|
9
19
|
|
10
20
|
### Added
|
@@ -15,14 +25,3 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
15
25
|
### Changed
|
16
26
|
|
17
27
|
- Ensure that events are only created if the status has changed or if the status is in the verify_scan_statuses list and verification fails.
|
18
|
-
|
19
|
-
## [0.2.0] - 2025-02-26
|
20
|
-
|
21
|
-
### Changed
|
22
|
-
|
23
|
-
- Test with Ruby 3.4
|
24
|
-
|
25
|
-
### Added
|
26
|
-
|
27
|
-
- Ability to use CloseEncounters::Middleware and CloseEncounters.auto_contact! to automatically track responses from third-party services.
|
28
|
-
- Add metadata to events for storing extra information about the event.
|
data/lib/close_encounters.rb
CHANGED
@@ -31,8 +31,13 @@ module CloseEncounters
|
|
31
31
|
# @param response [String] the response object
|
32
32
|
def contact(name, status:, response:)
|
33
33
|
service = ParticipantService.find_by!(name:)
|
34
|
-
|
35
|
-
|
34
|
+
status = status.to_i # Ensure status is always an integer
|
35
|
+
|
36
|
+
# Use a transaction with a lock to prevent race conditions
|
37
|
+
service.with_lock do
|
38
|
+
unless service.events.newest.pick(:status) == status
|
39
|
+
service.events.create!(status: status, response:)
|
40
|
+
end
|
36
41
|
end
|
37
42
|
end
|
38
43
|
|
@@ -49,14 +54,16 @@ module CloseEncounters
|
|
49
54
|
# @param verifier [Proc] the verification callable which must also respond to to_s
|
50
55
|
def scan(name, status:, response:, verifier:)
|
51
56
|
service = ParticipantService.find_by!(name:)
|
52
|
-
|
57
|
+
status = status.to_i # Ensure status is always an integer
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
59
|
+
service.with_lock do
|
60
|
+
if service.events.newest.pick(:status) != status
|
61
|
+
verified = verifier.call(response)
|
62
|
+
service.events.create!(status:, response:, metadata: {verified:, verification: verifier.to_s})
|
63
|
+
elsif verify_scan_statuses.include?(status)
|
64
|
+
verified = verifier.call(response)
|
65
|
+
service.events.create!(status:, response:, metadata: {verified:, verification: verifier.to_s}) if !verified
|
66
|
+
end
|
60
67
|
end
|
61
68
|
end
|
62
69
|
alias_method :verify, :scan
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: close_encounters
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Gay
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: railties
|
@@ -129,7 +128,6 @@ metadata:
|
|
129
128
|
homepage_uri: https://github.com/SOFware/close_encounters
|
130
129
|
source_code_uri: https://github.com/SOFware/close_encounters
|
131
130
|
changelog_uri: https://github.com/SOFware/close_encounters/blob/main/CHANGELOG.md
|
132
|
-
post_install_message:
|
133
131
|
rdoc_options: []
|
134
132
|
require_paths:
|
135
133
|
- lib
|
@@ -144,8 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
142
|
- !ruby/object:Gem::Version
|
145
143
|
version: '0'
|
146
144
|
requirements: []
|
147
|
-
rubygems_version: 3.
|
148
|
-
signing_key:
|
145
|
+
rubygems_version: 3.6.7
|
149
146
|
specification_version: 4
|
150
147
|
summary: Close Encounters of the Third Party
|
151
148
|
test_files: []
|