acidic_job 0.8.7 → 0.8.8
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/.tool-versions +1 -1
- data/Gemfile.lock +1 -1
- data/lib/acidic_job/arguments.rb +8 -0
- data/lib/acidic_job/railtie.rb +1 -0
- data/lib/acidic_job/serializers/new_record_serializer.rb +25 -0
- data/lib/acidic_job/test_case.rb +1 -1
- data/lib/acidic_job/version.rb +1 -1
- data/lib/acidic_job.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 73e730bb2b10e7c54a403fb2dea12c0f0d398d0ae761a01ec38cf59288eb3309
|
|
4
|
+
data.tar.gz: 6d1826773e7cdc6b4f42fc291a332859d6d22f45e7eb519e36753788198aaa71
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c15d6d8b6298df62b4cb241efe8dcf8fd46d6804a0dbe1f38106085bc66cc61fb380237de2cfbc0b3db1eac2942f6727ab1a6cb22c8a79914feef2b5461494d5
|
|
7
|
+
data.tar.gz: 9230e95fcff19c465124a90d55514ef56b404faa922ef1e5029f8477b009216bf8adb9a5d1b721db76a99906d9605850192de4c91c234bc04f1c90d02d7c761c
|
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby 3.1.
|
|
1
|
+
ruby 3.1.1
|
data/Gemfile.lock
CHANGED
data/lib/acidic_job/arguments.rb
CHANGED
|
@@ -18,5 +18,13 @@ module AcidicJob
|
|
|
18
18
|
rescue ActiveRecord::RecordNotFound
|
|
19
19
|
nil
|
|
20
20
|
end
|
|
21
|
+
|
|
22
|
+
# In order to allow our `NewRecordSerializer` a chance to work, we need to ensure that
|
|
23
|
+
# ActiveJob's first attempt to serialize an ActiveRecord model doesn't throw an exception.
|
|
24
|
+
def convert_to_global_id_hash(argument)
|
|
25
|
+
{ GLOBALID_KEY => argument.to_global_id.to_s }
|
|
26
|
+
rescue URI::GID::MissingModelIdError
|
|
27
|
+
Serializers.serialize(argument)
|
|
28
|
+
end
|
|
21
29
|
end
|
|
22
30
|
end
|
data/lib/acidic_job/railtie.rb
CHANGED
|
@@ -16,6 +16,7 @@ module AcidicJob
|
|
|
16
16
|
::ActiveSupport.on_load(:active_job) do
|
|
17
17
|
::ActiveJob::Serializers.add_serializers(
|
|
18
18
|
Serializers::ExceptionSerializer,
|
|
19
|
+
Serializers::NewRecordSerializer,
|
|
19
20
|
Serializers::FinishedPointSerializer,
|
|
20
21
|
Serializers::JobSerializer,
|
|
21
22
|
Serializers::RangeSerializer,
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "active_job/serializers/object_serializer"
|
|
4
|
+
|
|
5
|
+
module AcidicJob
|
|
6
|
+
module Serializers
|
|
7
|
+
class NewRecordSerializer < ::ActiveJob::Serializers::ObjectSerializer
|
|
8
|
+
def serialize(new_record)
|
|
9
|
+
super(
|
|
10
|
+
"class" => new_record.class.name,
|
|
11
|
+
"attributes" => new_record.attributes
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def deserialize(hash)
|
|
16
|
+
new_record_class = hash["class"].constantize
|
|
17
|
+
new_record_class.new(hash["attributes"])
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def serialize?(argument)
|
|
21
|
+
defined?(::ActiveRecord) && argument.respond_to?(:new_record?) && argument.new_record?
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
data/lib/acidic_job/test_case.rb
CHANGED
data/lib/acidic_job/version.rb
CHANGED
data/lib/acidic_job.rb
CHANGED
|
@@ -30,6 +30,7 @@ require_relative "acidic_job/serializers/range_serializer"
|
|
|
30
30
|
require_relative "acidic_job/serializers/recovery_point_serializer"
|
|
31
31
|
require_relative "acidic_job/serializers/worker_serializer"
|
|
32
32
|
require_relative "acidic_job/serializers/active_kiq_serializer"
|
|
33
|
+
require_relative "acidic_job/serializers/new_record_serializer"
|
|
33
34
|
|
|
34
35
|
require_relative "acidic_job/railtie"
|
|
35
36
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: acidic_job
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.8.
|
|
4
|
+
version: 0.8.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- fractaledmind
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-06-
|
|
11
|
+
date: 2023-06-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activejob
|
|
@@ -275,6 +275,7 @@ files:
|
|
|
275
275
|
- lib/acidic_job/serializers/exception_serializer.rb
|
|
276
276
|
- lib/acidic_job/serializers/finished_point_serializer.rb
|
|
277
277
|
- lib/acidic_job/serializers/job_serializer.rb
|
|
278
|
+
- lib/acidic_job/serializers/new_record_serializer.rb
|
|
278
279
|
- lib/acidic_job/serializers/range_serializer.rb
|
|
279
280
|
- lib/acidic_job/serializers/recovery_point_serializer.rb
|
|
280
281
|
- lib/acidic_job/serializers/worker_serializer.rb
|
|
@@ -311,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
311
312
|
- !ruby/object:Gem::Version
|
|
312
313
|
version: '0'
|
|
313
314
|
requirements: []
|
|
314
|
-
rubygems_version: 3.3.
|
|
315
|
+
rubygems_version: 3.3.7
|
|
315
316
|
signing_key:
|
|
316
317
|
specification_version: 4
|
|
317
318
|
summary: Idempotent operations for Rails apps, built on top of ActiveJob.
|