jsonapi_compliable 0.6.4 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +11 -3
- data/.yardopts +1 -0
- data/README.md +10 -1
- data/Rakefile +1 -0
- data/docs/JsonapiCompliable.html +202 -0
- data/docs/JsonapiCompliable/Adapters.html +119 -0
- data/docs/JsonapiCompliable/Adapters/Abstract.html +2285 -0
- data/docs/JsonapiCompliable/Adapters/ActiveRecord.html +2151 -0
- data/docs/JsonapiCompliable/Adapters/ActiveRecordSideloading.html +582 -0
- data/docs/JsonapiCompliable/Adapters/Null.html +1682 -0
- data/docs/JsonapiCompliable/Base.html +1395 -0
- data/docs/JsonapiCompliable/Deserializer.html +835 -0
- data/docs/JsonapiCompliable/Errors.html +115 -0
- data/docs/JsonapiCompliable/Errors/BadFilter.html +124 -0
- data/docs/JsonapiCompliable/Errors/StatNotFound.html +266 -0
- data/docs/JsonapiCompliable/Errors/UnsupportedPageSize.html +264 -0
- data/docs/JsonapiCompliable/Errors/ValidationError.html +124 -0
- data/docs/JsonapiCompliable/Extensions.html +117 -0
- data/docs/JsonapiCompliable/Extensions/BooleanAttribute.html +212 -0
- data/docs/JsonapiCompliable/Extensions/BooleanAttribute/ClassMethods.html +229 -0
- data/docs/JsonapiCompliable/Extensions/ExtraAttribute.html +242 -0
- data/docs/JsonapiCompliable/Extensions/ExtraAttribute/ClassMethods.html +237 -0
- data/docs/JsonapiCompliable/Query.html +1099 -0
- data/docs/JsonapiCompliable/Rails.html +211 -0
- data/docs/JsonapiCompliable/Resource.html +5241 -0
- data/docs/JsonapiCompliable/Scope.html +703 -0
- data/docs/JsonapiCompliable/Scoping.html +117 -0
- data/docs/JsonapiCompliable/Scoping/Base.html +843 -0
- data/docs/JsonapiCompliable/Scoping/DefaultFilter.html +318 -0
- data/docs/JsonapiCompliable/Scoping/ExtraFields.html +301 -0
- data/docs/JsonapiCompliable/Scoping/Filter.html +313 -0
- data/docs/JsonapiCompliable/Scoping/Filterable.html +364 -0
- data/docs/JsonapiCompliable/Scoping/Paginate.html +613 -0
- data/docs/JsonapiCompliable/Scoping/Sort.html +454 -0
- data/docs/JsonapiCompliable/SerializableTempId.html +216 -0
- data/docs/JsonapiCompliable/Sideload.html +2484 -0
- data/docs/JsonapiCompliable/Stats.html +117 -0
- data/docs/JsonapiCompliable/Stats/DSL.html +999 -0
- data/docs/JsonapiCompliable/Stats/Payload.html +391 -0
- data/docs/JsonapiCompliable/Util.html +117 -0
- data/docs/JsonapiCompliable/Util/FieldParams.html +228 -0
- data/docs/JsonapiCompliable/Util/Hash.html +471 -0
- data/docs/JsonapiCompliable/Util/IncludeParams.html +299 -0
- data/docs/JsonapiCompliable/Util/Persistence.html +435 -0
- data/docs/JsonapiCompliable/Util/RelationshipPayload.html +563 -0
- data/docs/JsonapiCompliable/Util/RenderOptions.html +250 -0
- data/docs/JsonapiCompliable/Util/ValidationResponse.html +532 -0
- data/docs/_index.html +527 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +492 -0
- data/docs/file.README.html +99 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +99 -0
- data/docs/js/app.js +248 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +1731 -0
- data/docs/top-level-namespace.html +110 -0
- data/gemfiles/rails_5.gemfile +1 -1
- data/lib/jsonapi_compliable/adapters/abstract.rb +267 -4
- data/lib/jsonapi_compliable/adapters/active_record.rb +23 -1
- data/lib/jsonapi_compliable/adapters/null.rb +43 -3
- data/lib/jsonapi_compliable/base.rb +182 -33
- data/lib/jsonapi_compliable/deserializer.rb +90 -21
- data/lib/jsonapi_compliable/extensions/boolean_attribute.rb +12 -0
- data/lib/jsonapi_compliable/extensions/extra_attribute.rb +32 -0
- data/lib/jsonapi_compliable/extensions/temp_id.rb +11 -0
- data/lib/jsonapi_compliable/query.rb +94 -2
- data/lib/jsonapi_compliable/rails.rb +8 -0
- data/lib/jsonapi_compliable/resource.rb +548 -11
- data/lib/jsonapi_compliable/scope.rb +43 -1
- data/lib/jsonapi_compliable/scoping/base.rb +59 -8
- data/lib/jsonapi_compliable/scoping/default_filter.rb +33 -0
- data/lib/jsonapi_compliable/scoping/extra_fields.rb +33 -0
- data/lib/jsonapi_compliable/scoping/filter.rb +29 -2
- data/lib/jsonapi_compliable/scoping/filterable.rb +4 -0
- data/lib/jsonapi_compliable/scoping/paginate.rb +33 -0
- data/lib/jsonapi_compliable/scoping/sort.rb +18 -0
- data/lib/jsonapi_compliable/sideload.rb +229 -1
- data/lib/jsonapi_compliable/stats/dsl.rb +44 -0
- data/lib/jsonapi_compliable/stats/payload.rb +20 -0
- data/lib/jsonapi_compliable/util/field_params.rb +1 -0
- data/lib/jsonapi_compliable/util/hash.rb +18 -0
- data/lib/jsonapi_compliable/util/include_params.rb +22 -0
- data/lib/jsonapi_compliable/util/persistence.rb +13 -3
- data/lib/jsonapi_compliable/util/relationship_payload.rb +2 -0
- data/lib/jsonapi_compliable/util/render_options.rb +2 -0
- data/lib/jsonapi_compliable/util/validation_response.rb +16 -0
- data/lib/jsonapi_compliable/version.rb +1 -1
- metadata +60 -5
- data/gemfiles/rails_4.gemfile.lock +0 -208
- data/gemfiles/rails_5.gemfile.lock +0 -212
- data/lib/jsonapi_compliable/write.rb +0 -93
@@ -0,0 +1,313 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: JsonapiCompliable::Scoping::Filter
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.9
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "JsonapiCompliable::Scoping::Filter";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (F)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span> » <span class='title'><span class='object_link'><a href="../Scoping.html" title="JsonapiCompliable::Scoping (module)">Scoping</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Filter</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: JsonapiCompliable::Scoping::Filter
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName"><span class='object_link'><a href="Base.html" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span></span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next"><span class='object_link'><a href="Base.html" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span></li>
|
78
|
+
|
79
|
+
<li class="next">JsonapiCompliable::Scoping::Filter</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<dl>
|
93
|
+
<dt>Includes:</dt>
|
94
|
+
<dd><span class='object_link'><a href="Filterable.html" title="JsonapiCompliable::Scoping::Filterable (module)">Filterable</a></span></dd>
|
95
|
+
</dl>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<dl>
|
103
|
+
<dt>Defined in:</dt>
|
104
|
+
<dd>lib/jsonapi_compliable/scoping/filter.rb</dd>
|
105
|
+
</dl>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<h2>Overview</h2><div class="docstring">
|
110
|
+
<div class="discussion">
|
111
|
+
|
112
|
+
<p>Apply filtering logic to the scope</p>
|
113
|
+
|
114
|
+
<p>If the user requests to filter a field that has not been whitelisted, a
|
115
|
+
<code>JsonapiCompliable::Errors::BadFilter</code> error will be raised.</p>
|
116
|
+
|
117
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_allow_filter'>allow_filter</span> <span class='symbol'>:title</span> <span class='comment'># :title now whitelisted
|
118
|
+
</span></code></pre>
|
119
|
+
|
120
|
+
<p>If the user requests a filter field that has been whitelisted, but does not
|
121
|
+
pass the associated `<code>:if</code> clause, <code>BadFilter</code> will
|
122
|
+
be raised.</p>
|
123
|
+
|
124
|
+
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_allow_filter'>allow_filter</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='label'>if:</span> <span class='symbol'>:admin?</span>
|
125
|
+
</code></pre>
|
126
|
+
|
127
|
+
<p>This will also honor filter aliases.</p>
|
128
|
+
|
129
|
+
<pre class="code ruby"><code class="ruby"><span class='comment'># GET /posts?filter[headline]=foo will filter on title
|
130
|
+
</span><span class='id identifier rubyid_allow_filter'>allow_filter</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='label'>aliases:</span> <span class='lbracket'>[</span><span class='symbol'>:headline</span><span class='rbracket'>]</span>
|
131
|
+
</code></pre>
|
132
|
+
|
133
|
+
|
134
|
+
</div>
|
135
|
+
</div>
|
136
|
+
<div class="tags">
|
137
|
+
|
138
|
+
|
139
|
+
<p class="tag_title">See Also:</p>
|
140
|
+
<ul class="see">
|
141
|
+
|
142
|
+
<li><span class='object_link'><a href="../Adapters/Abstract.html#filter-instance_method" title="JsonapiCompliable::Adapters::Abstract#filter (method)">Adapters::Abstract#filter</a></span></li>
|
143
|
+
|
144
|
+
<li><span class='object_link'><a href="../Adapters/ActiveRecord.html#filter-instance_method" title="JsonapiCompliable::Adapters::ActiveRecord#filter (method)">Adapters::ActiveRecord#filter</a></span></li>
|
145
|
+
|
146
|
+
<li><span class='object_link'><a href="../Resource.html#allow_filter-class_method" title="JsonapiCompliable::Resource.allow_filter (method)">Resource.allow_filter</a></span></li>
|
147
|
+
|
148
|
+
</ul>
|
149
|
+
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<h2>Instance Attribute Summary</h2>
|
157
|
+
|
158
|
+
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="Base.html" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span></h3>
|
159
|
+
<p class="inherited"><span class='object_link'><a href="Base.html#query_hash-instance_method" title="JsonapiCompliable::Scoping::Base#query_hash (method)">#query_hash</a></span>, <span class='object_link'><a href="Base.html#resource-instance_method" title="JsonapiCompliable::Scoping::Base#resource (method)">#resource</a></span></p>
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<h2>
|
164
|
+
Instance Method Summary
|
165
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
166
|
+
</h2>
|
167
|
+
|
168
|
+
<ul class="summary">
|
169
|
+
|
170
|
+
<li class="public ">
|
171
|
+
<span class="summary_signature">
|
172
|
+
|
173
|
+
<a href="#apply-instance_method" title="#apply (instance method)">#<strong>apply</strong> ⇒ Object </a>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
</span>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
<span class="summary_desc"><div class='inline'>
|
188
|
+
<p>Apply the filtering logic.</p>
|
189
|
+
</div></span>
|
190
|
+
|
191
|
+
</li>
|
192
|
+
|
193
|
+
|
194
|
+
</ul>
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Filterable.html" title="JsonapiCompliable::Scoping::Filterable (module)">Filterable</a></span></h3>
|
207
|
+
<p class="inherited"><span class='object_link'><a href="Filterable.html#filter_param-instance_method" title="JsonapiCompliable::Scoping::Filterable#filter_param (method)">#filter_param</a></span>, <span class='object_link'><a href="Filterable.html#find_filter-instance_method" title="JsonapiCompliable::Scoping::Filterable#find_filter (method)">#find_filter</a></span>, <span class='object_link'><a href="Filterable.html#find_filter!-instance_method" title="JsonapiCompliable::Scoping::Filterable#find_filter! (method)">#find_filter!</a></span></p>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<h3 class="inherited">Methods inherited from <span class='object_link'><a href="Base.html" title="JsonapiCompliable::Scoping::Base (class)">Base</a></span></h3>
|
218
|
+
<p class="inherited"><span class='object_link'><a href="Base.html#apply%3F-instance_method" title="JsonapiCompliable::Scoping::Base#apply? (method)">#apply?</a></span>, <span class='object_link'><a href="Base.html#apply_custom_scope-instance_method" title="JsonapiCompliable::Scoping::Base#apply_custom_scope (method)">#apply_custom_scope</a></span>, <span class='object_link'><a href="Base.html#apply_standard_scope-instance_method" title="JsonapiCompliable::Scoping::Base#apply_standard_scope (method)">#apply_standard_scope</a></span>, <span class='object_link'><a href="Base.html#initialize-instance_method" title="JsonapiCompliable::Scoping::Base#initialize (method)">#initialize</a></span></p>
|
219
|
+
<div id="constructor_details" class="method_details_list">
|
220
|
+
<h2>Constructor Details</h2>
|
221
|
+
|
222
|
+
<p class="notice">This class inherits a constructor from <span class='object_link'><a href="Base.html#initialize-instance_method" title="JsonapiCompliable::Scoping::Base#initialize (method)">JsonapiCompliable::Scoping::Base</a></span></p>
|
223
|
+
|
224
|
+
</div>
|
225
|
+
|
226
|
+
|
227
|
+
<div id="instance_method_details" class="method_details_list">
|
228
|
+
<h2>Instance Method Details</h2>
|
229
|
+
|
230
|
+
|
231
|
+
<div class="method_details first">
|
232
|
+
<h3 class="signature first" id="apply-instance_method">
|
233
|
+
|
234
|
+
#<strong>apply</strong> ⇒ <tt>Object</tt>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
</h3><div class="docstring">
|
241
|
+
<div class="discussion">
|
242
|
+
|
243
|
+
<p>Apply the filtering logic.</p>
|
244
|
+
|
245
|
+
<p>Loop and parse all requested filters, taking into account guards and
|
246
|
+
aliases. If valid, call either the default or custom filtering logic.</p>
|
247
|
+
|
248
|
+
|
249
|
+
</div>
|
250
|
+
</div>
|
251
|
+
<div class="tags">
|
252
|
+
|
253
|
+
<p class="tag_title">Returns:</p>
|
254
|
+
<ul class="return">
|
255
|
+
|
256
|
+
<li>
|
257
|
+
|
258
|
+
|
259
|
+
<span class='type'></span>
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
<div class='inline'>
|
265
|
+
<p>the scope we are chaining/modifying</p>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
</li>
|
269
|
+
|
270
|
+
</ul>
|
271
|
+
|
272
|
+
</div><table class="source_code">
|
273
|
+
<tr>
|
274
|
+
<td>
|
275
|
+
<pre class="lines">
|
276
|
+
|
277
|
+
|
278
|
+
30
|
279
|
+
31
|
280
|
+
32
|
281
|
+
33
|
282
|
+
34
|
283
|
+
35
|
284
|
+
36</pre>
|
285
|
+
</td>
|
286
|
+
<td>
|
287
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/filter.rb', line 30</span>
|
288
|
+
|
289
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_apply'>apply</span>
|
290
|
+
<span class='id identifier rubyid_each_filter'>each_filter</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_filter'>filter</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
|
291
|
+
<span class='ivar'>@scope</span> <span class='op'>=</span> <span class='id identifier rubyid_filter_scope'>filter_scope</span><span class='lparen'>(</span><span class='id identifier rubyid_filter'>filter</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
292
|
+
<span class='kw'>end</span>
|
293
|
+
|
294
|
+
<span class='ivar'>@scope</span>
|
295
|
+
<span class='kw'>end</span></pre>
|
296
|
+
</td>
|
297
|
+
</tr>
|
298
|
+
</table>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
</div>
|
302
|
+
|
303
|
+
</div>
|
304
|
+
|
305
|
+
<div id="footer">
|
306
|
+
Generated on Fri May 5 15:53:23 2017 by
|
307
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
308
|
+
0.9.9 (ruby-2.3.0).
|
309
|
+
</div>
|
310
|
+
|
311
|
+
</div>
|
312
|
+
</body>
|
313
|
+
</html>
|
@@ -0,0 +1,364 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: JsonapiCompliable::Scoping::Filterable
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.9
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "JsonapiCompliable::Scoping::Filterable";
|
19
|
+
relpath = '../../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../../_index.html">Index (F)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span> » <span class='title'><span class='object_link'><a href="../Scoping.html" title="JsonapiCompliable::Scoping (module)">Scoping</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">Filterable</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: JsonapiCompliable::Scoping::Filterable
|
63
|
+
|
64
|
+
|
65
|
+
<span class="private note title">Private</span>
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<dl>
|
78
|
+
<dt>Included in:</dt>
|
79
|
+
<dd><span class='object_link'><a href="DefaultFilter.html" title="JsonapiCompliable::Scoping::DefaultFilter (class)">DefaultFilter</a></span>, <span class='object_link'><a href="Filter.html" title="JsonapiCompliable::Scoping::Filter (class)">Filter</a></span></dd>
|
80
|
+
</dl>
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
<dl>
|
85
|
+
<dt>Defined in:</dt>
|
86
|
+
<dd>lib/jsonapi_compliable/scoping/filterable.rb</dd>
|
87
|
+
</dl>
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div class="docstring">
|
92
|
+
<div class="discussion">
|
93
|
+
<p class="note private">
|
94
|
+
<strong>This module is part of a private API.</strong>
|
95
|
+
You should avoid using this module if possible, as it may be removed or be changed in the future.
|
96
|
+
</p>
|
97
|
+
|
98
|
+
|
99
|
+
</div>
|
100
|
+
</div>
|
101
|
+
<div class="tags">
|
102
|
+
|
103
|
+
|
104
|
+
</div>
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<h2>
|
113
|
+
Instance Method Summary
|
114
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
115
|
+
</h2>
|
116
|
+
|
117
|
+
<ul class="summary">
|
118
|
+
|
119
|
+
<li class="public ">
|
120
|
+
<span class="summary_signature">
|
121
|
+
|
122
|
+
<a href="#filter_param-instance_method" title="#filter_param (instance method)">#<strong>filter_param</strong> ⇒ Object </a>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
</span>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
<span class="private note title">private</span>
|
134
|
+
|
135
|
+
|
136
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
|
141
|
+
<li class="public ">
|
142
|
+
<span class="summary_signature">
|
143
|
+
|
144
|
+
<a href="#find_filter-instance_method" title="#find_filter (instance method)">#<strong>find_filter</strong>(name) ⇒ Object </a>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
</span>
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
<span class="private note title">private</span>
|
156
|
+
|
157
|
+
|
158
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
159
|
+
|
160
|
+
</li>
|
161
|
+
|
162
|
+
|
163
|
+
<li class="public ">
|
164
|
+
<span class="summary_signature">
|
165
|
+
|
166
|
+
<a href="#find_filter!-instance_method" title="#find_filter! (instance method)">#<strong>find_filter!</strong>(name) ⇒ Object </a>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
</span>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
<span class="private note title">private</span>
|
178
|
+
|
179
|
+
|
180
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
181
|
+
|
182
|
+
</li>
|
183
|
+
|
184
|
+
|
185
|
+
</ul>
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<div id="instance_method_details" class="method_details_list">
|
191
|
+
<h2>Instance Method Details</h2>
|
192
|
+
|
193
|
+
|
194
|
+
<div class="method_details first">
|
195
|
+
<h3 class="signature first" id="filter_param-instance_method">
|
196
|
+
|
197
|
+
#<strong>filter_param</strong> ⇒ <tt>Object</tt>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
</h3><div class="docstring">
|
204
|
+
<div class="discussion">
|
205
|
+
<p class="note private">
|
206
|
+
<strong>This method is part of a private API.</strong>
|
207
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
208
|
+
</p>
|
209
|
+
|
210
|
+
|
211
|
+
</div>
|
212
|
+
</div>
|
213
|
+
<div class="tags">
|
214
|
+
|
215
|
+
|
216
|
+
</div><table class="source_code">
|
217
|
+
<tr>
|
218
|
+
<td>
|
219
|
+
<pre class="lines">
|
220
|
+
|
221
|
+
|
222
|
+
23
|
223
|
+
24
|
224
|
+
25</pre>
|
225
|
+
</td>
|
226
|
+
<td>
|
227
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/filterable.rb', line 23</span>
|
228
|
+
|
229
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_filter_param'>filter_param</span>
|
230
|
+
<span class='id identifier rubyid_query_hash'>query_hash</span><span class='lbracket'>[</span><span class='symbol'>:filter</span><span class='rbracket'>]</span>
|
231
|
+
<span class='kw'>end</span></pre>
|
232
|
+
</td>
|
233
|
+
</tr>
|
234
|
+
</table>
|
235
|
+
</div>
|
236
|
+
|
237
|
+
<div class="method_details ">
|
238
|
+
<h3 class="signature " id="find_filter-instance_method">
|
239
|
+
|
240
|
+
#<strong>find_filter</strong>(name) ⇒ <tt>Object</tt>
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
</h3><div class="docstring">
|
247
|
+
<div class="discussion">
|
248
|
+
<p class="note private">
|
249
|
+
<strong>This method is part of a private API.</strong>
|
250
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
251
|
+
</p>
|
252
|
+
|
253
|
+
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
<div class="tags">
|
257
|
+
|
258
|
+
|
259
|
+
</div><table class="source_code">
|
260
|
+
<tr>
|
261
|
+
<td>
|
262
|
+
<pre class="lines">
|
263
|
+
|
264
|
+
|
265
|
+
5
|
266
|
+
6
|
267
|
+
7
|
268
|
+
8
|
269
|
+
9</pre>
|
270
|
+
</td>
|
271
|
+
<td>
|
272
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/filterable.rb', line 5</span>
|
273
|
+
|
274
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_filter'>find_filter</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
275
|
+
<span class='id identifier rubyid_find_filter!'>find_filter!</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
276
|
+
<span class='kw'>rescue</span> <span class='const'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors.html" title="JsonapiCompliable::Errors (module)">Errors</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors/BadFilter.html" title="JsonapiCompliable::Errors::BadFilter (class)">BadFilter</a></span></span>
|
277
|
+
<span class='kw'>nil</span>
|
278
|
+
<span class='kw'>end</span></pre>
|
279
|
+
</td>
|
280
|
+
</tr>
|
281
|
+
</table>
|
282
|
+
</div>
|
283
|
+
|
284
|
+
<div class="method_details ">
|
285
|
+
<h3 class="signature " id="find_filter!-instance_method">
|
286
|
+
|
287
|
+
#<strong>find_filter!</strong>(name) ⇒ <tt>Object</tt>
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
</h3><div class="docstring">
|
294
|
+
<div class="discussion">
|
295
|
+
<p class="note private">
|
296
|
+
<strong>This method is part of a private API.</strong>
|
297
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
298
|
+
</p>
|
299
|
+
|
300
|
+
|
301
|
+
</div>
|
302
|
+
</div>
|
303
|
+
<div class="tags">
|
304
|
+
|
305
|
+
<p class="tag_title">Raises:</p>
|
306
|
+
<ul class="raise">
|
307
|
+
|
308
|
+
<li>
|
309
|
+
|
310
|
+
|
311
|
+
<span class='type'>(<tt><span class='object_link'><a href="../Errors/BadFilter.html" title="JsonapiCompliable::Errors::BadFilter (class)">JsonapiCompliable::Errors::BadFilter</a></span></tt>)</span>
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
</li>
|
316
|
+
|
317
|
+
</ul>
|
318
|
+
|
319
|
+
</div><table class="source_code">
|
320
|
+
<tr>
|
321
|
+
<td>
|
322
|
+
<pre class="lines">
|
323
|
+
|
324
|
+
|
325
|
+
12
|
326
|
+
13
|
327
|
+
14
|
328
|
+
15
|
329
|
+
16
|
330
|
+
17
|
331
|
+
18
|
332
|
+
19
|
333
|
+
20</pre>
|
334
|
+
</td>
|
335
|
+
<td>
|
336
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/scoping/filterable.rb', line 12</span>
|
337
|
+
|
338
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_filter!'>find_filter!</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span>
|
339
|
+
<span class='id identifier rubyid_filter_name'>filter_name</span><span class='comma'>,</span> <span class='id identifier rubyid_filter_value'>filter_value</span> <span class='op'>=</span> \
|
340
|
+
<span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_filters'>filters</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid__name'>_name</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='op'>|</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:aliases</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
341
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors.html" title="JsonapiCompliable::Errors (module)">Errors</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors/BadFilter.html" title="JsonapiCompliable::Errors::BadFilter (class)">BadFilter</a></span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_filter_name'>filter_name</span>
|
342
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_guard'>guard</span> <span class='op'>=</span> <span class='id identifier rubyid_filter_value'>filter_value</span><span class='lbracket'>[</span><span class='symbol'>:if</span><span class='rbracket'>]</span>
|
343
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../../JsonapiCompliable.html" title="JsonapiCompliable (module)">JsonapiCompliable</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors.html" title="JsonapiCompliable::Errors (module)">Errors</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Errors/BadFilter.html" title="JsonapiCompliable::Errors::BadFilter (class)">BadFilter</a></span></span> <span class='kw'>if</span> <span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_context'>context</span><span class='lbracket'>[</span><span class='symbol'>:object</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_guard'>guard</span><span class='rparen'>)</span> <span class='op'>==</span> <span class='kw'>false</span>
|
344
|
+
<span class='kw'>end</span>
|
345
|
+
<span class='lbrace'>{</span> <span class='id identifier rubyid_filter_name'>filter_name</span> <span class='op'>=></span> <span class='id identifier rubyid_filter_value'>filter_value</span> <span class='rbrace'>}</span>
|
346
|
+
<span class='kw'>end</span></pre>
|
347
|
+
</td>
|
348
|
+
</tr>
|
349
|
+
</table>
|
350
|
+
</div>
|
351
|
+
|
352
|
+
</div>
|
353
|
+
|
354
|
+
</div>
|
355
|
+
|
356
|
+
<div id="footer">
|
357
|
+
Generated on Fri May 5 15:53:21 2017 by
|
358
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
359
|
+
0.9.9 (ruby-2.3.0).
|
360
|
+
</div>
|
361
|
+
|
362
|
+
</div>
|
363
|
+
</body>
|
364
|
+
</html>
|