protobuf-activerecord 6.1.0 → 7.0.0
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/.rubocop.yml +5 -26
- data/.standard.yml +2 -0
- data/Rakefile +2 -5
- data/lib/protobuf/active_record/attribute_methods.rb +2 -2
- data/lib/protobuf/active_record/columns.rb +3 -4
- data/lib/protobuf/active_record/middleware/connection_management_async.rb +2 -3
- data/lib/protobuf/active_record/middleware/query_cache.rb +1 -3
- data/lib/protobuf/active_record/scope.rb +10 -10
- data/lib/protobuf/active_record/serialization.rb +29 -33
- data/lib/protobuf/active_record/transformation.rb +22 -25
- data/lib/protobuf/active_record/transformer.rb +1 -1
- data/lib/protobuf/active_record/version.rb +1 -1
- data/protobuf-activerecord.gemspec +21 -17
- data/spec/protobuf/active_record/columns_spec.rb +2 -4
- data/spec/protobuf/active_record/nested_attributes_spec.rb +3 -3
- data/spec/protobuf/active_record/persistence_spec.rb +2 -2
- data/spec/protobuf/active_record/scope_spec.rb +30 -30
- data/spec/protobuf/active_record/serialization_spec.rb +15 -15
- data/spec/protobuf/active_record/transformation_spec.rb +13 -13
- data/spec/protobuf/active_record/transformer_spec.rb +2 -2
- data/spec/support/db/setup.rb +5 -5
- data/spec/support/models/user.rb +3 -3
- data/spec/support/protobuf/messages.pb.rb +4 -7
- metadata +21 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b362902e62f6e87a34d62a4177c774403b83cdfd258b8880f9f905321713cd0d
|
4
|
+
data.tar.gz: fa45265bea9a946f4d4cb5c32e651594ce2053085214e4418dd6ec0ff19a1b5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9900f4e2338cdc2029be1234def0f48ce1c5e61989c3c0d8e98309f0f701a7ded62f92a1270c90adb2fce154db6cb6c492c72a3c670361179c1bdacb8f5705c
|
7
|
+
data.tar.gz: 6c0e52dfe1785c7c271dbb9e21934b8a7381870df4e569742ba01a51f44d76737fbb9fe216f414fedbaf8b27948750abb2e61663f6665bc79a7ca2203087cf7c
|
data/.rubocop.yml
CHANGED
@@ -1,28 +1,7 @@
|
|
1
|
-
|
1
|
+
require:
|
2
|
+
# Standard's config uses custom cops, so it must be loaded
|
3
|
+
- standard
|
2
4
|
|
3
5
|
inherit_gem:
|
4
|
-
|
5
|
-
|
6
|
-
# Styles that are modified from the defaults
|
7
|
-
AllCops:
|
8
|
-
TargetRubyVersion: 2.5
|
9
|
-
Exclude:
|
10
|
-
- "**/*.pb.rb"
|
11
|
-
|
12
|
-
Style/BlockDelimiters:
|
13
|
-
Description: >-
|
14
|
-
Avoid using {...} for multi-line blocks (multiline chaining is always ugly).
|
15
|
-
Prefer {...} over do...end for single-line blocks.
|
16
|
-
Exclude:
|
17
|
-
- "spec/**/*"
|
18
|
-
|
19
|
-
Style/HashSyntax:
|
20
|
-
Description: >-
|
21
|
-
Prefer Ruby 1.8 hash syntax { :a => 1, :b => 2 } over 1.9 syntax { a: 1, b: 2 }.
|
22
|
-
EnforcedStyle: hash_rockets
|
23
|
-
Exclude:
|
24
|
-
- "Gemfile"
|
25
|
-
|
26
|
-
Layout/SpaceAroundOperators:
|
27
|
-
Exclude:
|
28
|
-
- "*.gemspec"
|
6
|
+
standard: config/base.yml
|
7
|
+
standard-performance: config.base.yml
|
data/.standard.yml
ADDED
data/Rakefile
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "protobuf/tasks"
|
3
3
|
require "rspec/core/rake_task"
|
4
|
-
require "
|
5
|
-
|
6
|
-
desc "Run cops"
|
7
|
-
::RuboCop::RakeTask.new(:rubocop)
|
4
|
+
require "standard/rake"
|
8
5
|
|
9
6
|
desc "Run specs"
|
10
7
|
::RSpec::Core::RakeTask.new(:spec)
|
11
8
|
|
12
9
|
desc "Run cops and specs (default)"
|
13
|
-
task :
|
10
|
+
task default: [:standard, :spec]
|
14
11
|
|
15
12
|
desc "Remove protobuf definitions that have been compiled"
|
16
13
|
task :clean do
|
@@ -18,7 +18,7 @@ module Protobuf
|
|
18
18
|
value = proto.__send__(:"#{field_alias}!")
|
19
19
|
value ||= proto.__send__(:"#{attribute}!") if proto.respond_to?(attribute)
|
20
20
|
|
21
|
-
|
21
|
+
_protobuf_convert_fields_to_attributes(attribute, value)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -26,7 +26,7 @@ module Protobuf
|
|
26
26
|
lambda do |record|
|
27
27
|
value = record.__send__(field_alias)
|
28
28
|
|
29
|
-
|
29
|
+
_protobuf_convert_attributes_to_fields(attribute, value)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require "set"
|
2
2
|
require "active_support/concern"
|
3
|
-
require "thread"
|
4
3
|
|
5
4
|
module Protobuf
|
6
5
|
module ActiveRecord
|
@@ -14,9 +13,9 @@ module Protobuf
|
|
14
13
|
include ::Heredity
|
15
14
|
|
16
15
|
inheritable_attributes :_protobuf_columns,
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
:_protobuf_column_types,
|
17
|
+
:_protobuf_date_datetime_time_or_timestamp_column,
|
18
|
+
:_protobuf_mapped_columns
|
20
19
|
end
|
21
20
|
|
22
21
|
module ClassMethods
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require "concurrent"
|
2
|
-
require "thread"
|
3
2
|
|
4
3
|
module Protobuf
|
5
4
|
module ActiveRecord
|
@@ -13,8 +12,8 @@ module Protobuf
|
|
13
12
|
return if timed_task_started.true?
|
14
13
|
|
15
14
|
args = {
|
16
|
-
:
|
17
|
-
:
|
15
|
+
execution_interval: ::Protobuf::ActiveRecord.config.connection_reaping_interval,
|
16
|
+
timeout_interval: ::Protobuf::ActiveRecord.config.connection_reaping_timeout_interval
|
18
17
|
}
|
19
18
|
timed_task = ::Concurrent::TimerTask.new(args) do
|
20
19
|
::ActiveRecord::Base.clear_active_connections!
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require "thread"
|
2
|
-
|
3
1
|
module Protobuf
|
4
2
|
module ActiveRecord
|
5
3
|
module Middleware
|
@@ -20,7 +18,7 @@ module Protobuf
|
|
20
18
|
restore_query_cache_settings(enabled)
|
21
19
|
end
|
22
20
|
|
23
|
-
|
21
|
+
private
|
24
22
|
|
25
23
|
def restore_query_cache_settings(enabled)
|
26
24
|
::Thread.current[CURRENT_CONNECTION].clear_query_cache
|
@@ -42,11 +42,11 @@ module Protobuf
|
|
42
42
|
#
|
43
43
|
def field_scope(field, options = {})
|
44
44
|
scope_name = if options.include?(:scope)
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
options[:scope]
|
46
|
+
else
|
47
|
+
# When no scope is defined, assume the scope is the field, prefixed with `by_`
|
48
|
+
:"by_#{field}"
|
49
|
+
end
|
50
50
|
searchable_fields[field] = scope_name
|
51
51
|
|
52
52
|
searchable_field_parsers[field] = options[:parser] if options[:parser]
|
@@ -56,7 +56,7 @@ module Protobuf
|
|
56
56
|
# use `all` instead of `scoped`.
|
57
57
|
# :noapi:
|
58
58
|
def model_scope
|
59
|
-
::ActiveRecord::VERSION::MAJOR >= 4 ? all : scoped
|
59
|
+
(::ActiveRecord::VERSION::MAJOR >= 4) ? all : scoped
|
60
60
|
end
|
61
61
|
|
62
62
|
# :noapi:
|
@@ -66,10 +66,10 @@ module Protobuf
|
|
66
66
|
if searchable_field_parsers[field]
|
67
67
|
parser = searchable_field_parsers[field]
|
68
68
|
|
69
|
-
if parser.respond_to?(:to_sym)
|
70
|
-
|
69
|
+
value = if parser.respond_to?(:to_sym)
|
70
|
+
__send__(parser.to_sym, value)
|
71
71
|
else
|
72
|
-
|
72
|
+
parser.call(value)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -99,7 +99,7 @@ module Protobuf
|
|
99
99
|
search_relation = search_relation.__send__(scope_name, *search_values)
|
100
100
|
end
|
101
101
|
|
102
|
-
|
102
|
+
search_relation
|
103
103
|
end
|
104
104
|
|
105
105
|
# :noapi:
|
@@ -9,9 +9,9 @@ module Protobuf
|
|
9
9
|
included do
|
10
10
|
class << self
|
11
11
|
attr_writer :_protobuf_field_symbol_transformers,
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
:_protobuf_field_transformers,
|
13
|
+
:_protobuf_field_options,
|
14
|
+
:protobuf_message
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -33,24 +33,20 @@ module Protobuf
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def _protobuf_message_deprecated_fields
|
36
|
-
@_protobuf_message_deprecated_fields ||=
|
37
|
-
|
38
|
-
|
39
|
-
next unless field.deprecated?
|
36
|
+
@_protobuf_message_deprecated_fields ||= protobuf_message.all_fields.map do |field|
|
37
|
+
next if field.nil?
|
38
|
+
next unless field.deprecated?
|
40
39
|
|
41
|
-
|
42
|
-
end
|
40
|
+
field.name.to_sym
|
43
41
|
end
|
44
42
|
end
|
45
43
|
|
46
44
|
def _protobuf_message_non_deprecated_fields
|
47
|
-
@_protobuf_message_non_deprecated_fields ||=
|
48
|
-
|
49
|
-
|
50
|
-
next if field.deprecated?
|
45
|
+
@_protobuf_message_non_deprecated_fields ||= protobuf_message.all_fields.map do |field|
|
46
|
+
next if field.nil?
|
47
|
+
next if field.deprecated?
|
51
48
|
|
52
|
-
|
53
|
-
end
|
49
|
+
field.name.to_sym
|
54
50
|
end
|
55
51
|
end
|
56
52
|
|
@@ -147,7 +143,7 @@ module Protobuf
|
|
147
143
|
def call(selph)
|
148
144
|
selph.__send__(@method_name).to_a
|
149
145
|
rescue NameError # Has happened when field is not on model or ignored from db
|
150
|
-
|
146
|
+
nil
|
151
147
|
end
|
152
148
|
end
|
153
149
|
|
@@ -167,7 +163,7 @@ module Protobuf
|
|
167
163
|
value.to_time(:utc).to_i
|
168
164
|
end
|
169
165
|
rescue NameError # Has happened when field is not on model or ignored from db
|
170
|
-
|
166
|
+
nil
|
171
167
|
end
|
172
168
|
end
|
173
169
|
|
@@ -181,7 +177,7 @@ module Protobuf
|
|
181
177
|
|
182
178
|
value&.to_i
|
183
179
|
rescue NameError # Has happened when field is not on model or ignored from db
|
184
|
-
|
180
|
+
nil
|
185
181
|
end
|
186
182
|
end
|
187
183
|
|
@@ -193,7 +189,7 @@ module Protobuf
|
|
193
189
|
def call(selph)
|
194
190
|
selph.__send__(@field)
|
195
191
|
rescue NameError # Has happened when field is not on model or ignored from db
|
196
|
-
|
192
|
+
nil
|
197
193
|
end
|
198
194
|
end
|
199
195
|
|
@@ -325,21 +321,21 @@ module Protobuf
|
|
325
321
|
|
326
322
|
# :nodoc:
|
327
323
|
def _protobuf_field_objects(field)
|
328
|
-
self.class._protobuf_field_objects[field] ||=
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
self.class._protobuf_convert_to_fields_object(field)
|
339
|
-
end
|
324
|
+
self.class._protobuf_field_objects[field] ||= if _protobuf_field_symbol_transformers.key?(field)
|
325
|
+
|
326
|
+
self.class._protobuf_symbol_transformer_object(field)
|
327
|
+
elsif _protobuf_field_transformers.key?(field)
|
328
|
+
|
329
|
+
self.class._protobuf_field_transformer_object(field)
|
330
|
+
elsif respond_to?(field)
|
331
|
+
|
332
|
+
if _is_collection_association?(field)
|
333
|
+
self.class._protobuf_collection_association_object(field)
|
340
334
|
else
|
341
|
-
self.class.
|
335
|
+
self.class._protobuf_convert_to_fields_object(field)
|
342
336
|
end
|
337
|
+
else
|
338
|
+
self.class._protobuf_nil_object(field)
|
343
339
|
end
|
344
340
|
end
|
345
341
|
|
@@ -362,7 +358,7 @@ module Protobuf
|
|
362
358
|
def to_proto(options = {})
|
363
359
|
raise MessageNotDefined, self.class if _protobuf_message.nil?
|
364
360
|
|
365
|
-
fields =
|
361
|
+
fields = fields_from_record(options)
|
366
362
|
_protobuf_message.new(fields)
|
367
363
|
end
|
368
364
|
end
|
@@ -35,23 +35,21 @@ module Protobuf
|
|
35
35
|
|
36
36
|
filtered_attributes = _filtered_attributes + _protobuf_attribute_transformers.keys
|
37
37
|
|
38
|
-
attribute_fields = filtered_attributes.
|
38
|
+
attribute_fields = filtered_attributes.each_with_object({}) do |column_name, hash|
|
39
39
|
symbolized_column = column_name.to_sym
|
40
40
|
|
41
41
|
if fields.key?(symbolized_column) || _protobuf_attribute_transformers.key?(symbolized_column)
|
42
42
|
hash[symbolized_column] = fields[symbolized_column]
|
43
43
|
end
|
44
|
-
|
45
|
-
hash
|
46
44
|
end
|
47
45
|
|
48
46
|
_protobuf_nested_attributes.each do |attribute_name|
|
49
|
-
nested_attribute_name = "#{attribute_name}_attributes"
|
47
|
+
nested_attribute_name = :"#{attribute_name}_attributes"
|
50
48
|
value = if proto.field?(nested_attribute_name)
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
49
|
+
proto.__send__(nested_attribute_name)
|
50
|
+
elsif proto.field?(attribute_name)
|
51
|
+
proto.__send__(attribute_name)
|
52
|
+
end
|
55
53
|
|
56
54
|
next unless value
|
57
55
|
attribute_fields[nested_attribute_name] = value
|
@@ -64,7 +62,7 @@ module Protobuf
|
|
64
62
|
#
|
65
63
|
# :nodoc:
|
66
64
|
def _filtered_attributes
|
67
|
-
|
65
|
+
attribute_names
|
68
66
|
end
|
69
67
|
|
70
68
|
# :nodoc:
|
@@ -72,18 +70,19 @@ module Protobuf
|
|
72
70
|
return nil if value.nil?
|
73
71
|
return value unless _protobuf_date_datetime_time_or_timestamp_column?(key)
|
74
72
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
73
|
+
if _protobuf_datetime_column?(key)
|
74
|
+
|
75
|
+
convert_int64_to_datetime(value)
|
76
|
+
elsif _protobuf_timestamp_column?(key)
|
77
|
+
|
78
|
+
convert_int64_to_time(value)
|
79
|
+
elsif _protobuf_time_column?(key)
|
80
|
+
|
81
|
+
convert_int64_to_time(value)
|
82
|
+
elsif _protobuf_date_column?(key)
|
83
|
+
|
84
|
+
convert_int64_to_date(value)
|
85
|
+
end
|
87
86
|
end
|
88
87
|
|
89
88
|
# Define an attribute transformation from protobuf. Accepts a Symbol,
|
@@ -113,7 +112,7 @@ module Protobuf
|
|
113
112
|
symbol_or_block = args.first || block
|
114
113
|
|
115
114
|
if symbol_or_block.is_a?(Symbol)
|
116
|
-
callable = lambda { |value|
|
115
|
+
callable = lambda { |value| __send__(symbol_or_block, value) }
|
117
116
|
else
|
118
117
|
raise AttributeTransformerError unless symbol_or_block.respond_to?(:call)
|
119
118
|
callable = symbol_or_block
|
@@ -138,7 +137,7 @@ module Protobuf
|
|
138
137
|
def attributes_from_proto(proto)
|
139
138
|
attribute_fields = _filter_attribute_fields(proto)
|
140
139
|
|
141
|
-
attributes = attribute_fields.
|
140
|
+
attributes = attribute_fields.each_with_object({}) do |(key, value), hash|
|
142
141
|
if _protobuf_attribute_transformers.key?(key)
|
143
142
|
transformer = _protobuf_attribute_transformers[key]
|
144
143
|
attribute = transformer.call(proto)
|
@@ -147,8 +146,6 @@ module Protobuf
|
|
147
146
|
else
|
148
147
|
hash[key] = _protobuf_convert_fields_to_attributes(key, value)
|
149
148
|
end
|
150
|
-
|
151
|
-
hash
|
152
149
|
end
|
153
150
|
|
154
151
|
return attributes unless proto.field?(:nullify) && proto.nullify.is_a?(Array)
|
@@ -1,29 +1,26 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
1
|
lib = File.expand_path("../lib", __FILE__)
|
4
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
3
|
require "protobuf/active_record/version"
|
6
4
|
|
7
5
|
Gem::Specification.new do |spec|
|
8
|
-
spec.name
|
9
|
-
spec.version
|
10
|
-
spec.authors
|
11
|
-
spec.email
|
12
|
-
spec.homepage
|
13
|
-
spec.summary
|
14
|
-
spec.description
|
15
|
-
spec.license
|
6
|
+
spec.name = "protobuf-activerecord"
|
7
|
+
spec.version = Protobuf::ActiveRecord::VERSION
|
8
|
+
spec.authors = ["Adam Hutchison"]
|
9
|
+
spec.email = ["liveh2o@gmail.com"]
|
10
|
+
spec.homepage = "http://github.com/liveh2o/protobuf-activerecord"
|
11
|
+
spec.summary = "Google Protocol Buffers integration for Active Record"
|
12
|
+
spec.description = "Provides the ability to create Active Record objects from Protocol Buffer messages and vice versa."
|
13
|
+
spec.license = "MIT"
|
16
14
|
|
17
|
-
spec.files
|
18
|
-
spec.executables
|
19
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
15
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
20
17
|
spec.require_paths = ["lib"]
|
21
18
|
|
22
19
|
##
|
23
20
|
# Dependencies
|
24
21
|
#
|
25
|
-
spec.add_dependency "activerecord", "~>
|
26
|
-
spec.add_dependency "activesupport", "~>
|
22
|
+
spec.add_dependency "activerecord", "~> 7.0.0"
|
23
|
+
spec.add_dependency "activesupport", "~> 7.0.0"
|
27
24
|
spec.add_dependency "concurrent-ruby"
|
28
25
|
spec.add_dependency "heredity", ">= 0.1.1"
|
29
26
|
spec.add_dependency "protobuf", ">= 3.0"
|
@@ -32,12 +29,19 @@ Gem::Specification.new do |spec|
|
|
32
29
|
# Development dependencies
|
33
30
|
#
|
34
31
|
spec.add_development_dependency "benchmark-ips"
|
35
|
-
spec.add_development_dependency "mad_rubocop"
|
36
32
|
spec.add_development_dependency "rake"
|
37
33
|
spec.add_development_dependency "rspec", ">= 3.3.0"
|
38
34
|
spec.add_development_dependency "rspec-pride", ">= 3.1.0"
|
39
35
|
spec.add_development_dependency "pry-nav"
|
40
36
|
spec.add_development_dependency "simplecov"
|
41
|
-
spec.add_development_dependency "
|
37
|
+
spec.add_development_dependency "standard"
|
38
|
+
|
39
|
+
if ENV["PLATFORM"] == "java" || ::RUBY_PLATFORM == "java"
|
40
|
+
spec.platform = "java"
|
41
|
+
spec.add_development_dependency "activerecord-jdbcsqlite3-adapter"
|
42
|
+
else
|
43
|
+
spec.add_development_dependency "sqlite3", ">= 1.4"
|
44
|
+
end
|
45
|
+
|
42
46
|
spec.add_development_dependency "timecop"
|
43
47
|
end
|
@@ -4,17 +4,15 @@ describe Protobuf::ActiveRecord::Columns do
|
|
4
4
|
describe "._protobuf_map_columns" do
|
5
5
|
context "when the class has a table" do
|
6
6
|
let(:expected_column_names) {
|
7
|
-
User.columns.
|
7
|
+
User.columns.each_with_object({}) do |column, hash|
|
8
8
|
hash[column.name.to_sym] = column
|
9
|
-
hash
|
10
9
|
end
|
11
10
|
}
|
12
11
|
|
13
12
|
let(:expected_column_types) {
|
14
|
-
User.columns.
|
13
|
+
User.columns.each_with_object({}) do |column, hash|
|
15
14
|
hash[column.type.to_sym] ||= ::Set.new
|
16
15
|
hash[column.type.to_sym] << column.name.to_sym
|
17
|
-
hash
|
18
16
|
end
|
19
17
|
}
|
20
18
|
|
@@ -2,10 +2,10 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Protobuf::ActiveRecord::NestedAttributes do
|
4
4
|
let(:user_message) {
|
5
|
-
UserMessage.new(:
|
5
|
+
UserMessage.new(name: "foo bar", email: "foo@test.co", photos: [{url: "https://test.co/test.png"}])
|
6
6
|
}
|
7
7
|
|
8
|
-
describe "._filter_attribute_fields", :
|
8
|
+
describe "._filter_attribute_fields", aggregate_failures: true do
|
9
9
|
it "includes nested attributes" do
|
10
10
|
attribute_fields = User._filter_attribute_fields(user_message)
|
11
11
|
expect(attribute_fields[:photos_attributes]).to eq(user_message.photos)
|
@@ -17,7 +17,7 @@ describe Protobuf::ActiveRecord::NestedAttributes do
|
|
17
17
|
|
18
18
|
describe ".new" do
|
19
19
|
context "when a model accepts nested attributes" do
|
20
|
-
it "transforms nested attributes", :
|
20
|
+
it "transforms nested attributes", aggregate_failures: true do
|
21
21
|
user_message.photos.each do |photo_message|
|
22
22
|
expect(Photo).to receive(:attributes_from_proto).with(photo_message).and_call_original
|
23
23
|
end
|
@@ -2,8 +2,8 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Protobuf::ActiveRecord::Persistence do
|
4
4
|
let(:user) { User.new(user_attributes) }
|
5
|
-
let(:user_attributes) { {
|
6
|
-
let(:proto_hash) { {
|
5
|
+
let(:user_attributes) { {first_name: "foo", last_name: "bar", email: "foo@test.co"} }
|
6
|
+
let(:proto_hash) { {name: "foo bar", email: "foo@test.co"} }
|
7
7
|
let(:proto) { UserMessage.new(proto_hash) }
|
8
8
|
|
9
9
|
describe ".create" do
|
@@ -1,26 +1,34 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
+
class TheEnum < ::Protobuf::Enum
|
4
|
+
define :VALUE, 1
|
5
|
+
end
|
6
|
+
|
7
|
+
class TheMessage < ::Protobuf::Message
|
8
|
+
optional TheEnum, :the_enum_value, 1
|
9
|
+
end
|
10
|
+
|
3
11
|
describe Protobuf::ActiveRecord::Scope do
|
4
12
|
before do
|
5
|
-
@field_parsers = User.instance_variable_get(
|
6
|
-
@fields = User.instance_variable_get(
|
13
|
+
@field_parsers = User.instance_variable_get(:@_searchable_field_parsers)
|
14
|
+
@fields = User.instance_variable_get(:@_searchable_fields)
|
7
15
|
end
|
8
16
|
|
9
17
|
after do
|
10
|
-
User.instance_variable_set(
|
11
|
-
User.instance_variable_set(
|
12
|
-
User.instance_variable_set(
|
18
|
+
User.instance_variable_set(:@_searchable_field_parsers, @field_parsers)
|
19
|
+
User.instance_variable_set(:@_searchable_fields, @fields)
|
20
|
+
User.instance_variable_set(:@_upsert_keys, [])
|
13
21
|
end
|
14
22
|
|
15
23
|
describe ".search_scope" do
|
16
|
-
let(:request) { UserSearchMessage.new(:
|
24
|
+
let(:request) { UserSearchMessage.new(guid: ["foo"], email: ["foo@test.co"]) }
|
17
25
|
|
18
26
|
before {
|
19
|
-
allow(User).to receive(:searchable_field_parsers).and_return(:
|
27
|
+
allow(User).to receive(:searchable_field_parsers).and_return(email: proc { |val| val })
|
20
28
|
}
|
21
29
|
|
22
30
|
it "builds scopes for searchable fields" do
|
23
|
-
allow(User).to receive(:searchable_fields).and_return(:
|
31
|
+
allow(User).to receive(:searchable_fields).and_return(email: :by_email)
|
24
32
|
expect(User.search_scope(request)).to eq User.by_email("foo@test.co")
|
25
33
|
end
|
26
34
|
|
@@ -29,19 +37,19 @@ describe Protobuf::ActiveRecord::Scope do
|
|
29
37
|
end
|
30
38
|
|
31
39
|
context "when a searchable field does not have a value" do
|
32
|
-
let(:request) { UserSearchMessage.new(:
|
40
|
+
let(:request) { UserSearchMessage.new(email: ["foo@test.co"]) }
|
33
41
|
|
34
42
|
it "doesn't build a scope from that field" do
|
35
|
-
allow(User).to receive(:searchable_fields).and_return(:
|
43
|
+
allow(User).to receive(:searchable_fields).and_return(email: :by_email)
|
36
44
|
expect(User.search_scope(request)).to eq User.by_email("foo@test.co")
|
37
45
|
end
|
38
46
|
end
|
39
47
|
|
40
48
|
context "when a searchable field uses a non-existant scope" do
|
41
|
-
let(:request) { UserSearchMessage.new(:
|
49
|
+
let(:request) { UserSearchMessage.new(email: ["foo@test.co"]) }
|
42
50
|
|
43
51
|
it "raises an exception" do
|
44
|
-
allow(User).to receive(:searchable_fields).and_return(:
|
52
|
+
allow(User).to receive(:searchable_fields).and_return(email: :by_hullabaloo)
|
45
53
|
expect { User.search_scope(request) }.to raise_exception(/undefined method .*by_hullabaloo/i)
|
46
54
|
end
|
47
55
|
end
|
@@ -57,7 +65,7 @@ describe Protobuf::ActiveRecord::Scope do
|
|
57
65
|
|
58
66
|
context "when :scope is defined" do
|
59
67
|
it "defines the given field as searchable using the given :scope" do
|
60
|
-
User.field_scope :guid, :
|
68
|
+
User.field_scope :guid, scope: :custom_scope
|
61
69
|
expect(User.searchable_fields[:guid]).to eq :custom_scope
|
62
70
|
end
|
63
71
|
end
|
@@ -71,7 +79,7 @@ describe Protobuf::ActiveRecord::Scope do
|
|
71
79
|
|
72
80
|
context "when :parser is defined" do
|
73
81
|
it "defines the given field as parseable using the given :parser" do
|
74
|
-
User.field_scope :guid, :
|
82
|
+
User.field_scope :guid, parser: :parser
|
75
83
|
expect(User.searchable_field_parsers[:guid]).to eq :parser
|
76
84
|
end
|
77
85
|
end
|
@@ -79,16 +87,16 @@ describe Protobuf::ActiveRecord::Scope do
|
|
79
87
|
|
80
88
|
describe ".parse_search_values" do
|
81
89
|
it "converts single values to collections" do
|
82
|
-
proto = UserMessage.new(:
|
90
|
+
proto = UserMessage.new(email: "the.email@test.in")
|
83
91
|
|
84
92
|
User.field_scope :email
|
85
93
|
expect(User.parse_search_values(proto, :email)).to eq ["the.email@test.in"]
|
86
94
|
end
|
87
95
|
|
88
96
|
context "when a field parser is defined" do
|
89
|
-
before { User.field_scope :guid, :
|
97
|
+
before { User.field_scope :guid, parser: parser }
|
90
98
|
|
91
|
-
let(:proto) { UserSearchMessage.new(:
|
99
|
+
let(:proto) { UserSearchMessage.new(guid: ["foo"]) }
|
92
100
|
|
93
101
|
context "and the parser does not respond to :to_sym" do
|
94
102
|
let(:parser) { double("parser") }
|
@@ -102,15 +110,7 @@ describe Protobuf::ActiveRecord::Scope do
|
|
102
110
|
|
103
111
|
context "when the field is an enum" do
|
104
112
|
it "maps values to integers" do
|
105
|
-
|
106
|
-
define :VALUE, 1
|
107
|
-
end
|
108
|
-
|
109
|
-
TheMessage = Class.new(::Protobuf::Message) do
|
110
|
-
optional TheEnum, :the_enum_value, 1
|
111
|
-
end
|
112
|
-
|
113
|
-
proto = TheMessage.new(:the_enum_value => TheEnum::VALUE)
|
113
|
+
proto = TheMessage.new(the_enum_value: TheEnum::VALUE)
|
114
114
|
expect(User.parse_search_values(proto, :the_enum_value)[0]).to be 1
|
115
115
|
end
|
116
116
|
end
|
@@ -132,7 +132,7 @@ describe Protobuf::ActiveRecord::Scope do
|
|
132
132
|
|
133
133
|
describe ".for_upsert" do
|
134
134
|
let(:guid) { "USR-1" }
|
135
|
-
let(:proto) { ::UserMessage.new(:
|
135
|
+
let(:proto) { ::UserMessage.new(guid: guid) }
|
136
136
|
|
137
137
|
before do
|
138
138
|
::User.delete_all
|
@@ -156,7 +156,7 @@ describe Protobuf::ActiveRecord::Scope do
|
|
156
156
|
end
|
157
157
|
|
158
158
|
context "existing record" do
|
159
|
-
before { ::User.create(:
|
159
|
+
before { ::User.create(guid: guid) }
|
160
160
|
after { ::User.delete_all }
|
161
161
|
|
162
162
|
it "returns the existing record" do
|
@@ -168,7 +168,7 @@ describe Protobuf::ActiveRecord::Scope do
|
|
168
168
|
|
169
169
|
describe ".upsert" do
|
170
170
|
let(:guid) { "USR-1" }
|
171
|
-
let(:proto) { ::UserMessage.new(:
|
171
|
+
let(:proto) { ::UserMessage.new(guid: guid, email: "bar") }
|
172
172
|
|
173
173
|
before do
|
174
174
|
::User.delete_all
|
@@ -184,7 +184,7 @@ describe Protobuf::ActiveRecord::Scope do
|
|
184
184
|
end
|
185
185
|
|
186
186
|
context "existing record" do
|
187
|
-
before { ::User.create(:
|
187
|
+
before { ::User.create(guid: guid, email: "foo") }
|
188
188
|
after { ::User.delete_all }
|
189
189
|
|
190
190
|
it "updates the existing record" do
|
@@ -24,7 +24,7 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
24
24
|
end
|
25
25
|
|
26
26
|
context "when the given transformer is callable" do
|
27
|
-
let(:callable) { lambda { |_proto|
|
27
|
+
let(:callable) { lambda { |_proto| } }
|
28
28
|
|
29
29
|
before {
|
30
30
|
allow(User).to receive(:_protobuf_field_transformers).and_return({})
|
@@ -38,7 +38,7 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
describe ".protobuf_message" do
|
41
|
-
let(:options) { {
|
41
|
+
let(:options) { {only: []} }
|
42
42
|
|
43
43
|
before { User.protobuf_message(protobuf_message, options) }
|
44
44
|
after { User.protobuf_message(protobuf_message, {}) }
|
@@ -69,14 +69,14 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
69
69
|
describe "#_filter_field_attributes" do
|
70
70
|
context "when options has :only" do
|
71
71
|
it "only returns the given field(s)" do
|
72
|
-
fields = user._filter_field_attributes(:
|
72
|
+
fields = user._filter_field_attributes(only: :name)
|
73
73
|
expect(fields).to eq [:name]
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
77
|
context "when options has :except" do
|
78
78
|
it "returns all except the given field(s)" do
|
79
|
-
fields = user._filter_field_attributes(:
|
79
|
+
fields = user._filter_field_attributes(except: :name)
|
80
80
|
expect(fields).to match_array(
|
81
81
|
[:guid, :email, :email_domain, :password, :nullify, :photos, :created_at, :updated_at]
|
82
82
|
)
|
@@ -93,7 +93,7 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
93
93
|
|
94
94
|
context "given :deprecated => false" do
|
95
95
|
it "filters all deprecated fields" do
|
96
|
-
fields = user._filtered_fields(:
|
96
|
+
fields = user._filtered_fields(deprecated: false)
|
97
97
|
expect(fields).to match_array(
|
98
98
|
[:guid, :name, :email, :password, :nullify, :photos, :created_at, :updated_at]
|
99
99
|
)
|
@@ -101,7 +101,7 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
101
101
|
|
102
102
|
context "and :include => :email_domain" do
|
103
103
|
it "includes deprecated fields that have been explicitly specified" do
|
104
|
-
fields = user._filtered_fields(:
|
104
|
+
fields = user._filtered_fields(deprecated: false, include: :email_domain)
|
105
105
|
expect(fields).to match_array(
|
106
106
|
[:guid, :name, :email, :email_domain, :password, :nullify, :photos, :created_at, :updated_at]
|
107
107
|
)
|
@@ -111,7 +111,7 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
describe "#_normalize_options" do
|
114
|
-
let(:options) { {
|
114
|
+
let(:options) { {only: [:name]} }
|
115
115
|
|
116
116
|
context "given empty options" do
|
117
117
|
before { User.protobuf_message(protobuf_message, options) }
|
@@ -140,7 +140,7 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
context "given options with :except" do
|
143
|
-
let(:options) { {
|
143
|
+
let(:options) { {except: [:name]} }
|
144
144
|
|
145
145
|
before { User.protobuf_message(protobuf_message, {}) }
|
146
146
|
|
@@ -154,10 +154,10 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
154
154
|
describe "#fields_from_record" do
|
155
155
|
let(:attributes) {
|
156
156
|
{
|
157
|
-
:
|
158
|
-
:
|
159
|
-
:
|
160
|
-
:
|
157
|
+
guid: "foo",
|
158
|
+
first_name: "bar",
|
159
|
+
last_name: "baz",
|
160
|
+
email: "foo@test.co"
|
161
161
|
}
|
162
162
|
}
|
163
163
|
|
@@ -169,7 +169,7 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
169
169
|
|
170
170
|
context "given options with :include" do
|
171
171
|
it "adds the given field to the list of serialized fields" do
|
172
|
-
fields = user.fields_from_record(:
|
172
|
+
fields = user.fields_from_record(include: :token)
|
173
173
|
expect(fields).to include(:token)
|
174
174
|
end
|
175
175
|
end
|
@@ -178,7 +178,7 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
178
178
|
let(:user) { User.create(attributes) }
|
179
179
|
|
180
180
|
it "terminates the association proxy" do
|
181
|
-
fields = user.fields_from_record(:
|
181
|
+
fields = user.fields_from_record(include: :photos)
|
182
182
|
expect(fields[:photos]).to be_an(Array)
|
183
183
|
end
|
184
184
|
end
|
@@ -187,7 +187,7 @@ describe Protobuf::ActiveRecord::Serialization do
|
|
187
187
|
describe "#to_proto" do
|
188
188
|
context "when a protobuf message is configured" do
|
189
189
|
let(:proto) { protobuf_message.new(proto_hash) }
|
190
|
-
let(:proto_hash) { {
|
190
|
+
let(:proto_hash) { {name: "foo"} }
|
191
191
|
|
192
192
|
before { allow(user).to receive(:fields_from_record).and_return(proto_hash) }
|
193
193
|
|
@@ -2,8 +2,8 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Protobuf::ActiveRecord::Transformation do
|
4
4
|
let(:user) { User.new(user_attributes) }
|
5
|
-
let(:user_attributes) { {
|
6
|
-
let(:proto_hash) { {
|
5
|
+
let(:user_attributes) { {first_name: "foo", last_name: "bar", email: "foo@test.co"} }
|
6
|
+
let(:proto_hash) { {name: "foo bar", email: "foo@test.co"} }
|
7
7
|
let(:proto) { UserMessage.new(proto_hash) }
|
8
8
|
|
9
9
|
describe "._filter_attribute_fields" do
|
@@ -18,7 +18,7 @@ describe Protobuf::ActiveRecord::Transformation do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it "includes attributes that aren't fields, but have attribute transformers" do
|
21
|
-
allow(User).to receive(:_protobuf_attribute_transformers).and_return(:
|
21
|
+
allow(User).to receive(:_protobuf_attribute_transformers).and_return(account_id: :fetch_account_id)
|
22
22
|
attribute_fields = User._filter_attribute_fields(proto)
|
23
23
|
expect(attribute_fields.key?(:account_id)).to be true
|
24
24
|
end
|
@@ -119,12 +119,12 @@ describe Protobuf::ActiveRecord::Transformation do
|
|
119
119
|
end
|
120
120
|
|
121
121
|
context "when a transformer is a callable that returns nil" do
|
122
|
-
let(:callable) { lambda { |_proto|
|
122
|
+
let(:callable) { lambda { |_proto| } }
|
123
123
|
|
124
124
|
before do
|
125
125
|
transformers = User._protobuf_attribute_transformers
|
126
126
|
allow(User).to receive(:_protobuf_attribute_transformers).and_return(
|
127
|
-
{
|
127
|
+
{account_id: transformer}.merge(transformers)
|
128
128
|
)
|
129
129
|
end
|
130
130
|
|
@@ -135,20 +135,20 @@ describe Protobuf::ActiveRecord::Transformation do
|
|
135
135
|
end
|
136
136
|
|
137
137
|
context "when the transformer has a nullify_on option" do
|
138
|
-
let(:callable) { lambda { |_proto|
|
139
|
-
let(:transformer) { ::Protobuf::ActiveRecord::Transformer.new(callable, :
|
140
|
-
let(:proto_hash) { {
|
138
|
+
let(:callable) { lambda { |_proto| } }
|
139
|
+
let(:transformer) { ::Protobuf::ActiveRecord::Transformer.new(callable, nullify_on: :account_id) }
|
140
|
+
let(:proto_hash) { {name: "foo bar", email: "foo@test.co", nullify: [:account_id]} }
|
141
141
|
|
142
142
|
before do
|
143
143
|
transformers = User._protobuf_attribute_transformers
|
144
144
|
allow(User).to receive(:_protobuf_attribute_transformers).and_return(
|
145
|
-
{
|
145
|
+
{account_id: transformer}.merge(transformers)
|
146
146
|
)
|
147
147
|
end
|
148
148
|
|
149
149
|
it "does not set the attribute" do
|
150
150
|
attribute_fields = User.attributes_from_proto(proto)
|
151
|
-
expect(attribute_fields).to include(:
|
151
|
+
expect(attribute_fields).to include(account_id: nil)
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
@@ -156,13 +156,13 @@ describe Protobuf::ActiveRecord::Transformation do
|
|
156
156
|
before do
|
157
157
|
transformers = User._protobuf_attribute_transformers
|
158
158
|
allow(User).to receive(:_protobuf_attribute_transformers).and_return(
|
159
|
-
{
|
159
|
+
{account_id: transformer}.merge(transformers)
|
160
160
|
)
|
161
161
|
end
|
162
162
|
|
163
163
|
it "sets the attribute" do
|
164
164
|
attribute_fields = User.attributes_from_proto(proto)
|
165
|
-
expect(attribute_fields).to eq user_attributes.merge(:
|
165
|
+
expect(attribute_fields).to eq user_attributes.merge(account_id: 1)
|
166
166
|
end
|
167
167
|
end
|
168
168
|
|
@@ -199,7 +199,7 @@ describe Protobuf::ActiveRecord::Transformation do
|
|
199
199
|
end
|
200
200
|
|
201
201
|
context "when the given transformer is callable" do
|
202
|
-
let(:callable) { lambda { |_proto|
|
202
|
+
let(:callable) { lambda { |_proto| } }
|
203
203
|
|
204
204
|
before { allow(User).to receive(:_protobuf_attribute_transformers).and_return({}) }
|
205
205
|
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe ::Protobuf::ActiveRecord::Transformer do
|
4
4
|
let(:callable) { lambda { |proto| proto.name } }
|
5
|
-
let(:proto) { ::UserMessage.new(:
|
5
|
+
let(:proto) { ::UserMessage.new(name: "test", nullify: ["name"]) }
|
6
6
|
let(:options) { {} }
|
7
7
|
|
8
8
|
subject { described_class.new(callable, options) }
|
@@ -22,7 +22,7 @@ describe ::Protobuf::ActiveRecord::Transformer do
|
|
22
22
|
end
|
23
23
|
|
24
24
|
context "nullify_on name" do
|
25
|
-
let(:options) { {
|
25
|
+
let(:options) { {nullify_on: :name} }
|
26
26
|
|
27
27
|
context "invalid message" do
|
28
28
|
let(:proto) { ::UserSearchMessage.new }
|
data/spec/support/db/setup.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
require "active_record"
|
2
2
|
|
3
3
|
ActiveRecord::Base.establish_connection(
|
4
|
-
:
|
5
|
-
:
|
4
|
+
adapter: "sqlite3",
|
5
|
+
database: "spec/test.db"
|
6
6
|
)
|
7
7
|
|
8
8
|
ActiveRecord::Base.connection.data_sources.each do |table|
|
9
9
|
ActiveRecord::Base.connection.drop_table(table)
|
10
10
|
end
|
11
11
|
|
12
|
-
ActiveRecord::Schema.define(:
|
12
|
+
ActiveRecord::Schema.define(version: 1) do
|
13
13
|
create_table :photos do |t|
|
14
14
|
t.string :url
|
15
15
|
t.integer :user_id
|
16
16
|
|
17
|
-
t.timestamps :
|
17
|
+
t.timestamps null: false
|
18
18
|
end
|
19
19
|
|
20
20
|
create_table :users do |t|
|
@@ -24,6 +24,6 @@ ActiveRecord::Schema.define(:version => 1) do
|
|
24
24
|
t.string :email
|
25
25
|
t.integer :account_id
|
26
26
|
|
27
|
-
t.timestamps :
|
27
|
+
t.timestamps null: false
|
28
28
|
end
|
29
29
|
end
|
data/spec/support/models/user.rb
CHANGED
@@ -7,10 +7,10 @@ class User < ActiveRecord::Base
|
|
7
7
|
|
8
8
|
accepts_nested_attributes_for :photos
|
9
9
|
|
10
|
-
scope :by_guid, lambda { |*guids| where(:
|
11
|
-
scope :by_email, lambda { |*emails| where(:
|
10
|
+
scope :by_guid, lambda { |*guids| where(guid: guids) }
|
11
|
+
scope :by_email, lambda { |*emails| where(email: emails) }
|
12
12
|
|
13
|
-
protobuf_fields :
|
13
|
+
protobuf_fields except: :photos
|
14
14
|
|
15
15
|
attribute_from_proto :first_name, :extract_first_name
|
16
16
|
attribute_from_proto :last_name, :extract_last_name
|
@@ -1,18 +1,16 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
1
|
##
|
4
2
|
# This file is auto-generated. DO NOT EDIT!
|
5
3
|
#
|
6
|
-
require
|
7
|
-
|
4
|
+
require "protobuf"
|
8
5
|
|
9
6
|
##
|
10
7
|
# Message Classes
|
11
8
|
#
|
12
9
|
class PhotoMessage < ::Protobuf::Message; end
|
10
|
+
|
13
11
|
class UserMessage < ::Protobuf::Message; end
|
14
|
-
class UserSearchMessage < ::Protobuf::Message; end
|
15
12
|
|
13
|
+
class UserSearchMessage < ::Protobuf::Message; end
|
16
14
|
|
17
15
|
##
|
18
16
|
# Message Fields
|
@@ -26,7 +24,7 @@ class UserMessage
|
|
26
24
|
optional :string, :guid, 1
|
27
25
|
optional :string, :name, 2
|
28
26
|
optional :string, :email, 3
|
29
|
-
optional :string, :email_domain, 4, :
|
27
|
+
optional :string, :email_domain, 4, deprecated: true
|
30
28
|
optional :string, :password, 5
|
31
29
|
repeated :string, :nullify, 6
|
32
30
|
repeated ::PhotoMessage, :photos, 7
|
@@ -38,4 +36,3 @@ class UserSearchMessage
|
|
38
36
|
repeated :string, :guid, 1
|
39
37
|
repeated :string, :email, 2
|
40
38
|
end
|
41
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protobuf-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Hutchison
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 7.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 7.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 7.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 7.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: concurrent-ruby
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,49 +109,49 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 3.3.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 3.3.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name: rspec
|
126
|
+
name: rspec-pride
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 3.
|
131
|
+
version: 3.1.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 3.
|
138
|
+
version: 3.1.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: pry-nav
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version:
|
152
|
+
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: simplecov
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -165,7 +165,7 @@ dependencies:
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: standard
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- ".gitignore"
|
218
218
|
- ".rspec"
|
219
219
|
- ".rubocop.yml"
|
220
|
+
- ".standard.yml"
|
220
221
|
- ".travis.yml"
|
221
222
|
- Gemfile
|
222
223
|
- LICENSE.txt
|
@@ -275,23 +276,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
276
|
- !ruby/object:Gem::Version
|
276
277
|
version: '0'
|
277
278
|
requirements: []
|
278
|
-
rubygems_version: 3.
|
279
|
+
rubygems_version: 3.4.10
|
279
280
|
signing_key:
|
280
281
|
specification_version: 4
|
281
282
|
summary: Google Protocol Buffers integration for Active Record
|
282
|
-
test_files:
|
283
|
-
- spec/protobuf/active_record/columns_spec.rb
|
284
|
-
- spec/protobuf/active_record/nested_attributes_spec.rb
|
285
|
-
- spec/protobuf/active_record/persistence_spec.rb
|
286
|
-
- spec/protobuf/active_record/scope_spec.rb
|
287
|
-
- spec/protobuf/active_record/serialization_spec.rb
|
288
|
-
- spec/protobuf/active_record/transformation_spec.rb
|
289
|
-
- spec/protobuf/active_record/transformer_spec.rb
|
290
|
-
- spec/spec_helper.rb
|
291
|
-
- spec/support/db.rb
|
292
|
-
- spec/support/db/setup.rb
|
293
|
-
- spec/support/definitions/messages.proto
|
294
|
-
- spec/support/models.rb
|
295
|
-
- spec/support/models/photo.rb
|
296
|
-
- spec/support/models/user.rb
|
297
|
-
- spec/support/protobuf/messages.pb.rb
|
283
|
+
test_files: []
|