active_remote 6.0.3 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/active_remote.gemspec +2 -2
- data/lib/active_remote/association.rb +3 -3
- data/lib/active_remote/attribute_methods.rb +8 -4
- data/lib/active_remote/integration.rb +1 -1
- data/lib/active_remote/version.rb +1 -1
- data/spec/lib/active_remote/errors_spec.rb +2 -2
- data/spec/lib/active_remote/persistence_spec.rb +4 -4
- 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: 77b819b6b5b0b7d07ac0a028c15f8efc626be189ddad774316cbfac20daf3deb
|
4
|
+
data.tar.gz: cfea81d7d553e6337ebff053285da014f9793959b04abac44a894265b5c48efa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af452a2b37a6fb19b297dba781f2c7aa28e2a38917b2ef44410d7f21cb4fc2b457eb83dff2bb82e627861a0c8b1c34ac89fe5354e51bba5b49751d4a8fc9fb02
|
7
|
+
data.tar.gz: add4cab29f490843debe830da456b9762fc27d6260da13d9e7150cb177242a3ffc767c18e7b3e3068ec04814467024a03ee3eb144b24064862c50f921a1e085b
|
data/active_remote.gemspec
CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |s|
|
|
20
20
|
##
|
21
21
|
# Dependencies
|
22
22
|
#
|
23
|
-
s.add_dependency "activemodel", "~> 6.
|
24
|
-
s.add_dependency "activesupport", "~> 6.
|
23
|
+
s.add_dependency "activemodel", "~> 6.1.0"
|
24
|
+
s.add_dependency "activesupport", "~> 6.1.0"
|
25
25
|
s.add_dependency "protobuf", ">= 3.0"
|
26
26
|
|
27
27
|
##
|
@@ -39,7 +39,7 @@ module ActiveRemote
|
|
39
39
|
search_hash[:guid] = object.send(foreign_key)
|
40
40
|
search_hash[options[:scope]] = object.send(options[:scope]) if options.key?(:scope)
|
41
41
|
|
42
|
-
search_hash.values.any?(&:nil?) ? nil : klass.search(
|
42
|
+
search_hash.values.any?(&:nil?) ? nil : klass.search(search_hash).first
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -80,7 +80,7 @@ module ActiveRemote
|
|
80
80
|
search_hash[foreign_key] = object.guid
|
81
81
|
search_hash[options[:scope]] = object.send(options[:scope]) if options.key?(:scope)
|
82
82
|
|
83
|
-
search_hash.values.any?(&:nil?) ? [] : klass.search(
|
83
|
+
search_hash.values.any?(&:nil?) ? [] : klass.search(search_hash)
|
84
84
|
end
|
85
85
|
|
86
86
|
options[:has_many] = true
|
@@ -120,7 +120,7 @@ module ActiveRemote
|
|
120
120
|
search_hash[foreign_key] = object.guid
|
121
121
|
search_hash[options[:scope]] = object.send(options[:scope]) if options.key?(:scope)
|
122
122
|
|
123
|
-
search_hash.values.any?(&:nil?) ? nil : klass.search(
|
123
|
+
search_hash.values.any?(&:nil?) ? nil : klass.search(search_hash).first
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -8,12 +8,16 @@ module ActiveRemote
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def [](
|
12
|
-
|
11
|
+
def [](attr_name)
|
12
|
+
name = attr_name.to_s
|
13
|
+
name = self.class.attribute_aliases[name] || name
|
14
|
+
@attributes.fetch_value(name.to_s)
|
13
15
|
end
|
14
16
|
|
15
|
-
def []=(
|
16
|
-
|
17
|
+
def []=(attr_name, value)
|
18
|
+
name = attr_name.to_s
|
19
|
+
name = self.class.attribute_aliases[name] || name
|
20
|
+
@attributes.write_from_user(name, value)
|
17
21
|
end
|
18
22
|
|
19
23
|
# Returns an <tt>#inspect</tt>-like string for the value of the
|
@@ -63,7 +63,7 @@ module ActiveRemote
|
|
63
63
|
case
|
64
64
|
when new_record? then
|
65
65
|
"#{model_name.cache_key}/new"
|
66
|
-
when ::ActiveRemote.config.default_cache_key_updated_at? && (timestamp = self[
|
66
|
+
when ::ActiveRemote.config.default_cache_key_updated_at? && (self.respond_to?(:[]) && timestamp = self["updated_at"]) then
|
67
67
|
timestamp = timestamp.utc.to_s(self.class.cache_timestamp_format)
|
68
68
|
"#{model_name.cache_key}/#{send(primary_key)}-#{timestamp}"
|
69
69
|
else
|
@@ -4,8 +4,8 @@ describe ::ActiveRemote::RemoteRecordNotSaved do
|
|
4
4
|
let(:record) { ::Tag.new }
|
5
5
|
|
6
6
|
before do
|
7
|
-
record.errors
|
8
|
-
record.errors
|
7
|
+
record.errors.add(:base, :invalid, :message => "Some error one!")
|
8
|
+
record.errors.add(:base, :invalid, :message => "Some error two!")
|
9
9
|
end
|
10
10
|
|
11
11
|
context "when an active remote record is used" do
|
@@ -148,7 +148,7 @@ describe ::ActiveRemote::Persistence do
|
|
148
148
|
end
|
149
149
|
|
150
150
|
context "when errors are present" do
|
151
|
-
before { subject.errors
|
151
|
+
before { subject.errors.add(:base, :invalid, :message => "Boom!") }
|
152
152
|
|
153
153
|
its(:has_errors?) { should be_truthy }
|
154
154
|
end
|
@@ -295,7 +295,7 @@ describe ::ActiveRemote::Persistence do
|
|
295
295
|
end
|
296
296
|
|
297
297
|
context "when the record has errors before the save" do
|
298
|
-
before { subject.errors
|
298
|
+
before { subject.errors.add(:base, :invalid, :message => "Boom!") }
|
299
299
|
|
300
300
|
it "clears the errors before the save" do
|
301
301
|
expect(subject.errors).not_to be_empty
|
@@ -330,7 +330,7 @@ describe ::ActiveRemote::Persistence do
|
|
330
330
|
|
331
331
|
describe "#success?" do
|
332
332
|
context "when errors are present" do
|
333
|
-
before { subject.errors
|
333
|
+
before { subject.errors.add(:base, :invalid, :message => "Boom!") }
|
334
334
|
|
335
335
|
its(:success?) { should be_falsey }
|
336
336
|
end
|
@@ -351,7 +351,7 @@ describe ::ActiveRemote::Persistence do
|
|
351
351
|
end
|
352
352
|
|
353
353
|
it "updates a remote record" do
|
354
|
-
expect(rpc).to receive(:execute).with(:update,
|
354
|
+
expect(rpc).to receive(:execute).with(:update, "name" => "foo", "guid" => "123")
|
355
355
|
tag.update_attribute(:name, "foo")
|
356
356
|
end
|
357
357
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0
|
4
|
+
version: 6.1.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: 2022-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 6.
|
19
|
+
version: 6.1.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: 6.
|
26
|
+
version: 6.1.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: 6.
|
33
|
+
version: 6.1.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: 6.
|
40
|
+
version: 6.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: protobuf
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -279,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
279
279
|
- !ruby/object:Gem::Version
|
280
280
|
version: '0'
|
281
281
|
requirements: []
|
282
|
-
rubygems_version: 3.4
|
282
|
+
rubygems_version: 3.1.4
|
283
283
|
signing_key:
|
284
284
|
specification_version: 4
|
285
285
|
summary: Active Record for your platform
|