json_api_resource 3.1.3 → 3.1.4
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/README.md +3 -0
- data/lib/json_api_resource/associations/base.rb +5 -2
- data/lib/json_api_resource/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7e858ea2abf0dc3d70196d921ddc8f3796829d6
|
4
|
+
data.tar.gz: '098c0d3aa4e6d1421932099a25f1a24b5b60207d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67080ff9381a2d9c6efb3198377dba526411ef24fde005f9e3577987b9ac20bccd0604c9e196fb04d3e623850175ac8accae5819963308dd28141817bf3b0576
|
7
|
+
data.tar.gz: 354fecb7027c2fd4c55becb74e22194f4a42d2ecfbe15cdd0e37dd21690251bd8fdf1e7a4f80b3b1ef9b3a1c2fae6623a6c6dc35344e9d3df697dd5be1e455ae
|
data/README.md
CHANGED
@@ -170,6 +170,9 @@ class Service::Client::Superuser < Service::Client::Base
|
|
170
170
|
custom_endpoint :superuser_from_user_id, :on=> :collection, :request_method=> :get
|
171
171
|
end
|
172
172
|
|
173
|
+
* 'class' - specifies the class for the association
|
174
|
+
* 'class_name' - a string that specifies a class for the association. Handy for load order issues
|
175
|
+
|
173
176
|
class User
|
174
177
|
wraps Service::Client::User
|
175
178
|
has_one :superuser, action: :superuser_from_user_id
|
@@ -34,7 +34,10 @@ module JsonApiResource
|
|
34
34
|
|
35
35
|
# klass has to be lazy initted for circular dependencies
|
36
36
|
def klass
|
37
|
-
@klass ||=
|
37
|
+
@klass ||= begin
|
38
|
+
klass = @opts.delete(:class_name).try :constantize
|
39
|
+
klass || @opts.delete( :class ) do derived_class end
|
40
|
+
end
|
38
41
|
end
|
39
42
|
|
40
43
|
def post_process( value )
|
@@ -64,7 +67,7 @@ module JsonApiResource
|
|
64
67
|
class_string.constantize
|
65
68
|
end
|
66
69
|
|
67
|
-
ASSOCIATION_OPTS = [:class, :action, :foreign_key, :prefetched_ids]
|
70
|
+
ASSOCIATION_OPTS = [:class, :action, :foreign_key, :prefetched_ids, :class_name]
|
68
71
|
|
69
72
|
RESERVED_KEYWORDS = [:attributes, :_associations, :_cached_associations, :schema, :client]
|
70
73
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_api_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Sislow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_api_client
|
@@ -163,3 +163,4 @@ signing_key:
|
|
163
163
|
specification_version: 4
|
164
164
|
summary: Build wrapper/adapter objects around JsonApiClient instances
|
165
165
|
test_files: []
|
166
|
+
has_rdoc:
|