datory 2.1.0 → 2.2.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/datory/context/callable.rb +11 -6
- data/lib/datory/context/workspace.rb +13 -0
- data/lib/datory/version.rb +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1763a8028c249bf60dd2f07861f5eae4d74055fa3c54f194d945dc679a5d5dd9
|
4
|
+
data.tar.gz: d98843e8292925b82c9a09f21354eec56e141a50fc6dbc0a152837c6f059a33b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5250ce51ddf8946501529bd3dc1716d83f8c2f8ee36d564578e12d7a5fcee7ea6d9d3d1fb126e9d2f363e12ca84fc32434acf077c8c2e78aeeb5efa15a47af3a
|
7
|
+
data.tar.gz: 458ab398ebabd8ce06a7b6ff031f81a39a00ceab611962279b23fcf5fe90a50e783293d53ec8f1807817099be2c4713e92738fadbb15350179f71d576a12d8e8
|
@@ -8,22 +8,25 @@ module Datory
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def serialize(model) # rubocop:disable Metrics/MethodLength
|
11
|
+
context = send(:new, _datory_to_model: false)
|
12
|
+
|
11
13
|
if [Set, Array].include?(model.class)
|
12
14
|
model.map do |model_item|
|
13
15
|
serialize(model_item)
|
14
16
|
end
|
15
17
|
else
|
16
|
-
context = send(:new, _datory_to_model: false)
|
17
18
|
model = Datory::Attributes::Serialization::Model.prepare(model)
|
18
19
|
_serialize(context, model)
|
19
20
|
end
|
20
21
|
rescue Datory::Service::Exceptions::Input,
|
21
22
|
Datory::Service::Exceptions::Internal,
|
22
23
|
Datory::Service::Exceptions::Output => e
|
23
|
-
raise Datory::Exceptions::SerializationError.new(message: e.message)
|
24
|
+
raise Datory::Exceptions::SerializationError.new(context: e.send(:context), message: e.message)
|
24
25
|
end
|
25
26
|
|
26
27
|
def deserialize(data) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
28
|
+
context = send(:new, _datory_to_model: false)
|
29
|
+
|
27
30
|
prepared_data =
|
28
31
|
if data.is_a?(Datory::Base)
|
29
32
|
Datory::Attributes::Serialization::Model.to_hash(data)
|
@@ -38,19 +41,21 @@ module Datory
|
|
38
41
|
deserialize(item)
|
39
42
|
end
|
40
43
|
else
|
41
|
-
context = send(:new, _datory_to_model: false)
|
42
|
-
|
43
44
|
_deserialize(context, **prepared_data)
|
44
45
|
end
|
45
46
|
rescue Datory::Service::Exceptions::Input,
|
46
47
|
Datory::Service::Exceptions::Internal,
|
47
48
|
Datory::Service::Exceptions::Output => e
|
48
|
-
raise Datory::Exceptions::DeserializationError.new(message: e.message)
|
49
|
+
raise Datory::Exceptions::DeserializationError.new(context: e.send(:context), message: e.message)
|
49
50
|
rescue JSON::ParserError => e
|
50
51
|
# TODO: Needs to be moved to I18n
|
51
52
|
message = "Failed to parse data for deserialization: #{e.message}"
|
52
53
|
|
53
|
-
raise Datory::Exceptions::DeserializationError.new(
|
54
|
+
raise Datory::Exceptions::DeserializationError.new(
|
55
|
+
context: context,
|
56
|
+
message: message,
|
57
|
+
meta: { original_exception: e }
|
58
|
+
)
|
54
59
|
end
|
55
60
|
|
56
61
|
def new(_datory_to_model: true, **attributes) # rubocop:disable Lint/UnderscorePrefixedVariableName
|
@@ -3,6 +3,14 @@
|
|
3
3
|
module Datory
|
4
4
|
module Context
|
5
5
|
module Workspace
|
6
|
+
class Actor
|
7
|
+
attr_reader :class_name
|
8
|
+
|
9
|
+
def initialize(context)
|
10
|
+
@class_name = context.class.name
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
6
14
|
private
|
7
15
|
|
8
16
|
def merge!(attributes)
|
@@ -46,6 +54,11 @@ module Datory
|
|
46
54
|
def deserialize(**); end
|
47
55
|
|
48
56
|
def to_model(**); end
|
57
|
+
|
58
|
+
# NOTE: To maintain context compatibility in Servactory exceptions.
|
59
|
+
def servactory_service_info
|
60
|
+
@servactory_service_info ||= self.class::Actor.new(self)
|
61
|
+
end
|
49
62
|
end
|
50
63
|
end
|
51
64
|
end
|
data/lib/datory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09-
|
11
|
+
date: 2024-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '5.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '8.
|
22
|
+
version: '8.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '5.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '8.
|
32
|
+
version: '8.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: i18n
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.
|
53
|
+
version: 2.9.0.rc4
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 2.
|
60
|
+
version: 2.9.0.rc4
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: terminal-table
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -265,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
265
|
- !ruby/object:Gem::Version
|
266
266
|
version: '0'
|
267
267
|
requirements: []
|
268
|
-
rubygems_version: 3.5.
|
268
|
+
rubygems_version: 3.5.16
|
269
269
|
signing_key:
|
270
270
|
specification_version: 4
|
271
271
|
summary: A set of tools for building reliable services of any complexity
|