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,250 @@
|
|
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::Util::RenderOptions
|
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::Util::RenderOptions";
|
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 (R)</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="../Util.html" title="JsonapiCompliable::Util (module)">Util</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">RenderOptions</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::Util::RenderOptions
|
63
|
+
|
64
|
+
|
65
|
+
<span class="private note title">Private</span>
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">JsonapiCompliable::Util::RenderOptions</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/jsonapi_compliable/util/render_options.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
<p class="note private">
|
105
|
+
<strong>This class is part of a private API.</strong>
|
106
|
+
You should avoid using this class if possible, as it may be removed or be changed in the future.
|
107
|
+
</p>
|
108
|
+
|
109
|
+
<p>Generate the options we end up passing to <a href="{http://jsonapi-rb.org" target="_parent" title="jsonapi-rb">jsonapi-rb</a>}</p>
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
</div>
|
114
|
+
<div class="tags">
|
115
|
+
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<h2>
|
126
|
+
Class Method Summary
|
127
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
128
|
+
</h2>
|
129
|
+
|
130
|
+
<ul class="summary">
|
131
|
+
|
132
|
+
<li class="public ">
|
133
|
+
<span class="summary_signature">
|
134
|
+
|
135
|
+
<a href="#generate-class_method" title="generate (class method)">.<strong>generate</strong>(object, query_hash, overrides = {}) ⇒ Object </a>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
</span>
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
<span class="private note title">private</span>
|
147
|
+
|
148
|
+
|
149
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
150
|
+
|
151
|
+
</li>
|
152
|
+
|
153
|
+
|
154
|
+
</ul>
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<div id="class_method_details" class="method_details_list">
|
160
|
+
<h2>Class Method Details</h2>
|
161
|
+
|
162
|
+
|
163
|
+
<div class="method_details first">
|
164
|
+
<h3 class="signature first" id="generate-class_method">
|
165
|
+
|
166
|
+
.<strong>generate</strong>(object, query_hash, overrides = {}) ⇒ <tt>Object</tt>
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
</h3><div class="docstring">
|
173
|
+
<div class="discussion">
|
174
|
+
<p class="note private">
|
175
|
+
<strong>This method is part of a private API.</strong>
|
176
|
+
You should avoid using this method if possible, as it may be removed or be changed in the future.
|
177
|
+
</p>
|
178
|
+
|
179
|
+
|
180
|
+
</div>
|
181
|
+
</div>
|
182
|
+
<div class="tags">
|
183
|
+
|
184
|
+
|
185
|
+
</div><table class="source_code">
|
186
|
+
<tr>
|
187
|
+
<td>
|
188
|
+
<pre class="lines">
|
189
|
+
|
190
|
+
|
191
|
+
6
|
192
|
+
7
|
193
|
+
8
|
194
|
+
9
|
195
|
+
10
|
196
|
+
11
|
197
|
+
12
|
198
|
+
13
|
199
|
+
14
|
200
|
+
15
|
201
|
+
16
|
202
|
+
17
|
203
|
+
18
|
204
|
+
19
|
205
|
+
20
|
206
|
+
21
|
207
|
+
22
|
208
|
+
23
|
209
|
+
24</pre>
|
210
|
+
</td>
|
211
|
+
<td>
|
212
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/render_options.rb', line 6</span>
|
213
|
+
|
214
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_generate'>generate</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_query_hash'>query_hash</span><span class='comma'>,</span> <span class='id identifier rubyid_overrides'>overrides</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
215
|
+
<span class='id identifier rubyid_resolved'>resolved</span> <span class='op'>=</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:resolve</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_resolve'>resolve</span> <span class='op'>:</span> <span class='id identifier rubyid_object'>object</span>
|
216
|
+
|
217
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
218
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:include</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_query_hash'>query_hash</span><span class='lbracket'>[</span><span class='symbol'>:include</span><span class='rbracket'>]</span>
|
219
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:jsonapi</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_resolved'>resolved</span>
|
220
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_query_hash'>query_hash</span><span class='lbracket'>[</span><span class='symbol'>:fields</span><span class='rbracket'>]</span>
|
221
|
+
<span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_overrides'>overrides</span><span class='rparen'>)</span>
|
222
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:meta</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
223
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:expose</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
224
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:expose</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:extra_fields</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_query_hash'>query_hash</span><span class='lbracket'>[</span><span class='symbol'>:extra_fields</span><span class='rbracket'>]</span>
|
225
|
+
|
226
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:resolve_stats</span><span class='rparen'>)</span>
|
227
|
+
<span class='id identifier rubyid_stats'>stats</span> <span class='op'>=</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_resolve_stats'>resolve_stats</span>
|
228
|
+
<span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:meta</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:stats</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_stats'>stats</span> <span class='kw'>unless</span> <span class='id identifier rubyid_stats'>stats</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
229
|
+
<span class='kw'>end</span>
|
230
|
+
|
231
|
+
<span class='id identifier rubyid_options'>options</span>
|
232
|
+
<span class='kw'>end</span></pre>
|
233
|
+
</td>
|
234
|
+
</tr>
|
235
|
+
</table>
|
236
|
+
</div>
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div id="footer">
|
243
|
+
Generated on Fri May 5 15:53:23 2017 by
|
244
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
245
|
+
0.9.9 (ruby-2.3.0).
|
246
|
+
</div>
|
247
|
+
|
248
|
+
</div>
|
249
|
+
</body>
|
250
|
+
</html>
|
@@ -0,0 +1,532 @@
|
|
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::Util::ValidationResponse
|
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::Util::ValidationResponse";
|
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 (V)</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="../Util.html" title="JsonapiCompliable::Util (module)">Util</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">ValidationResponse</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::Util::ValidationResponse
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">JsonapiCompliable::Util::ValidationResponse</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/jsonapi_compliable/util/validation_response.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>We need to know two things in the response of a persistence call:</p>
|
106
|
+
|
107
|
+
<pre class="code ruby"><code class="ruby">* The model we just tried to persist
|
108
|
+
* Was the persistence successful?</code></pre>
|
109
|
+
|
110
|
+
<p>This object wraps those bits of data. The call is considered unsuccessful
|
111
|
+
when it adheres to the ActiveModel#errors interface, and #errors is not
|
112
|
+
blank. In other words, it is not successful if there were validation
|
113
|
+
errors.</p>
|
114
|
+
|
115
|
+
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
<div class="tags">
|
119
|
+
|
120
|
+
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
126
|
+
<ul class="summary">
|
127
|
+
|
128
|
+
<li class="public ">
|
129
|
+
<span class="summary_signature">
|
130
|
+
|
131
|
+
<a href="#object-instance_method" title="#object (instance method)">#<strong>object</strong> ⇒ Object </a>
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
</span>
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
<span class="note title readonly">readonly</span>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
<span class="summary_desc"><div class='inline'>
|
151
|
+
<p>the object we are saving.</p>
|
152
|
+
</div></span>
|
153
|
+
|
154
|
+
</li>
|
155
|
+
|
156
|
+
|
157
|
+
</ul>
|
158
|
+
|
159
|
+
|
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="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(object, deserialized_params) ⇒ ValidationResponse </a>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
</span>
|
178
|
+
|
179
|
+
|
180
|
+
<span class="note title constructor">constructor</span>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<span class="summary_desc"><div class='inline'>
|
190
|
+
<p>A new instance of ValidationResponse.</p>
|
191
|
+
</div></span>
|
192
|
+
|
193
|
+
</li>
|
194
|
+
|
195
|
+
|
196
|
+
<li class="public ">
|
197
|
+
<span class="summary_signature">
|
198
|
+
|
199
|
+
<a href="#success%3F-instance_method" title="#success? (instance method)">#<strong>success?</strong> ⇒ Boolean </a>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
</span>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
<span class="summary_desc"><div class='inline'>
|
214
|
+
<p>Check to ensure no validation errors.</p>
|
215
|
+
</div></span>
|
216
|
+
|
217
|
+
</li>
|
218
|
+
|
219
|
+
|
220
|
+
<li class="public ">
|
221
|
+
<span class="summary_signature">
|
222
|
+
|
223
|
+
<a href="#to_a-instance_method" title="#to_a (instance method)">#<strong>to_a</strong> ⇒ Array </a>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
</span>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
<span class="summary_desc"><div class='inline'>
|
238
|
+
<p>The object and success state.</p>
|
239
|
+
</div></span>
|
240
|
+
|
241
|
+
</li>
|
242
|
+
|
243
|
+
|
244
|
+
</ul>
|
245
|
+
|
246
|
+
|
247
|
+
<div id="constructor_details" class="method_details_list">
|
248
|
+
<h2>Constructor Details</h2>
|
249
|
+
|
250
|
+
<div class="method_details first">
|
251
|
+
<h3 class="signature first" id="initialize-instance_method">
|
252
|
+
|
253
|
+
#<strong>initialize</strong>(object, deserialized_params) ⇒ <tt><span class='object_link'><a href="" title="JsonapiCompliable::Util::ValidationResponse (class)">ValidationResponse</a></span></tt>
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
</h3><div class="docstring">
|
260
|
+
<div class="discussion">
|
261
|
+
|
262
|
+
<p>Returns a new instance of ValidationResponse</p>
|
263
|
+
|
264
|
+
|
265
|
+
</div>
|
266
|
+
</div>
|
267
|
+
<div class="tags">
|
268
|
+
<p class="tag_title">Parameters:</p>
|
269
|
+
<ul class="param">
|
270
|
+
|
271
|
+
<li>
|
272
|
+
|
273
|
+
<span class='name'>object</span>
|
274
|
+
|
275
|
+
|
276
|
+
<span class='type'></span>
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
—
|
281
|
+
<div class='inline'>
|
282
|
+
<p>the model instance we tried to save</p>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
</li>
|
286
|
+
|
287
|
+
<li>
|
288
|
+
|
289
|
+
<span class='name'>deserialized_params</span>
|
290
|
+
|
291
|
+
|
292
|
+
<span class='type'></span>
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
—
|
297
|
+
<div class='inline'>
|
298
|
+
<p>see Base#deserialized_params</p>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
</li>
|
302
|
+
|
303
|
+
</ul>
|
304
|
+
|
305
|
+
|
306
|
+
</div><table class="source_code">
|
307
|
+
<tr>
|
308
|
+
<td>
|
309
|
+
<pre class="lines">
|
310
|
+
|
311
|
+
|
312
|
+
17
|
313
|
+
18
|
314
|
+
19
|
315
|
+
20</pre>
|
316
|
+
</td>
|
317
|
+
<td>
|
318
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/validation_response.rb', line 17</span>
|
319
|
+
|
320
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_deserialized_params'>deserialized_params</span><span class='rparen'>)</span>
|
321
|
+
<span class='ivar'>@object</span> <span class='op'>=</span> <span class='id identifier rubyid_object'>object</span>
|
322
|
+
<span class='ivar'>@deserialized_params</span> <span class='op'>=</span> <span class='id identifier rubyid_deserialized_params'>deserialized_params</span>
|
323
|
+
<span class='kw'>end</span></pre>
|
324
|
+
</td>
|
325
|
+
</tr>
|
326
|
+
</table>
|
327
|
+
</div>
|
328
|
+
|
329
|
+
</div>
|
330
|
+
|
331
|
+
<div id="instance_attr_details" class="attr_details">
|
332
|
+
<h2>Instance Attribute Details</h2>
|
333
|
+
|
334
|
+
|
335
|
+
<span id=""></span>
|
336
|
+
<div class="method_details first">
|
337
|
+
<h3 class="signature first" id="object-instance_method">
|
338
|
+
|
339
|
+
#<strong>object</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
</h3><div class="docstring">
|
346
|
+
<div class="discussion">
|
347
|
+
|
348
|
+
<p>the object we are saving</p>
|
349
|
+
|
350
|
+
|
351
|
+
</div>
|
352
|
+
</div>
|
353
|
+
<div class="tags">
|
354
|
+
|
355
|
+
<p class="tag_title">Returns:</p>
|
356
|
+
<ul class="return">
|
357
|
+
|
358
|
+
<li>
|
359
|
+
|
360
|
+
|
361
|
+
<span class='type'>(<tt>Object</tt>)</span>
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
—
|
366
|
+
<div class='inline'>
|
367
|
+
<p>the current value of object</p>
|
368
|
+
</div>
|
369
|
+
|
370
|
+
</li>
|
371
|
+
|
372
|
+
</ul>
|
373
|
+
|
374
|
+
</div><table class="source_code">
|
375
|
+
<tr>
|
376
|
+
<td>
|
377
|
+
<pre class="lines">
|
378
|
+
|
379
|
+
|
380
|
+
12
|
381
|
+
13
|
382
|
+
14</pre>
|
383
|
+
</td>
|
384
|
+
<td>
|
385
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/validation_response.rb', line 12</span>
|
386
|
+
|
387
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_object'>object</span>
|
388
|
+
<span class='ivar'>@object</span>
|
389
|
+
<span class='kw'>end</span></pre>
|
390
|
+
</td>
|
391
|
+
</tr>
|
392
|
+
</table>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
</div>
|
396
|
+
|
397
|
+
|
398
|
+
<div id="instance_method_details" class="method_details_list">
|
399
|
+
<h2>Instance Method Details</h2>
|
400
|
+
|
401
|
+
|
402
|
+
<div class="method_details first">
|
403
|
+
<h3 class="signature first" id="success?-instance_method">
|
404
|
+
|
405
|
+
#<strong>success?</strong> ⇒ <tt>Boolean</tt>
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
|
411
|
+
</h3><div class="docstring">
|
412
|
+
<div class="discussion">
|
413
|
+
|
414
|
+
<p>Check to ensure no validation errors.</p>
|
415
|
+
|
416
|
+
|
417
|
+
</div>
|
418
|
+
</div>
|
419
|
+
<div class="tags">
|
420
|
+
|
421
|
+
<p class="tag_title">Returns:</p>
|
422
|
+
<ul class="return">
|
423
|
+
|
424
|
+
<li>
|
425
|
+
|
426
|
+
|
427
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
428
|
+
|
429
|
+
|
430
|
+
|
431
|
+
—
|
432
|
+
<div class='inline'>
|
433
|
+
<p>did the persistence call succeed?</p>
|
434
|
+
</div>
|
435
|
+
|
436
|
+
</li>
|
437
|
+
|
438
|
+
</ul>
|
439
|
+
|
440
|
+
</div><table class="source_code">
|
441
|
+
<tr>
|
442
|
+
<td>
|
443
|
+
<pre class="lines">
|
444
|
+
|
445
|
+
|
446
|
+
24
|
447
|
+
25
|
448
|
+
26</pre>
|
449
|
+
</td>
|
450
|
+
<td>
|
451
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/validation_response.rb', line 24</span>
|
452
|
+
|
453
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_success?'>success?</span>
|
454
|
+
<span class='id identifier rubyid_all_valid?'>all_valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='ivar'>@deserialized_params</span><span class='period'>.</span><span class='id identifier rubyid_relationships'>relationships</span><span class='rparen'>)</span>
|
455
|
+
<span class='kw'>end</span></pre>
|
456
|
+
</td>
|
457
|
+
</tr>
|
458
|
+
</table>
|
459
|
+
</div>
|
460
|
+
|
461
|
+
<div class="method_details ">
|
462
|
+
<h3 class="signature " id="to_a-instance_method">
|
463
|
+
|
464
|
+
#<strong>to_a</strong> ⇒ <tt>Array</tt>
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
</h3><div class="docstring">
|
471
|
+
<div class="discussion">
|
472
|
+
|
473
|
+
<p>Returns the object and success state</p>
|
474
|
+
|
475
|
+
|
476
|
+
</div>
|
477
|
+
</div>
|
478
|
+
<div class="tags">
|
479
|
+
|
480
|
+
<p class="tag_title">Returns:</p>
|
481
|
+
<ul class="return">
|
482
|
+
|
483
|
+
<li>
|
484
|
+
|
485
|
+
|
486
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
—
|
491
|
+
<div class='inline'>
|
492
|
+
<p>the object and success state</p>
|
493
|
+
</div>
|
494
|
+
|
495
|
+
</li>
|
496
|
+
|
497
|
+
</ul>
|
498
|
+
|
499
|
+
</div><table class="source_code">
|
500
|
+
<tr>
|
501
|
+
<td>
|
502
|
+
<pre class="lines">
|
503
|
+
|
504
|
+
|
505
|
+
29
|
506
|
+
30
|
507
|
+
31</pre>
|
508
|
+
</td>
|
509
|
+
<td>
|
510
|
+
<pre class="code"><span class="info file"># File 'lib/jsonapi_compliable/util/validation_response.rb', line 29</span>
|
511
|
+
|
512
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_a'>to_a</span>
|
513
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_object'>object</span><span class='comma'>,</span> <span class='id identifier rubyid_success?'>success?</span><span class='rbracket'>]</span>
|
514
|
+
<span class='kw'>end</span></pre>
|
515
|
+
</td>
|
516
|
+
</tr>
|
517
|
+
</table>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
</div>
|
521
|
+
|
522
|
+
</div>
|
523
|
+
|
524
|
+
<div id="footer">
|
525
|
+
Generated on Fri May 5 15:53:23 2017 by
|
526
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
527
|
+
0.9.9 (ruby-2.3.0).
|
528
|
+
</div>
|
529
|
+
|
530
|
+
</div>
|
531
|
+
</body>
|
532
|
+
</html>
|