datory 2.2.0.rc2 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/datory/attributes/attribute.rb +1 -1
- data/lib/datory/attributes/descriptor.rb +1 -1
- data/lib/datory/attributes/dsl.rb +4 -4
- data/lib/datory/attributes/options/base.rb +6 -6
- data/lib/datory/attributes/options/from.rb +1 -1
- data/lib/datory/attributes/options/to.rb +3 -3
- data/lib/datory/attributes/serialization/serializator.rb +1 -1
- data/lib/datory/attributes/workspace.rb +2 -2
- data/lib/datory/console.rb +3 -3
- data/lib/datory/context/callable.rb +11 -11
- data/lib/datory/context/workspace.rb +7 -7
- data/lib/datory/service/builder.rb +8 -8
- data/lib/datory/version.rb +1 -1
- metadata +11 -53
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74e78021b06904cb98ca74df704b94917ea3fd7fb2ae29cfb81af23fe91e61a4
|
4
|
+
data.tar.gz: b998676031dfe827858d18b7a407558a25baaddc255ce2642257931c1f8dcbb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af624036d14873c08e9352f30676c7c4b5f61c42f63c9e0dd8545493ce1e44f2a502e2110cdb41b91e217022a1e5bff63ae30eca41f0dc32a8665064504a9e93
|
7
|
+
data.tar.gz: 1af640a6856fa520f76d1e6ef774dfca12f0b9e0712de5627092c9e12fbee0371f9df75a1db4af23a58321a5ed4c0ebabc60c1bc2ae2ede1e66c9e103f671b7f
|
@@ -7,7 +7,7 @@ module Datory
|
|
7
7
|
|
8
8
|
def initialize(name, **options) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
9
9
|
@from = Options::From.new(
|
10
|
-
name
|
10
|
+
name:,
|
11
11
|
type: options.fetch(:from),
|
12
12
|
consists_of: options.fetch(:consists_of, false),
|
13
13
|
min: options.fetch(:min, nil),
|
@@ -28,7 +28,7 @@ module Datory
|
|
28
28
|
name,
|
29
29
|
to: to.presence || name,
|
30
30
|
from: [include, Hash],
|
31
|
-
include
|
31
|
+
include:,
|
32
32
|
as: [include, Hash]
|
33
33
|
)
|
34
34
|
end
|
@@ -40,7 +40,7 @@ module Datory
|
|
40
40
|
name,
|
41
41
|
to: to.presence || name,
|
42
42
|
from: [include, Hash, NilClass],
|
43
|
-
include
|
43
|
+
include:,
|
44
44
|
as: [include, Hash, NilClass],
|
45
45
|
required: false
|
46
46
|
)
|
@@ -52,7 +52,7 @@ module Datory
|
|
52
52
|
to: to.presence || name,
|
53
53
|
from: Array,
|
54
54
|
consists_of: [include, Hash],
|
55
|
-
include
|
55
|
+
include:,
|
56
56
|
as: Array
|
57
57
|
)
|
58
58
|
end
|
@@ -65,7 +65,7 @@ module Datory
|
|
65
65
|
to: to.presence || name,
|
66
66
|
from: Array,
|
67
67
|
consists_of: [include, Hash],
|
68
|
-
include
|
68
|
+
include:,
|
69
69
|
as: Array,
|
70
70
|
required: false,
|
71
71
|
default: []
|
@@ -13,13 +13,13 @@ module Datory
|
|
13
13
|
|
14
14
|
format = format.fetch(:to, nil) if format.is_a?(Hash)
|
15
15
|
|
16
|
-
super(name
|
16
|
+
super(name:, type:, consists_of:, min:, max:, format:)
|
17
17
|
end
|
18
18
|
|
19
19
|
def info
|
20
20
|
super.merge(
|
21
|
-
required
|
22
|
-
default
|
21
|
+
required:,
|
22
|
+
default:,
|
23
23
|
include: include_class
|
24
24
|
)
|
25
25
|
end
|
@@ -5,7 +5,7 @@ module Datory
|
|
5
5
|
module Serialization
|
6
6
|
class Serializator
|
7
7
|
def self.serialize(model:, collection_of_attributes:)
|
8
|
-
new(collection_of_attributes:
|
8
|
+
new(collection_of_attributes:).serialize(model:)
|
9
9
|
end
|
10
10
|
|
11
11
|
def initialize(collection_of_attributes:)
|
@@ -13,8 +13,8 @@ module Datory
|
|
13
13
|
model = Serialization::ServiceBuilder.build!(self, model, collection_of_attributes)
|
14
14
|
|
15
15
|
Serialization::Serializator.serialize(
|
16
|
-
model
|
17
|
-
collection_of_attributes:
|
16
|
+
model:,
|
17
|
+
collection_of_attributes:
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
data/lib/datory/console.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Datory
|
4
4
|
module Context
|
5
|
-
module Callable
|
5
|
+
module Callable # rubocop:disable Metrics/ModuleLength
|
6
6
|
def form(model)
|
7
7
|
Datory::Attributes::Form.new(self, model)
|
8
8
|
end
|
@@ -52,8 +52,8 @@ module Datory
|
|
52
52
|
message = "Failed to parse data for deserialization: #{e.message}"
|
53
53
|
|
54
54
|
raise Datory::Exceptions::DeserializationError.new(
|
55
|
-
context
|
56
|
-
message
|
55
|
+
context:,
|
56
|
+
message:,
|
57
57
|
meta: { original_exception: e }
|
58
58
|
)
|
59
59
|
end
|
@@ -72,13 +72,13 @@ module Datory
|
|
72
72
|
|
73
73
|
direction = direction.to_s.inquiry
|
74
74
|
|
75
|
-
_to_model(context, direction
|
75
|
+
_to_model(context, direction:, **attributes)
|
76
76
|
end
|
77
77
|
|
78
78
|
def describe
|
79
79
|
Datory::Attributes::Descriptor.describe(
|
80
80
|
service_class_name: name,
|
81
|
-
collection_of_attributes:
|
81
|
+
collection_of_attributes:
|
82
82
|
)
|
83
83
|
end
|
84
84
|
alias table describe
|
@@ -100,8 +100,8 @@ module Datory
|
|
100
100
|
def _serialize(context, model)
|
101
101
|
context.send(
|
102
102
|
:_serialize,
|
103
|
-
model
|
104
|
-
collection_of_attributes:
|
103
|
+
model:,
|
104
|
+
collection_of_attributes:
|
105
105
|
)
|
106
106
|
end
|
107
107
|
|
@@ -109,16 +109,16 @@ module Datory
|
|
109
109
|
context.send(
|
110
110
|
:_deserialize,
|
111
111
|
incoming_attributes: attributes.symbolize_keys,
|
112
|
-
collection_of_attributes:
|
112
|
+
collection_of_attributes:
|
113
113
|
)
|
114
114
|
end
|
115
115
|
|
116
116
|
def _to_model(context, direction:, **attributes)
|
117
117
|
context.send(
|
118
118
|
:_to_model,
|
119
|
-
direction
|
120
|
-
attributes
|
121
|
-
collection_of_attributes:
|
119
|
+
direction:,
|
120
|
+
attributes:,
|
121
|
+
collection_of_attributes:
|
122
122
|
)
|
123
123
|
end
|
124
124
|
|
@@ -29,23 +29,23 @@ module Datory
|
|
29
29
|
|
30
30
|
def _serialize(model:, collection_of_attributes:)
|
31
31
|
serialize(
|
32
|
-
model
|
33
|
-
collection_of_attributes:
|
32
|
+
model:,
|
33
|
+
collection_of_attributes:
|
34
34
|
)
|
35
35
|
end
|
36
36
|
|
37
37
|
def _deserialize(incoming_attributes:, collection_of_attributes:)
|
38
38
|
deserialize(
|
39
|
-
incoming_attributes
|
40
|
-
collection_of_attributes:
|
39
|
+
incoming_attributes:,
|
40
|
+
collection_of_attributes:
|
41
41
|
)
|
42
42
|
end
|
43
43
|
|
44
44
|
def _to_model(direction:, attributes:, collection_of_attributes:)
|
45
45
|
to_model(
|
46
|
-
direction
|
47
|
-
attributes
|
48
|
-
collection_of_attributes:
|
46
|
+
direction:,
|
47
|
+
attributes:,
|
48
|
+
collection_of_attributes:
|
49
49
|
)
|
50
50
|
end
|
51
51
|
|
@@ -5,14 +5,14 @@ module Datory
|
|
5
5
|
class Builder < Base
|
6
6
|
TRANSFORMATIONS = {
|
7
7
|
SERIALIZATION: {
|
8
|
-
Symbol =>
|
9
|
-
String =>
|
10
|
-
Integer =>
|
11
|
-
Float =>
|
12
|
-
Date =>
|
13
|
-
Time =>
|
14
|
-
DateTime =>
|
15
|
-
ActiveSupport::Duration =>
|
8
|
+
Symbol => lambda(&:to_sym),
|
9
|
+
String => lambda(&:to_s),
|
10
|
+
Integer => lambda(&:to_i),
|
11
|
+
Float => lambda(&:to_f),
|
12
|
+
Date => lambda(&:to_s),
|
13
|
+
Time => lambda(&:to_s),
|
14
|
+
DateTime => lambda(&:to_s),
|
15
|
+
ActiveSupport::Duration => lambda(&:iso8601)
|
16
16
|
},
|
17
17
|
DESERIALIZATION: {
|
18
18
|
# NOTE: These types do not need to be cast automatically:
|
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.2.0
|
4
|
+
version: 2.2.0
|
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-
|
11
|
+
date: 2024-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 2.9.0
|
53
|
+
version: 2.9.0
|
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.9.0
|
60
|
+
version: 2.9.0
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: terminal-table
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,61 +143,19 @@ dependencies:
|
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '3.12'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
|
-
name: rubocop
|
146
|
+
name: servactory-rubocop
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
148
148
|
requirements:
|
149
|
-
- - "
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
version: '1.57'
|
152
|
-
type: :development
|
153
|
-
prerelease: false
|
154
|
-
version_requirements: !ruby/object:Gem::Requirement
|
155
|
-
requirements:
|
156
|
-
- - "~>"
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
version: '1.57'
|
159
|
-
- !ruby/object:Gem::Dependency
|
160
|
-
name: rubocop-performance
|
161
|
-
requirement: !ruby/object:Gem::Requirement
|
162
|
-
requirements:
|
163
|
-
- - "~>"
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '1.19'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
requirements:
|
170
|
-
- - "~>"
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: '1.19'
|
173
|
-
- !ruby/object:Gem::Dependency
|
174
|
-
name: rubocop-rake
|
175
|
-
requirement: !ruby/object:Gem::Requirement
|
176
|
-
requirements:
|
177
|
-
- - "~>"
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: '0.6'
|
180
|
-
type: :development
|
181
|
-
prerelease: false
|
182
|
-
version_requirements: !ruby/object:Gem::Requirement
|
183
|
-
requirements:
|
184
|
-
- - "~>"
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
version: '0.6'
|
187
|
-
- !ruby/object:Gem::Dependency
|
188
|
-
name: rubocop-rspec
|
189
|
-
requirement: !ruby/object:Gem::Requirement
|
190
|
-
requirements:
|
191
|
-
- - "~>"
|
149
|
+
- - ">="
|
192
150
|
- !ruby/object:Gem::Version
|
193
|
-
version: '
|
151
|
+
version: '0.5'
|
194
152
|
type: :development
|
195
153
|
prerelease: false
|
196
154
|
version_requirements: !ruby/object:Gem::Requirement
|
197
155
|
requirements:
|
198
|
-
- - "
|
156
|
+
- - ">="
|
199
157
|
- !ruby/object:Gem::Version
|
200
|
-
version: '
|
158
|
+
version: '0.5'
|
201
159
|
description: A set of tools for building reliable services of any complexity
|
202
160
|
email:
|
203
161
|
- profox.rus@gmail.com
|
@@ -258,14 +216,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
258
216
|
requirements:
|
259
217
|
- - ">="
|
260
218
|
- !ruby/object:Gem::Version
|
261
|
-
version: 3.
|
219
|
+
version: 3.1.0
|
262
220
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
263
221
|
requirements:
|
264
222
|
- - ">="
|
265
223
|
- !ruby/object:Gem::Version
|
266
224
|
version: '0'
|
267
225
|
requirements: []
|
268
|
-
rubygems_version: 3.5.
|
226
|
+
rubygems_version: 3.5.22
|
269
227
|
signing_key:
|
270
228
|
specification_version: 4
|
271
229
|
summary: A set of tools for building reliable services of any complexity
|