hyper-resource 1.0.0.lap78 → 1.0.0.lap79
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9430772935e6c7baa1396aa73c09266072a6312a22fe66a51e50c7b01053e579
|
4
|
+
data.tar.gz: 50f91a54c04446790d2dbc8a8f3d54abb0a554e4ab9860099ceab11e2b3e1807
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98c4f86d6fc72c03fa0892effa4b0c66a1751d6a32b856e1c218b16baf3034e3963b5c524b7665fe3adb9ea913930c32c562f0b64c8127bb48116efc5008dad6
|
7
|
+
data.tar.gz: 5c69b6391ca3dcc1b22ad53c625f3c8f7c6041c025a7b5ac445cc1f6c946c9b8481e14221be7a68443fc648ca407a016fa8ae8555a0c4cefe6840c344f85c88a
|
@@ -70,9 +70,7 @@ module HyperRecord
|
|
70
70
|
|
71
71
|
def link(other_record)
|
72
72
|
_register_observer
|
73
|
-
promise_link(other_record)
|
74
|
-
_notify_observers
|
75
|
-
end
|
73
|
+
promise_link(other_record)
|
76
74
|
self
|
77
75
|
end
|
78
76
|
|
@@ -104,9 +102,7 @@ module HyperRecord
|
|
104
102
|
|
105
103
|
def save
|
106
104
|
_register_observer
|
107
|
-
promise_save
|
108
|
-
_notify_observers
|
109
|
-
end
|
105
|
+
promise_save
|
110
106
|
self
|
111
107
|
end
|
112
108
|
|
@@ -124,9 +120,7 @@ module HyperRecord
|
|
124
120
|
|
125
121
|
def unlink(other_record)
|
126
122
|
_register_observer
|
127
|
-
promise_unlink(other_record)
|
128
|
-
_notify_observers
|
129
|
-
end
|
123
|
+
promise_unlink(other_record)
|
130
124
|
self
|
131
125
|
end
|
132
126
|
|
@@ -170,6 +164,8 @@ module HyperRecord
|
|
170
164
|
payload_hash = other_record.to_hash
|
171
165
|
self.class._promise_post("#{resource_base_uri}/#{self.id}/relations/#{relation_name}.json", { data: payload_hash }).then do |response|
|
172
166
|
other_record.instance_variable_get(:@properties).merge!(response.json[other_record.class.to_s.underscore])
|
167
|
+
_notify_observers
|
168
|
+
other_record._notify_observers
|
173
169
|
self
|
174
170
|
end.fail do |response|
|
175
171
|
error_message = "Linking record #{other_record} to #{self} failed!"
|
@@ -187,6 +183,7 @@ module HyperRecord
|
|
187
183
|
reset
|
188
184
|
self.class._promise_patch("#{resource_base_uri}/#{@properties[:id]}", { data: payload_hash }).then do |response|
|
189
185
|
@properties.merge!(response.json[self.class.to_s.underscore])
|
186
|
+
_notify_observers
|
190
187
|
self
|
191
188
|
end.fail do |response|
|
192
189
|
error_message = "Saving record #{self} failed!"
|
@@ -212,6 +209,7 @@ module HyperRecord
|
|
212
209
|
raise "No relation for record of type #{other_record.class}" unless reflections.has_key?(relation_name)
|
213
210
|
@relations[relation_name].delete_if { |cr| cr == other_record } if !called_from_collection && @fetch_states[relation_name] == 'f'
|
214
211
|
self.class._promise_delete("#{resource_base_uri}/#{@properties[:id]}/relations/#{relation_name}.json?record_id=#{other_record.id}").then do |response|
|
212
|
+
_notify_observers
|
215
213
|
self
|
216
214
|
end.fail do |response|
|
217
215
|
error_message = "Unlinking #{other_record} from #{self} failed!"
|
@@ -82,7 +82,7 @@ module Hyperloop
|
|
82
82
|
return Opal.Hyperloop.$const_get('Resource').$const_get('ClientDrivers').$process_notification(Opal.Hash.$new(data));
|
83
83
|
}`)
|
84
84
|
|
85
|
-
when
|
85
|
+
when :action_cable
|
86
86
|
opts[:action_cable_consumer] =
|
87
87
|
`ActionCable.createConsumer.apply(ActionCable, #{[*opts[:action_cable_consumer_url]]})`
|
88
88
|
Hyperloop.connect(*opts[:auto_connect])
|
@@ -125,8 +125,7 @@ module Hyperloop
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
elsif record_class.record_cached?(data[:id])
|
128
|
-
|
129
|
-
record._update_record(data)
|
128
|
+
record_class._record_cache[data[:id].to_s]._update_record(data)
|
130
129
|
elsif data[:destroyed]
|
131
130
|
return
|
132
131
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hyper-resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.lap79
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Biedermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|