active_remote 7.1.0 → 7.2.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/.rspec +1 -1
- data/.standard.yml +2 -1
- data/{CHANGES.md → CHANGELOG.md} +10 -4
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/Rakefile +13 -8
- data/lib/active_remote/association.rb +8 -13
- data/lib/active_remote/attribute_methods.rb +1 -1
- data/lib/active_remote/base.rb +2 -4
- data/lib/active_remote/dirty.rb +0 -32
- data/lib/active_remote/version.rb +1 -1
- metadata +18 -186
- data/.github/workflows/main.yml +0 -41
- data/.gitignore +0 -13
- data/Gemfile +0 -4
- data/LICENSE +0 -22
- data/active_remote.gemspec +0 -38
- data/bin/benchmark +0 -43
- data/bin/console +0 -10
- data/spec/lib/active_remote/association_spec.rb +0 -257
- data/spec/lib/active_remote/base_spec.rb +0 -10
- data/spec/lib/active_remote/dirty_spec.rb +0 -93
- data/spec/lib/active_remote/dsl_spec.rb +0 -85
- data/spec/lib/active_remote/errors_spec.rb +0 -31
- data/spec/lib/active_remote/integration_spec.rb +0 -111
- data/spec/lib/active_remote/persistence_spec.rb +0 -416
- data/spec/lib/active_remote/primary_key_spec.rb +0 -49
- data/spec/lib/active_remote/query_attribute_spec.rb +0 -43
- data/spec/lib/active_remote/rpc_adapters/protobuf_adapter_spec.rb +0 -24
- data/spec/lib/active_remote/rpc_spec.rb +0 -86
- data/spec/lib/active_remote/scope_keys_spec.rb +0 -42
- data/spec/lib/active_remote/search_spec.rb +0 -114
- data/spec/lib/active_remote/serialization_spec.rb +0 -33
- data/spec/lib/active_remote/serializers/protobuf_spec.rb +0 -89
- data/spec/lib/active_remote/validations_spec.rb +0 -56
- data/spec/spec_helper.rb +0 -29
- data/spec/support/definitions/author.proto +0 -30
- data/spec/support/definitions/category.proto +0 -33
- data/spec/support/definitions/error.proto +0 -6
- data/spec/support/definitions/post.proto +0 -35
- data/spec/support/definitions/serializer.proto +0 -23
- data/spec/support/definitions/tag.proto +0 -30
- data/spec/support/helpers.rb +0 -35
- data/spec/support/models/author.rb +0 -26
- data/spec/support/models/category.rb +0 -19
- data/spec/support/models/default_author.rb +0 -12
- data/spec/support/models/message_with_options.rb +0 -11
- data/spec/support/models/no_attributes.rb +0 -2
- data/spec/support/models/post.rb +0 -21
- data/spec/support/models/tag.rb +0 -22
- data/spec/support/models.rb +0 -7
- data/spec/support/protobuf/author.pb.rb +0 -58
- data/spec/support/protobuf/category.pb.rb +0 -61
- data/spec/support/protobuf/error.pb.rb +0 -21
- data/spec/support/protobuf/post.pb.rb +0 -63
- data/spec/support/protobuf/serializer.pb.rb +0 -36
- data/spec/support/protobuf/tag.pb.rb +0 -58
- data/spec/support/protobuf.rb +0 -5
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
require "support/protobuf/category.pb"
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
# Define a generic class that inherits from active remote base
|
|
5
|
-
#
|
|
6
|
-
class Category < ::ActiveRemote::Base
|
|
7
|
-
service_class ::Generic::Remote::CategoryService
|
|
8
|
-
|
|
9
|
-
attribute :guid, :string
|
|
10
|
-
attribute :user_guid, :string
|
|
11
|
-
attribute :chief_editor_guid, :string
|
|
12
|
-
|
|
13
|
-
has_many :posts
|
|
14
|
-
|
|
15
|
-
has_one :author
|
|
16
|
-
has_one :senior_author, class_name: "::Author"
|
|
17
|
-
has_one :primary_editor, class_name: "::Author", foreign_key: :editor_guid
|
|
18
|
-
has_one :chief_editor, class_name: "::Author", scope: :user_guid, foreign_key: :chief_editor_guid
|
|
19
|
-
end
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
require "support/protobuf/author.pb"
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
# Define a generic class that inherits from active remote base
|
|
5
|
-
#
|
|
6
|
-
class DefaultAuthor < ::ActiveRemote::Base
|
|
7
|
-
service_class ::Generic::Remote::AuthorService
|
|
8
|
-
|
|
9
|
-
attribute :guid, :string, default: lambda { 100 }
|
|
10
|
-
attribute :name, :string, default: "John Doe"
|
|
11
|
-
attribute :books, default: []
|
|
12
|
-
end
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# Define a generic message with options that behaves like a protobuf search response
|
|
3
|
-
#
|
|
4
|
-
class MessageWithOptions
|
|
5
|
-
attr_accessor :records, :options
|
|
6
|
-
|
|
7
|
-
def initialize(attributes = {})
|
|
8
|
-
@records = attributes.fetch(:records, nil)
|
|
9
|
-
@options = attributes.fetch(:options, nil)
|
|
10
|
-
end
|
|
11
|
-
end
|
data/spec/support/models/post.rb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require "support/protobuf/post.pb"
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
# Define a generic class that inherits from active remote base
|
|
5
|
-
#
|
|
6
|
-
class Post < ::ActiveRemote::Base
|
|
7
|
-
service_class ::Generic::Remote::PostService
|
|
8
|
-
|
|
9
|
-
attribute :guid, :string
|
|
10
|
-
attribute :name, :string
|
|
11
|
-
attribute :author_guid, :string
|
|
12
|
-
attribute :user_guid, :string
|
|
13
|
-
attribute :bestseller_guid, :string
|
|
14
|
-
|
|
15
|
-
belongs_to :author
|
|
16
|
-
belongs_to :coauthor, class_name: "::Author"
|
|
17
|
-
belongs_to :bestseller, class_name: "::Author", foreign_key: :bestseller_guid
|
|
18
|
-
belongs_to :user, class_name: "::Author", scope: :user_guid
|
|
19
|
-
|
|
20
|
-
validates :name, presence: true
|
|
21
|
-
end
|
data/spec/support/models/tag.rb
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
require "support/protobuf/tag.pb"
|
|
2
|
-
|
|
3
|
-
##
|
|
4
|
-
# Define a generic class that inherits from active remote base
|
|
5
|
-
#
|
|
6
|
-
class Tag < ::ActiveRemote::Base
|
|
7
|
-
service_class ::Generic::Remote::TagService
|
|
8
|
-
|
|
9
|
-
attribute :guid, :string
|
|
10
|
-
attribute :name, :string
|
|
11
|
-
attribute :updated_at, :datetime
|
|
12
|
-
attribute :user_guid, :string
|
|
13
|
-
|
|
14
|
-
after_update :after_update_callback
|
|
15
|
-
after_create :after_create_callback
|
|
16
|
-
|
|
17
|
-
def after_create_callback
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def after_update_callback
|
|
21
|
-
end
|
|
22
|
-
end
|
data/spec/support/models.rb
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# This file is auto-generated. DO NOT EDIT!
|
|
3
|
-
#
|
|
4
|
-
require "protobuf"
|
|
5
|
-
require "protobuf/rpc/service"
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
# Imports
|
|
9
|
-
#
|
|
10
|
-
require "error.pb"
|
|
11
|
-
|
|
12
|
-
module Generic
|
|
13
|
-
module Remote
|
|
14
|
-
::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
|
|
15
|
-
|
|
16
|
-
##
|
|
17
|
-
# Message Classes
|
|
18
|
-
#
|
|
19
|
-
class Author < ::Protobuf::Message; end
|
|
20
|
-
|
|
21
|
-
class Authors < ::Protobuf::Message; end
|
|
22
|
-
|
|
23
|
-
class AuthorRequest < ::Protobuf::Message; end
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
# Message Fields
|
|
27
|
-
#
|
|
28
|
-
class Author
|
|
29
|
-
optional :string, :guid, 1
|
|
30
|
-
optional :string, :name, 2
|
|
31
|
-
repeated ::Generic::Error, :errors, 3
|
|
32
|
-
optional :string, :user_guid, 4
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
class Authors
|
|
36
|
-
repeated ::Generic::Remote::Author, :records, 1
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
class AuthorRequest
|
|
40
|
-
repeated :string, :guid, 1
|
|
41
|
-
repeated :string, :name, 2
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
##
|
|
45
|
-
# Service Classes
|
|
46
|
-
#
|
|
47
|
-
class AuthorService < ::Protobuf::Rpc::Service
|
|
48
|
-
rpc :search, ::Generic::Remote::AuthorRequest, ::Generic::Remote::Authors
|
|
49
|
-
rpc :create, ::Generic::Remote::Author, ::Generic::Remote::Author
|
|
50
|
-
rpc :update, ::Generic::Remote::Author, ::Generic::Remote::Author
|
|
51
|
-
rpc :delete, ::Generic::Remote::Author, ::Generic::Remote::Author
|
|
52
|
-
rpc :create_all, ::Generic::Remote::Authors, ::Generic::Remote::Authors
|
|
53
|
-
rpc :update_all, ::Generic::Remote::Authors, ::Generic::Remote::Authors
|
|
54
|
-
rpc :delete_all, ::Generic::Remote::Authors, ::Generic::Remote::Authors
|
|
55
|
-
rpc :destroy_all, ::Generic::Remote::Authors, ::Generic::Remote::Authors
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# This file is auto-generated. DO NOT EDIT!
|
|
3
|
-
#
|
|
4
|
-
require "protobuf"
|
|
5
|
-
require "protobuf/rpc/service"
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
# Imports
|
|
9
|
-
#
|
|
10
|
-
require "error.pb"
|
|
11
|
-
|
|
12
|
-
module Generic
|
|
13
|
-
module Remote
|
|
14
|
-
::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
|
|
15
|
-
|
|
16
|
-
##
|
|
17
|
-
# Message Classes
|
|
18
|
-
#
|
|
19
|
-
class Category < ::Protobuf::Message; end
|
|
20
|
-
|
|
21
|
-
class Categories < ::Protobuf::Message; end
|
|
22
|
-
|
|
23
|
-
class CategoryRequest < ::Protobuf::Message; end
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
# Message Fields
|
|
27
|
-
#
|
|
28
|
-
class Category
|
|
29
|
-
optional :string, :guid, 1
|
|
30
|
-
optional :string, :name, 2
|
|
31
|
-
repeated ::Generic::Error, :errors, 3
|
|
32
|
-
optional :string, :user_guid, 4
|
|
33
|
-
optional :string, :author_guid, 5
|
|
34
|
-
optional :string, :chief_editor_guid, 6
|
|
35
|
-
optional :string, :editor_guid, 7
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
class Categories
|
|
39
|
-
repeated ::Generic::Remote::Category, :records, 1
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
class CategoryRequest
|
|
43
|
-
repeated :string, :guid, 1
|
|
44
|
-
repeated :string, :name, 2
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
##
|
|
48
|
-
# Service Classes
|
|
49
|
-
#
|
|
50
|
-
class CategoryService < ::Protobuf::Rpc::Service
|
|
51
|
-
rpc :search, ::Generic::Remote::CategoryRequest, ::Generic::Remote::Categories
|
|
52
|
-
rpc :create, ::Generic::Remote::Category, ::Generic::Remote::Category
|
|
53
|
-
rpc :update, ::Generic::Remote::Category, ::Generic::Remote::Category
|
|
54
|
-
rpc :delete, ::Generic::Remote::Category, ::Generic::Remote::Category
|
|
55
|
-
rpc :create_all, ::Generic::Remote::Categories, ::Generic::Remote::Categories
|
|
56
|
-
rpc :update_all, ::Generic::Remote::Categories, ::Generic::Remote::Categories
|
|
57
|
-
rpc :delete_all, ::Generic::Remote::Categories, ::Generic::Remote::Categories
|
|
58
|
-
rpc :destroy_all, ::Generic::Remote::Categories, ::Generic::Remote::Categories
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# This file is auto-generated. DO NOT EDIT!
|
|
3
|
-
#
|
|
4
|
-
require "protobuf"
|
|
5
|
-
|
|
6
|
-
module Generic
|
|
7
|
-
::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
|
|
8
|
-
|
|
9
|
-
##
|
|
10
|
-
# Message Classes
|
|
11
|
-
#
|
|
12
|
-
class Error < ::Protobuf::Message; end
|
|
13
|
-
|
|
14
|
-
##
|
|
15
|
-
# Message Fields
|
|
16
|
-
#
|
|
17
|
-
class Error
|
|
18
|
-
optional :string, :field, 1
|
|
19
|
-
optional :string, :message, 2
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# This file is auto-generated. DO NOT EDIT!
|
|
3
|
-
#
|
|
4
|
-
require "protobuf"
|
|
5
|
-
require "protobuf/rpc/service"
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
# Imports
|
|
9
|
-
#
|
|
10
|
-
require "error.pb"
|
|
11
|
-
require "category.pb"
|
|
12
|
-
|
|
13
|
-
module Generic
|
|
14
|
-
module Remote
|
|
15
|
-
::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
# Message Classes
|
|
19
|
-
#
|
|
20
|
-
class Post < ::Protobuf::Message; end
|
|
21
|
-
|
|
22
|
-
class Posts < ::Protobuf::Message; end
|
|
23
|
-
|
|
24
|
-
class PostRequest < ::Protobuf::Message; end
|
|
25
|
-
|
|
26
|
-
##
|
|
27
|
-
# Message Fields
|
|
28
|
-
#
|
|
29
|
-
class Post
|
|
30
|
-
optional :string, :guid, 1
|
|
31
|
-
optional :string, :name, 2
|
|
32
|
-
optional :string, :author_guid, 3
|
|
33
|
-
optional ::Generic::Remote::Category, :category, 4
|
|
34
|
-
repeated ::Generic::Error, :errors, 5
|
|
35
|
-
optional :string, :user_guid, 6
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
class Posts
|
|
39
|
-
repeated ::Generic::Remote::Post, :records, 1
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
class PostRequest
|
|
43
|
-
repeated :string, :guid, 1
|
|
44
|
-
repeated :string, :name, 2
|
|
45
|
-
repeated :string, :author_guid, 3
|
|
46
|
-
repeated :string, :user_guid, 4
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
##
|
|
50
|
-
# Service Classes
|
|
51
|
-
#
|
|
52
|
-
class PostService < ::Protobuf::Rpc::Service
|
|
53
|
-
rpc :search, ::Generic::Remote::PostRequest, ::Generic::Remote::Posts
|
|
54
|
-
rpc :create, ::Generic::Remote::Post, ::Generic::Remote::Post
|
|
55
|
-
rpc :update, ::Generic::Remote::Post, ::Generic::Remote::Post
|
|
56
|
-
rpc :delete, ::Generic::Remote::Post, ::Generic::Remote::Post
|
|
57
|
-
rpc :create_all, ::Generic::Remote::Posts, ::Generic::Remote::Posts
|
|
58
|
-
rpc :update_all, ::Generic::Remote::Posts, ::Generic::Remote::Posts
|
|
59
|
-
rpc :delete_all, ::Generic::Remote::Posts, ::Generic::Remote::Posts
|
|
60
|
-
rpc :destroy_all, ::Generic::Remote::Posts, ::Generic::Remote::Posts
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# This file is auto-generated. DO NOT EDIT!
|
|
3
|
-
#
|
|
4
|
-
require "protobuf"
|
|
5
|
-
|
|
6
|
-
##
|
|
7
|
-
# Message Classes
|
|
8
|
-
#
|
|
9
|
-
class Serializer < ::Protobuf::Message
|
|
10
|
-
class Type < ::Protobuf::Enum
|
|
11
|
-
define :DEFAULT, 0
|
|
12
|
-
define :USER, 1
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
##
|
|
17
|
-
# Message Fields
|
|
18
|
-
#
|
|
19
|
-
class Serializer
|
|
20
|
-
optional :bool, :bool_field, 1
|
|
21
|
-
optional :bytes, :bytes_field, 2
|
|
22
|
-
optional :double, :double_field, 3
|
|
23
|
-
optional :fixed32, :fixed32_field, 4
|
|
24
|
-
optional :fixed64, :fixed64_field, 5
|
|
25
|
-
optional :float, :float_field, 6
|
|
26
|
-
optional :int32, :int32_field, 7
|
|
27
|
-
optional :int64, :int64_field, 8
|
|
28
|
-
optional :sfixed32, :sfixed32_field, 9
|
|
29
|
-
optional :sfixed64, :sfixed64_field, 10
|
|
30
|
-
optional :sint32, :sint32_field, 11
|
|
31
|
-
optional :sint64, :sint64_field, 12
|
|
32
|
-
optional :string, :string_field, 13
|
|
33
|
-
optional :uint32, :uint32_field, 14
|
|
34
|
-
optional :uint64, :uint64_field, 15
|
|
35
|
-
optional ::Serializer::Type, :enum_field, 16
|
|
36
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
##
|
|
2
|
-
# This file is auto-generated. DO NOT EDIT!
|
|
3
|
-
#
|
|
4
|
-
require "protobuf"
|
|
5
|
-
require "protobuf/rpc/service"
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
# Imports
|
|
9
|
-
#
|
|
10
|
-
require "error.pb"
|
|
11
|
-
|
|
12
|
-
module Generic
|
|
13
|
-
module Remote
|
|
14
|
-
::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
|
|
15
|
-
|
|
16
|
-
##
|
|
17
|
-
# Message Classes
|
|
18
|
-
#
|
|
19
|
-
class Tag < ::Protobuf::Message; end
|
|
20
|
-
|
|
21
|
-
class Tags < ::Protobuf::Message; end
|
|
22
|
-
|
|
23
|
-
class TagRequest < ::Protobuf::Message; end
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
# Message Fields
|
|
27
|
-
#
|
|
28
|
-
class Tag
|
|
29
|
-
optional :string, :guid, 1
|
|
30
|
-
optional :string, :name, 2
|
|
31
|
-
repeated ::Generic::Error, :errors, 3
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
class Tags
|
|
35
|
-
repeated ::Generic::Remote::Tag, :records, 1
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
class TagRequest
|
|
39
|
-
repeated :string, :guid, 1
|
|
40
|
-
repeated :string, :name, 2
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
##
|
|
44
|
-
# Service Classes
|
|
45
|
-
#
|
|
46
|
-
class TagService < ::Protobuf::Rpc::Service
|
|
47
|
-
rpc :search, ::Generic::Remote::TagRequest, ::Generic::Remote::Tags
|
|
48
|
-
rpc :create, ::Generic::Remote::Tag, ::Generic::Remote::Tag
|
|
49
|
-
rpc :update, ::Generic::Remote::Tag, ::Generic::Remote::Tag
|
|
50
|
-
rpc :delete, ::Generic::Remote::Tag, ::Generic::Remote::Tag
|
|
51
|
-
rpc :register, ::Generic::Remote::Tag, ::Generic::Remote::Tag
|
|
52
|
-
rpc :create_all, ::Generic::Remote::Tags, ::Generic::Remote::Tags
|
|
53
|
-
rpc :update_all, ::Generic::Remote::Tags, ::Generic::Remote::Tags
|
|
54
|
-
rpc :delete_all, ::Generic::Remote::Tags, ::Generic::Remote::Tags
|
|
55
|
-
rpc :destroy_all, ::Generic::Remote::Tags, ::Generic::Remote::Tags
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|