active_resource-dirty 1.0.2 → 1.0.3
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/lib/active_resource/dirty.rb +15 -6
- data/lib/active_resource/dirty/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0dc92b649c5aa69ff2a6a5db881987d77b10324dc950948859d3d393d8755a32
|
4
|
+
data.tar.gz: 70d402d1eb8fc49d6864e12c662fb5031a80109c55cc7bea562ef6e11d55492c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 864df262f5b13f8f61f2d80be0f492087a0f909cfe8e2f75b972998d3895ad812a04c7741547d95917864b5860d78e47de41938f6c8d3685d50ac20d2ebf0893
|
7
|
+
data.tar.gz: a7003766fa557bdbfc3b01033b757202bb3087a521195464d28e9c92821394e94ca6de138968266a4b4fd712b9694cc9c5703470226e8c2c3a4d69628d155c19
|
@@ -17,6 +17,20 @@ module ActiveResource
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def update_attributes(attributes)
|
21
|
+
unless attributes.respond_to?(:to_hash)
|
22
|
+
raise ArgumentError, 'expected attributes to be able to convert'\
|
23
|
+
" to Hash, got #{attributes.inspect}"
|
24
|
+
end
|
25
|
+
|
26
|
+
attributes = attributes.to_hash
|
27
|
+
attributes.each do |key, value|
|
28
|
+
send("#{key}=".to_sym, value)
|
29
|
+
end
|
30
|
+
|
31
|
+
save
|
32
|
+
end
|
33
|
+
|
20
34
|
def respond_to_missing?(method_name, include_private = false)
|
21
35
|
method_name.to_s.end_with?('=') || super
|
22
36
|
end
|
@@ -53,11 +67,6 @@ module ActiveResource
|
|
53
67
|
# Monkey patch
|
54
68
|
def forget_attribute_assignments; end
|
55
69
|
|
56
|
-
def encode_changed_attributes(options = {})
|
57
|
-
format_options = options.merge(only: keys_for_partial_write)
|
58
|
-
send("to_#{self.class.format.extension}", format_options)
|
59
|
-
end
|
60
|
-
|
61
70
|
def keys_for_partial_write
|
62
71
|
changed_attributes.keys
|
63
72
|
end
|
@@ -72,7 +81,7 @@ module ActiveResource
|
|
72
81
|
|
73
82
|
run_callbacks :update do
|
74
83
|
connection.patch(element_path(prefix_options),
|
75
|
-
|
84
|
+
encode(only: keys_for_partial_write),
|
76
85
|
self.class.headers).tap do |response|
|
77
86
|
load_attributes_from_response(response)
|
78
87
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_resource-dirty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Francisco Caiceo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-07-
|
11
|
+
date: 2019-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|