gqli 0.1.0
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 +7 -0
- data/.gitignore +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +31 -0
- data/.rubocop_todo.yml +44 -0
- data/.travis.yml +13 -0
- data/.yardopts +4 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +154 -0
- data/Guardfile +24 -0
- data/LICENSE.txt +21 -0
- data/README.md +284 -0
- data/Rakefile +33 -0
- data/coverage/.last_run.json +5 -0
- data/coverage/.resultset.json +512 -0
- data/coverage/.resultset.json.lock +0 -0
- data/coverage/assets/0.10.2/application.css +799 -0
- data/coverage/assets/0.10.2/application.js +1707 -0
- data/coverage/assets/0.10.2/colorbox/border.png +0 -0
- data/coverage/assets/0.10.2/colorbox/controls.png +0 -0
- data/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
- data/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.10.2/favicon_green.png +0 -0
- data/coverage/assets/0.10.2/favicon_red.png +0 -0
- data/coverage/assets/0.10.2/favicon_yellow.png +0 -0
- data/coverage/assets/0.10.2/loading.gif +0 -0
- data/coverage/assets/0.10.2/magnify.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +3255 -0
- data/doc/GQLi/Base.html +628 -0
- data/doc/GQLi/Client.html +830 -0
- data/doc/GQLi/DSL.html +421 -0
- data/doc/GQLi/Fragment.html +405 -0
- data/doc/GQLi/Introspection.html +837 -0
- data/doc/GQLi/Node.html +413 -0
- data/doc/GQLi/Query.html +390 -0
- data/doc/GQLi/Response.html +370 -0
- data/doc/GQLi.html +157 -0
- data/doc/_index.html +236 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +496 -0
- data/doc/file.CHANGELOG.html +76 -0
- data/doc/file.LICENSE.html +70 -0
- data/doc/file.README.html +365 -0
- data/doc/file_list.html +66 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +365 -0
- data/doc/js/app.js +292 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +355 -0
- data/doc/top-level-namespace.html +110 -0
- data/gqli.gemspec +37 -0
- data/lib/gqli/base.rb +53 -0
- data/lib/gqli/client.rb +59 -0
- data/lib/gqli/dsl.rb +37 -0
- data/lib/gqli/fragment.rb +25 -0
- data/lib/gqli/introspection.rb +215 -0
- data/lib/gqli/node.rb +48 -0
- data/lib/gqli/query.rb +29 -0
- data/lib/gqli/response.rb +15 -0
- data/lib/gqli/version.rb +7 -0
- data/lib/gqli.rb +6 -0
- data/spec/fixtures/vcr_cassettes/catCollection.yml +63 -0
- data/spec/fixtures/vcr_cassettes/client.yml +171 -0
- data/spec/fixtures/vcr_cassettes/validation_error.yml +62 -0
- data/spec/lib/gqli/client_spec.rb +90 -0
- data/spec/lib/gqli/dsl_spec.rb +205 -0
- data/spec/lib/gqli/introspection_spec.rb +125 -0
- data/spec/spec_helper.rb +25 -0
- data/usage.rb +100 -0
- data/usage_introspection.rb +63 -0
- data/usage_with_inlined_dsl.rb +69 -0
- metadata +387 -0
|
@@ -0,0 +1,830 @@
|
|
|
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: GQLi::Client
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.9.16
|
|
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 = "GQLi::Client";
|
|
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 (C)</a> »
|
|
40
|
+
<span class='title'><span class='object_link'><a href="../GQLi.html" title="GQLi (module)">GQLi</a></span></span>
|
|
41
|
+
»
|
|
42
|
+
<span class="title">Client</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: GQLi::Client
|
|
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">GQLi::Client</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/gqli/client.rb</dd>
|
|
98
|
+
</dl>
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
|
103
|
+
<div class="discussion">
|
|
104
|
+
|
|
105
|
+
<p>GraphQL HTTP Client</p>
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="tags">
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
|
118
|
+
<ul class="summary">
|
|
119
|
+
|
|
120
|
+
<li class="public ">
|
|
121
|
+
<span class="summary_signature">
|
|
122
|
+
|
|
123
|
+
<a href="#headers-instance_method" title="#headers (instance method)">#<strong>headers</strong> ⇒ Object </a>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
</span>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
<span class="note title readonly">readonly</span>
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
<span class="summary_desc"><div class='inline'>
|
|
143
|
+
<p>Returns the value of attribute headers.</p>
|
|
144
|
+
</div></span>
|
|
145
|
+
|
|
146
|
+
</li>
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
<li class="public ">
|
|
150
|
+
<span class="summary_signature">
|
|
151
|
+
|
|
152
|
+
<a href="#params-instance_method" title="#params (instance method)">#<strong>params</strong> ⇒ Object </a>
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
</span>
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
<span class="note title readonly">readonly</span>
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
<span class="summary_desc"><div class='inline'>
|
|
172
|
+
<p>Returns the value of attribute params.</p>
|
|
173
|
+
</div></span>
|
|
174
|
+
|
|
175
|
+
</li>
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
<li class="public ">
|
|
179
|
+
<span class="summary_signature">
|
|
180
|
+
|
|
181
|
+
<a href="#schema-instance_method" title="#schema (instance method)">#<strong>schema</strong> ⇒ Object </a>
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
</span>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
<span class="note title readonly">readonly</span>
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
<span class="summary_desc"><div class='inline'>
|
|
201
|
+
<p>Returns the value of attribute schema.</p>
|
|
202
|
+
</div></span>
|
|
203
|
+
|
|
204
|
+
</li>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
<li class="public ">
|
|
208
|
+
<span class="summary_signature">
|
|
209
|
+
|
|
210
|
+
<a href="#url-instance_method" title="#url (instance method)">#<strong>url</strong> ⇒ Object </a>
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
</span>
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
<span class="note title readonly">readonly</span>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
<span class="summary_desc"><div class='inline'>
|
|
230
|
+
<p>Returns the value of attribute url.</p>
|
|
231
|
+
</div></span>
|
|
232
|
+
|
|
233
|
+
</li>
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
<li class="public ">
|
|
237
|
+
<span class="summary_signature">
|
|
238
|
+
|
|
239
|
+
<a href="#validate_query-instance_method" title="#validate_query (instance method)">#<strong>validate_query</strong> ⇒ Object </a>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
</span>
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
<span class="note title readonly">readonly</span>
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
<span class="summary_desc"><div class='inline'>
|
|
259
|
+
<p>Returns the value of attribute validate_query.</p>
|
|
260
|
+
</div></span>
|
|
261
|
+
|
|
262
|
+
</li>
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
</ul>
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
<h2>
|
|
272
|
+
Instance Method Summary
|
|
273
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
|
274
|
+
</h2>
|
|
275
|
+
|
|
276
|
+
<ul class="summary">
|
|
277
|
+
|
|
278
|
+
<li class="public ">
|
|
279
|
+
<span class="summary_signature">
|
|
280
|
+
|
|
281
|
+
<a href="#execute-instance_method" title="#execute (instance method)">#<strong>execute</strong>(query) ⇒ Object </a>
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
</span>
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
<span class="summary_desc"><div class='inline'>
|
|
296
|
+
<p>Executes a query If validations are enabled, will perform validation check
|
|
297
|
+
before request.</p>
|
|
298
|
+
</div></span>
|
|
299
|
+
|
|
300
|
+
</li>
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
<li class="public ">
|
|
304
|
+
<span class="summary_signature">
|
|
305
|
+
|
|
306
|
+
<a href="#execute!-instance_method" title="#execute! (instance method)">#<strong>execute!</strong>(query) ⇒ Object </a>
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
</span>
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
<span class="summary_desc"><div class='inline'>
|
|
321
|
+
<p>Executres a query Ignores validations.</p>
|
|
322
|
+
</div></span>
|
|
323
|
+
|
|
324
|
+
</li>
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
<li class="public ">
|
|
328
|
+
<span class="summary_signature">
|
|
329
|
+
|
|
330
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(url, params: {}, headers: {}, validate_query: true) ⇒ Client </a>
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
</span>
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
<span class="note title constructor">constructor</span>
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
<span class="summary_desc"><div class='inline'>
|
|
347
|
+
<p>A new instance of Client.</p>
|
|
348
|
+
</div></span>
|
|
349
|
+
|
|
350
|
+
</li>
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
<li class="public ">
|
|
354
|
+
<span class="summary_signature">
|
|
355
|
+
|
|
356
|
+
<a href="#valid%3F-instance_method" title="#valid? (instance method)">#<strong>valid?</strong>(query) ⇒ Boolean </a>
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
</span>
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
<span class="summary_desc"><div class='inline'>
|
|
371
|
+
<p>Validates a query against the schema.</p>
|
|
372
|
+
</div></span>
|
|
373
|
+
|
|
374
|
+
</li>
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
</ul>
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
<div id="constructor_details" class="method_details_list">
|
|
381
|
+
<h2>Constructor Details</h2>
|
|
382
|
+
|
|
383
|
+
<div class="method_details first">
|
|
384
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
385
|
+
|
|
386
|
+
#<strong>initialize</strong>(url, params: {}, headers: {}, validate_query: true) ⇒ <tt><span class='object_link'><a href="" title="GQLi::Client (class)">Client</a></span></tt>
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
</h3><div class="docstring">
|
|
393
|
+
<div class="discussion">
|
|
394
|
+
|
|
395
|
+
<p>Returns a new instance of Client</p>
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
400
|
+
<div class="tags">
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
</div><table class="source_code">
|
|
404
|
+
<tr>
|
|
405
|
+
<td>
|
|
406
|
+
<pre class="lines">
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
14
|
|
410
|
+
15
|
|
411
|
+
16
|
|
412
|
+
17
|
|
413
|
+
18
|
|
414
|
+
19
|
|
415
|
+
20
|
|
416
|
+
21</pre>
|
|
417
|
+
</td>
|
|
418
|
+
<td>
|
|
419
|
+
<pre class="code"><span class="info file"># File 'lib/gqli/client.rb', line 14</span>
|
|
420
|
+
|
|
421
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>headers:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='label'>validate_query:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
|
422
|
+
<span class='ivar'>@url</span> <span class='op'>=</span> <span class='id identifier rubyid_url'>url</span>
|
|
423
|
+
<span class='ivar'>@params</span> <span class='op'>=</span> <span class='id identifier rubyid_params'>params</span>
|
|
424
|
+
<span class='ivar'>@headers</span> <span class='op'>=</span> <span class='id identifier rubyid_headers'>headers</span>
|
|
425
|
+
<span class='ivar'>@validate_query</span> <span class='op'>=</span> <span class='id identifier rubyid_validate_query'>validate_query</span>
|
|
426
|
+
|
|
427
|
+
<span class='ivar'>@schema</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Introspection.html" title="GQLi::Introspection (class)">Introspection</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Introspection.html#initialize-instance_method" title="GQLi::Introspection#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='kw'>self</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_validate_query'>validate_query</span>
|
|
428
|
+
<span class='kw'>end</span></pre>
|
|
429
|
+
</td>
|
|
430
|
+
</tr>
|
|
431
|
+
</table>
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
</div>
|
|
435
|
+
|
|
436
|
+
<div id="instance_attr_details" class="attr_details">
|
|
437
|
+
<h2>Instance Attribute Details</h2>
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
<span id=""></span>
|
|
441
|
+
<div class="method_details first">
|
|
442
|
+
<h3 class="signature first" id="headers-instance_method">
|
|
443
|
+
|
|
444
|
+
#<strong>headers</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
</h3><div class="docstring">
|
|
451
|
+
<div class="discussion">
|
|
452
|
+
|
|
453
|
+
<p>Returns the value of attribute headers</p>
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
</div>
|
|
457
|
+
</div>
|
|
458
|
+
<div class="tags">
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
</div><table class="source_code">
|
|
462
|
+
<tr>
|
|
463
|
+
<td>
|
|
464
|
+
<pre class="lines">
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
12
|
|
468
|
+
13
|
|
469
|
+
14</pre>
|
|
470
|
+
</td>
|
|
471
|
+
<td>
|
|
472
|
+
<pre class="code"><span class="info file"># File 'lib/gqli/client.rb', line 12</span>
|
|
473
|
+
|
|
474
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_headers'>headers</span>
|
|
475
|
+
<span class='ivar'>@headers</span>
|
|
476
|
+
<span class='kw'>end</span></pre>
|
|
477
|
+
</td>
|
|
478
|
+
</tr>
|
|
479
|
+
</table>
|
|
480
|
+
</div>
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
<span id=""></span>
|
|
484
|
+
<div class="method_details ">
|
|
485
|
+
<h3 class="signature " id="params-instance_method">
|
|
486
|
+
|
|
487
|
+
#<strong>params</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
</h3><div class="docstring">
|
|
494
|
+
<div class="discussion">
|
|
495
|
+
|
|
496
|
+
<p>Returns the value of attribute params</p>
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
</div>
|
|
500
|
+
</div>
|
|
501
|
+
<div class="tags">
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+
</div><table class="source_code">
|
|
505
|
+
<tr>
|
|
506
|
+
<td>
|
|
507
|
+
<pre class="lines">
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
12
|
|
511
|
+
13
|
|
512
|
+
14</pre>
|
|
513
|
+
</td>
|
|
514
|
+
<td>
|
|
515
|
+
<pre class="code"><span class="info file"># File 'lib/gqli/client.rb', line 12</span>
|
|
516
|
+
|
|
517
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_params'>params</span>
|
|
518
|
+
<span class='ivar'>@params</span>
|
|
519
|
+
<span class='kw'>end</span></pre>
|
|
520
|
+
</td>
|
|
521
|
+
</tr>
|
|
522
|
+
</table>
|
|
523
|
+
</div>
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
<span id=""></span>
|
|
527
|
+
<div class="method_details ">
|
|
528
|
+
<h3 class="signature " id="schema-instance_method">
|
|
529
|
+
|
|
530
|
+
#<strong>schema</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
</h3><div class="docstring">
|
|
537
|
+
<div class="discussion">
|
|
538
|
+
|
|
539
|
+
<p>Returns the value of attribute schema</p>
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
</div>
|
|
543
|
+
</div>
|
|
544
|
+
<div class="tags">
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
</div><table class="source_code">
|
|
548
|
+
<tr>
|
|
549
|
+
<td>
|
|
550
|
+
<pre class="lines">
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
12
|
|
554
|
+
13
|
|
555
|
+
14</pre>
|
|
556
|
+
</td>
|
|
557
|
+
<td>
|
|
558
|
+
<pre class="code"><span class="info file"># File 'lib/gqli/client.rb', line 12</span>
|
|
559
|
+
|
|
560
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_schema'>schema</span>
|
|
561
|
+
<span class='ivar'>@schema</span>
|
|
562
|
+
<span class='kw'>end</span></pre>
|
|
563
|
+
</td>
|
|
564
|
+
</tr>
|
|
565
|
+
</table>
|
|
566
|
+
</div>
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
<span id=""></span>
|
|
570
|
+
<div class="method_details ">
|
|
571
|
+
<h3 class="signature " id="url-instance_method">
|
|
572
|
+
|
|
573
|
+
#<strong>url</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
</h3><div class="docstring">
|
|
580
|
+
<div class="discussion">
|
|
581
|
+
|
|
582
|
+
<p>Returns the value of attribute url</p>
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
</div>
|
|
586
|
+
</div>
|
|
587
|
+
<div class="tags">
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
</div><table class="source_code">
|
|
591
|
+
<tr>
|
|
592
|
+
<td>
|
|
593
|
+
<pre class="lines">
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
12
|
|
597
|
+
13
|
|
598
|
+
14</pre>
|
|
599
|
+
</td>
|
|
600
|
+
<td>
|
|
601
|
+
<pre class="code"><span class="info file"># File 'lib/gqli/client.rb', line 12</span>
|
|
602
|
+
|
|
603
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_url'>url</span>
|
|
604
|
+
<span class='ivar'>@url</span>
|
|
605
|
+
<span class='kw'>end</span></pre>
|
|
606
|
+
</td>
|
|
607
|
+
</tr>
|
|
608
|
+
</table>
|
|
609
|
+
</div>
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
<span id=""></span>
|
|
613
|
+
<div class="method_details ">
|
|
614
|
+
<h3 class="signature " id="validate_query-instance_method">
|
|
615
|
+
|
|
616
|
+
#<strong>validate_query</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
</h3><div class="docstring">
|
|
623
|
+
<div class="discussion">
|
|
624
|
+
|
|
625
|
+
<p>Returns the value of attribute validate_query</p>
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
</div>
|
|
629
|
+
</div>
|
|
630
|
+
<div class="tags">
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
</div><table class="source_code">
|
|
634
|
+
<tr>
|
|
635
|
+
<td>
|
|
636
|
+
<pre class="lines">
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
12
|
|
640
|
+
13
|
|
641
|
+
14</pre>
|
|
642
|
+
</td>
|
|
643
|
+
<td>
|
|
644
|
+
<pre class="code"><span class="info file"># File 'lib/gqli/client.rb', line 12</span>
|
|
645
|
+
|
|
646
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_validate_query'>validate_query</span>
|
|
647
|
+
<span class='ivar'>@validate_query</span>
|
|
648
|
+
<span class='kw'>end</span></pre>
|
|
649
|
+
</td>
|
|
650
|
+
</tr>
|
|
651
|
+
</table>
|
|
652
|
+
</div>
|
|
653
|
+
|
|
654
|
+
</div>
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
<div id="instance_method_details" class="method_details_list">
|
|
658
|
+
<h2>Instance Method Details</h2>
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
<div class="method_details first">
|
|
662
|
+
<h3 class="signature first" id="execute-instance_method">
|
|
663
|
+
|
|
664
|
+
#<strong>execute</strong>(query) ⇒ <tt>Object</tt>
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
</h3><div class="docstring">
|
|
671
|
+
<div class="discussion">
|
|
672
|
+
|
|
673
|
+
<p>Executes a query If validations are enabled, will perform validation check
|
|
674
|
+
before request.</p>
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
</div>
|
|
678
|
+
</div>
|
|
679
|
+
<div class="tags">
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
</div><table class="source_code">
|
|
683
|
+
<tr>
|
|
684
|
+
<td>
|
|
685
|
+
<pre class="lines">
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
25
|
|
689
|
+
26
|
|
690
|
+
27
|
|
691
|
+
28
|
|
692
|
+
29</pre>
|
|
693
|
+
</td>
|
|
694
|
+
<td>
|
|
695
|
+
<pre class="code"><span class="info file"># File 'lib/gqli/client.rb', line 25</span>
|
|
696
|
+
|
|
697
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_execute'>execute</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
698
|
+
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Validation Error: query is invalid - HTTP Request not sent</span><span class='tstring_end'>'</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
699
|
+
|
|
700
|
+
<span class='id identifier rubyid_execute!'>execute!</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
701
|
+
<span class='kw'>end</span></pre>
|
|
702
|
+
</td>
|
|
703
|
+
</tr>
|
|
704
|
+
</table>
|
|
705
|
+
</div>
|
|
706
|
+
|
|
707
|
+
<div class="method_details ">
|
|
708
|
+
<h3 class="signature " id="execute!-instance_method">
|
|
709
|
+
|
|
710
|
+
#<strong>execute!</strong>(query) ⇒ <tt>Object</tt>
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
</h3><div class="docstring">
|
|
717
|
+
<div class="discussion">
|
|
718
|
+
|
|
719
|
+
<p>Executres a query Ignores validations</p>
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
</div>
|
|
723
|
+
</div>
|
|
724
|
+
<div class="tags">
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
</div><table class="source_code">
|
|
728
|
+
<tr>
|
|
729
|
+
<td>
|
|
730
|
+
<pre class="lines">
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
33
|
|
734
|
+
34
|
|
735
|
+
35
|
|
736
|
+
36
|
|
737
|
+
37
|
|
738
|
+
38
|
|
739
|
+
39
|
|
740
|
+
40
|
|
741
|
+
41</pre>
|
|
742
|
+
</td>
|
|
743
|
+
<td>
|
|
744
|
+
<pre class="code"><span class="info file"># File 'lib/gqli/client.rb', line 33</span>
|
|
745
|
+
|
|
746
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_execute!'>execute!</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
747
|
+
<span class='id identifier rubyid_http_response'>http_response</span> <span class='op'>=</span> <span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_headers'>headers</span><span class='lparen'>(</span><span class='id identifier rubyid_request_headers'>request_headers</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='ivar'>@url</span><span class='comma'>,</span> <span class='label'>params:</span> <span class='ivar'>@params</span><span class='comma'>,</span> <span class='label'>json:</span> <span class='lbrace'>{</span> <span class='label'>query:</span> <span class='id identifier rubyid_query'>query</span><span class='period'>.</span><span class='id identifier rubyid_to_gql'>to_gql</span> <span class='rbrace'>}</span><span class='rparen'>)</span>
|
|
748
|
+
|
|
749
|
+
<span class='id identifier rubyid_fail'>fail</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Error: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_http_response'>http_response</span><span class='period'>.</span><span class='id identifier rubyid_reason'>reason</span><span class='embexpr_end'>}</span><span class='tstring_content'>\nBody: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_http_response'>http_response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_http_response'>http_response</span><span class='period'>.</span><span class='id identifier rubyid_status'>status</span> <span class='op'>>=</span> <span class='int'>300</span>
|
|
750
|
+
|
|
751
|
+
<span class='id identifier rubyid_data'>data</span> <span class='op'>=</span> <span class='const'>JSON</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_http_response'>http_response</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
|
752
|
+
|
|
753
|
+
<span class='const'><span class='object_link'><a href="Response.html" title="GQLi::Response (class)">Response</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="Response.html#initialize-instance_method" title="GQLi::Response#initialize (method)">new</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
754
|
+
<span class='kw'>end</span></pre>
|
|
755
|
+
</td>
|
|
756
|
+
</tr>
|
|
757
|
+
</table>
|
|
758
|
+
</div>
|
|
759
|
+
|
|
760
|
+
<div class="method_details ">
|
|
761
|
+
<h3 class="signature " id="valid?-instance_method">
|
|
762
|
+
|
|
763
|
+
#<strong>valid?</strong>(query) ⇒ <tt>Boolean</tt>
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
</h3><div class="docstring">
|
|
770
|
+
<div class="discussion">
|
|
771
|
+
|
|
772
|
+
<p>Validates a query against the schema</p>
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
</div>
|
|
776
|
+
</div>
|
|
777
|
+
<div class="tags">
|
|
778
|
+
|
|
779
|
+
<p class="tag_title">Returns:</p>
|
|
780
|
+
<ul class="return">
|
|
781
|
+
|
|
782
|
+
<li>
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
</li>
|
|
790
|
+
|
|
791
|
+
</ul>
|
|
792
|
+
|
|
793
|
+
</div><table class="source_code">
|
|
794
|
+
<tr>
|
|
795
|
+
<td>
|
|
796
|
+
<pre class="lines">
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
44
|
|
800
|
+
45
|
|
801
|
+
46
|
|
802
|
+
47
|
|
803
|
+
48</pre>
|
|
804
|
+
</td>
|
|
805
|
+
<td>
|
|
806
|
+
<pre class="code"><span class="info file"># File 'lib/gqli/client.rb', line 44</span>
|
|
807
|
+
|
|
808
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
809
|
+
<span class='kw'>return</span> <span class='kw'>true</span> <span class='kw'>unless</span> <span class='id identifier rubyid_validate_query'>validate_query</span>
|
|
810
|
+
|
|
811
|
+
<span class='ivar'>@schema</span><span class='period'>.</span><span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
812
|
+
<span class='kw'>end</span></pre>
|
|
813
|
+
</td>
|
|
814
|
+
</tr>
|
|
815
|
+
</table>
|
|
816
|
+
</div>
|
|
817
|
+
|
|
818
|
+
</div>
|
|
819
|
+
|
|
820
|
+
</div>
|
|
821
|
+
|
|
822
|
+
<div id="footer">
|
|
823
|
+
Generated on Mon Oct 15 13:10:42 2018 by
|
|
824
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
825
|
+
0.9.16 (ruby-2.5.1).
|
|
826
|
+
</div>
|
|
827
|
+
|
|
828
|
+
</div>
|
|
829
|
+
</body>
|
|
830
|
+
</html>
|