jsonapi_compliable 0.11.8 → 0.11.10
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c65b22ee08192e29950054add88f472e77132860
|
4
|
+
data.tar.gz: e675a96ad08246f8264df2ac265ffeab5e648af1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e912049b53c80808cb5cb54203e86c7594625b18adf8a5d5103663654374f1e2145c66d03d5b7ceb7572929285cdc15578a0b3dc5aaee8a22c7036a48d04c5a3
|
7
|
+
data.tar.gz: c9aa189b04542dbfa114f19d91741c2ecf986b87c1ffedc0865c127c2add5bd59942addbfe0e21a749a69a2bc2ebca7763fd8a5608bd4898a52ae4bca5d43340
|
data/Appraisals
CHANGED
data/gemfiles/rails_5.gemfile
CHANGED
@@ -33,6 +33,7 @@ JsonapiSpecHelpers::Payload.register(:<%= file_name %>) do
|
|
33
33
|
<%- attributes.each do |a| -%>
|
34
34
|
<%- type = a.type == :boolean ? [TrueClass, FalseClass] : a.type.to_s.classify -%>
|
35
35
|
<%- type = String if a.type == :text -%>
|
36
|
+
<%- type = Float if a.type == :decimal -%>
|
36
37
|
key(:<%= a.name %>, <%= type %>)
|
37
38
|
<%- end -%>
|
38
39
|
end
|
@@ -130,11 +130,31 @@ module JsonapiCompliable
|
|
130
130
|
# @api private
|
131
131
|
# @yieldreturn Code to run within the current context
|
132
132
|
def wrap_context
|
133
|
-
jsonapi_resource.with_context(
|
133
|
+
jsonapi_resource.with_context(jsonapi_context, action_name.to_sym) do
|
134
134
|
yield
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
# Override if you'd like the "context" to be something other than
|
139
|
+
# an instance of this class.
|
140
|
+
# In Rails, context is the controller instance.
|
141
|
+
#
|
142
|
+
# @example Overriding
|
143
|
+
# # within your controller
|
144
|
+
# def jsonapi_context
|
145
|
+
# current_user
|
146
|
+
# end
|
147
|
+
#
|
148
|
+
# # within a resource
|
149
|
+
# default_filter :by_user do |scope, context|
|
150
|
+
# scope.where(user_id: context.id)
|
151
|
+
# end
|
152
|
+
#
|
153
|
+
# @return the context object you'd like
|
154
|
+
def jsonapi_context
|
155
|
+
self
|
156
|
+
end
|
157
|
+
|
138
158
|
# Use when direct, low-level access to the scope is required.
|
139
159
|
#
|
140
160
|
# @example Show Action
|
@@ -16,8 +16,8 @@ module JsonapiCompliable
|
|
16
16
|
extra_fields = query_hash[:extra_fields]
|
17
17
|
|
18
18
|
# Ensure fields doesnt clobber extra fields
|
19
|
-
|
20
|
-
|
19
|
+
extra_fields.each do |k,v|
|
20
|
+
fields[k] = fields[k] + v if fields[k]
|
21
21
|
end
|
22
22
|
|
23
23
|
options = {}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jsonapi_compliable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Richmond
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-05-
|
12
|
+
date: 2018-05-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jsonapi-serializable
|