hyper-resource 1.0.0.lap70 → 1.0.0.lap72
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: 73a59d7cd9025be51a5fbb828f962f2caa171361d4a032bcbb79203590d36d37
|
4
|
+
data.tar.gz: df571a693a8bea2fd165f5dd10f5817236312627b604c7a0edc72898c611db29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44b2e81c24f41d488db884f6bff6febb7e714218f834f1c9057a9ab44a33da899a14e4f8cf68eb11cfe37026a2e230991bc328e6418c017c7f07deb75f99c862
|
7
|
+
data.tar.gz: e3686602ebe1576da11f0f82c1121cf21183592069bf39b6b7d25b1a339e1dae3daca2c119eae311717bc27d6538b17e29b5bb0f7c9b684147b09683556302ff
|
@@ -25,7 +25,7 @@ module HyperRecord
|
|
25
25
|
|
26
26
|
def promise_all
|
27
27
|
_class_fetch_states[:all] = 'i'
|
28
|
-
_promise_get("#{resource_base_uri}.json").then do |response|
|
28
|
+
_promise_get("#{resource_base_uri}.json?timestamp=#{`Date.now() + Math.random()`}").then do |response|
|
29
29
|
collection = _convert_array_to_collection(response.json[self.to_s.underscore.pluralize])
|
30
30
|
_class_fetch_states[:all] = 'f'
|
31
31
|
_notify_class_observers
|
@@ -51,7 +51,7 @@ module HyperRecord
|
|
51
51
|
reflections[name] = { direction: direction, type: options[:type], kind: :belongs_to }
|
52
52
|
define_method("promise_#{name}") do
|
53
53
|
@fetch_states[name] = 'i'
|
54
|
-
self.class._promise_get("#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json").then do |response|
|
54
|
+
self.class._promise_get("#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json?timestamp=#{`Date.now() + Math.random()`}").then do |response|
|
55
55
|
@relations[name] = self.class._convert_json_hash_to_record(response.json[self.class.to_s.underscore][name])
|
56
56
|
@fetch_states[name] = 'f'
|
57
57
|
_notify_observers
|
@@ -156,7 +156,7 @@ module HyperRecord
|
|
156
156
|
reflections[name] = { direction: direction, type: options[:type], kind: :has_and_belongs_to_many }
|
157
157
|
define_method("promise_#{name}") do
|
158
158
|
@fetch_states[name] = 'i'
|
159
|
-
self.class._promise_get("#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json").then do |response|
|
159
|
+
self.class._promise_get("#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json?timestamp=#{`Date.now() + Math.random()`}").then do |response|
|
160
160
|
collection = self.class._convert_array_to_collection(response.json[self.class.to_s.underscore][name], self, name)
|
161
161
|
@relations[name] = collection
|
162
162
|
@fetch_states[name] = 'f'
|
@@ -212,7 +212,7 @@ module HyperRecord
|
|
212
212
|
reflections[name] = { direction: direction, type: options[:type], kind: :has_many }
|
213
213
|
define_method("promise_#{name}") do
|
214
214
|
@fetch_states[name] = 'i'
|
215
|
-
self.class._promise_get("#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json").then do |response|
|
215
|
+
self.class._promise_get("#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json?timestamp=#{`Date.now() + Math.random()`}").then do |response|
|
216
216
|
collection = self.class._convert_array_to_collection(response.json[self.class.to_s.underscore][name], self, name)
|
217
217
|
@relations[name] = collection
|
218
218
|
@fetch_states[name] = 'f'
|
@@ -267,7 +267,7 @@ module HyperRecord
|
|
267
267
|
reflections[name] = { direction: direction, type: options[:type], kind: :has_one }
|
268
268
|
define_method("promise_#{name}") do
|
269
269
|
@fetch_states[name] = 'i'
|
270
|
-
self.class._promise_get("#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json").then do |response|
|
270
|
+
self.class._promise_get("#{self.class.resource_base_uri}/#{self.id}/relations/#{name}.json?timestamp=#{`Date.now() + Math.random()`}").then do |response|
|
271
271
|
@relations[name] = self.class._convert_json_hash_to_record(response.json[self.class.to_s.underscore][name])
|
272
272
|
@fetch_states[name] = 'f'
|
273
273
|
_notify_observers
|
@@ -361,7 +361,7 @@ module HyperRecord
|
|
361
361
|
define_singleton_method(name) do |*args|
|
362
362
|
name_args = _name_args(name, *args)
|
363
363
|
_register_class_observer
|
364
|
-
rest_class_methods[name_args] = { result: options[:default_result] } unless
|
364
|
+
rest_class_methods[name_args] = { result: options[:default_result] } unless rest_class_methods.has_key?(name_args)
|
365
365
|
unless _class_fetch_states.has_key?(name_args) && 'fi'.include?(_class_fetch_states[name_args])
|
366
366
|
self.send("promise_#{name}", *args)
|
367
367
|
end
|
@@ -417,7 +417,7 @@ module HyperRecord
|
|
417
417
|
define_singleton_method("promise_#{name}") do |*args|
|
418
418
|
name_args = _name_args(name, *args)
|
419
419
|
_class_fetch_states[name_args] = 'i'
|
420
|
-
self._promise_get_or_patch("#{resource_base_uri}/scopes/#{name}.json", *args).then do |response_json|
|
420
|
+
self._promise_get_or_patch("#{resource_base_uri}/scopes/#{name}.json?timestamp=#{`Date.now() + Math.random()`}", *args).then do |response_json|
|
421
421
|
scopes[name_args] = _convert_array_to_collection(response_json[self.to_s.underscore][name])
|
422
422
|
_class_fetch_states[name_args] = 'f'
|
423
423
|
_notify_class_observers
|
data/lib/hyper_record/pub_sub.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
module HyperRecord
|
2
2
|
module PubSub
|
3
3
|
def self.included(base)
|
4
|
-
attr_accessor :
|
4
|
+
attr_accessor :policy_params
|
5
5
|
|
6
6
|
base.extend(HyperRecord::PubSub::ClassMethods)
|
7
7
|
end
|
8
8
|
|
9
9
|
module ClassMethods
|
10
|
-
attr_accessor :
|
10
|
+
attr_accessor :policy_params
|
11
11
|
|
12
12
|
def _pusher_client
|
13
13
|
Hyperloop.pusher_instance ||= Pusher::Client.new(
|
@@ -1,9 +1,8 @@
|
|
1
1
|
module HyperRecord
|
2
2
|
module ServerClassMethods
|
3
3
|
def rest_class_method(name, options = { default_result: '...' }, &block)
|
4
|
-
|
5
|
-
|
6
|
-
rest_methods[name][:class_method] = true
|
4
|
+
rest_class_methods[name] = options
|
5
|
+
rest_class_methods[name][:params] = block.arity
|
7
6
|
singleton_class.send(:define_method, name) do |*args|
|
8
7
|
if args.size > 0
|
9
8
|
block.call(*args)
|
@@ -25,6 +24,10 @@ module HyperRecord
|
|
25
24
|
end
|
26
25
|
end
|
27
26
|
|
27
|
+
def rest_class_methods
|
28
|
+
@rest_class_methods ||= {}
|
29
|
+
end
|
30
|
+
|
28
31
|
def rest_methods
|
29
32
|
@rest_methods ||= {}
|
30
33
|
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.lap72
|
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-04-
|
11
|
+
date: 2018-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|