gqli 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/coverage/index.html
ADDED
@@ -0,0 +1,3255 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html xmlns='http://www.w3.org/1999/xhtml'>
|
3
|
+
<head>
|
4
|
+
<title>Code coverage for Gqli</title>
|
5
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6
|
+
<script src='./assets/0.10.2/application.js' type='text/javascript'></script>
|
7
|
+
<link href='./assets/0.10.2/application.css' media='screen, projection, print' rel='stylesheet' type='text/css'>
|
8
|
+
<link rel="shortcut icon" type="image/png" href="./assets/0.10.2/favicon_green.png" />
|
9
|
+
<link rel="icon" type="image/png" href="./assets/0.10.2/favicon.png" />
|
10
|
+
</head>
|
11
|
+
|
12
|
+
<body>
|
13
|
+
<div id="loading">
|
14
|
+
<img src="./assets/0.10.2/loading.gif" alt="loading"/>
|
15
|
+
</div>
|
16
|
+
<div id="wrapper" style="display:none;">
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2018-10-15T13:10:45+02:00">2018-10-15T13:10:45+02:00</abbr></div>
|
18
|
+
<ul class="group_tabs"></ul>
|
19
|
+
|
20
|
+
<div id="content">
|
21
|
+
<div class="file_list_container" id="AllFiles">
|
22
|
+
<h2>
|
23
|
+
<span class="group_name">All Files</span>
|
24
|
+
(<span class="covered_percent"><span class="green">94.02%</span></span>
|
25
|
+
covered at
|
26
|
+
<span class="covered_strength">
|
27
|
+
<span class="green">
|
28
|
+
33.66
|
29
|
+
</span>
|
30
|
+
</span> hits/line)
|
31
|
+
</h2>
|
32
|
+
<a name="AllFiles"></a>
|
33
|
+
<div>
|
34
|
+
<b>9</b> files in total.
|
35
|
+
<b>251</b> relevant lines.
|
36
|
+
<span class="green"><b>236</b> lines covered</span> and
|
37
|
+
<span class="red"><b>15</b> lines missed </span>
|
38
|
+
</div>
|
39
|
+
<table class="file_list">
|
40
|
+
<thead>
|
41
|
+
<tr>
|
42
|
+
<th>File</th>
|
43
|
+
<th>% covered</th>
|
44
|
+
<th>Lines</th>
|
45
|
+
<th>Relevant Lines</th>
|
46
|
+
<th>Lines covered</th>
|
47
|
+
<th>Lines missed</th>
|
48
|
+
<th>Avg. Hits / Line</th>
|
49
|
+
</tr>
|
50
|
+
</thead>
|
51
|
+
<tbody>
|
52
|
+
|
53
|
+
<tr>
|
54
|
+
<td class="strong"><a href="#c4c0ccce18d53f019a15391e06762c3a041e5bae" class="src_link" title="lib/gqli.rb">lib/gqli.rb</a></td>
|
55
|
+
<td class="green strong">100.0 %</td>
|
56
|
+
<td>6</td>
|
57
|
+
<td>4</td>
|
58
|
+
<td>4</td>
|
59
|
+
<td>0</td>
|
60
|
+
<td>1.0</td>
|
61
|
+
</tr>
|
62
|
+
|
63
|
+
<tr>
|
64
|
+
<td class="strong"><a href="#a60af6e9955575ceef3cab9bd3242b9048fa6845" class="src_link" title="lib/gqli/base.rb">lib/gqli/base.rb</a></td>
|
65
|
+
<td class="green strong">100.0 %</td>
|
66
|
+
<td>53</td>
|
67
|
+
<td>27</td>
|
68
|
+
<td>27</td>
|
69
|
+
<td>0</td>
|
70
|
+
<td>85.3</td>
|
71
|
+
</tr>
|
72
|
+
|
73
|
+
<tr>
|
74
|
+
<td class="strong"><a href="#68dcd39c86205e255ffb6dcb92fa9f24c6f7d923" class="src_link" title="lib/gqli/client.rb">lib/gqli/client.rb</a></td>
|
75
|
+
<td class="yellow strong">85.71 %</td>
|
76
|
+
<td>59</td>
|
77
|
+
<td>28</td>
|
78
|
+
<td>24</td>
|
79
|
+
<td>4</td>
|
80
|
+
<td>3.4</td>
|
81
|
+
</tr>
|
82
|
+
|
83
|
+
<tr>
|
84
|
+
<td class="strong"><a href="#9abd05ccff4ad7a4f5b1bb75901af6e008bc9c5d" class="src_link" title="lib/gqli/dsl.rb">lib/gqli/dsl.rb</a></td>
|
85
|
+
<td class="green strong">91.67 %</td>
|
86
|
+
<td>37</td>
|
87
|
+
<td>12</td>
|
88
|
+
<td>11</td>
|
89
|
+
<td>1</td>
|
90
|
+
<td>1.6</td>
|
91
|
+
</tr>
|
92
|
+
|
93
|
+
<tr>
|
94
|
+
<td class="strong"><a href="#049f7e831814eec17f9b96573767e0e1613dd427" class="src_link" title="lib/gqli/fragment.rb">lib/gqli/fragment.rb</a></td>
|
95
|
+
<td class="yellow strong">90.0 %</td>
|
96
|
+
<td>25</td>
|
97
|
+
<td>10</td>
|
98
|
+
<td>9</td>
|
99
|
+
<td>1</td>
|
100
|
+
<td>1.3</td>
|
101
|
+
</tr>
|
102
|
+
|
103
|
+
<tr>
|
104
|
+
<td class="strong"><a href="#07f15b56d18102110d4b398de85375295500eab7" class="src_link" title="lib/gqli/introspection.rb">lib/gqli/introspection.rb</a></td>
|
105
|
+
<td class="green strong">96.88 %</td>
|
106
|
+
<td>215</td>
|
107
|
+
<td>128</td>
|
108
|
+
<td>124</td>
|
109
|
+
<td>4</td>
|
110
|
+
<td>7.7</td>
|
111
|
+
</tr>
|
112
|
+
|
113
|
+
<tr>
|
114
|
+
<td class="strong"><a href="#827311add0f30734381233709eff6f2feef29107" class="src_link" title="lib/gqli/node.rb">lib/gqli/node.rb</a></td>
|
115
|
+
<td class="yellow strong">88.0 %</td>
|
116
|
+
<td>48</td>
|
117
|
+
<td>25</td>
|
118
|
+
<td>22</td>
|
119
|
+
<td>3</td>
|
120
|
+
<td>199.4</td>
|
121
|
+
</tr>
|
122
|
+
|
123
|
+
<tr>
|
124
|
+
<td class="strong"><a href="#add3b96d53406d04d830c517b925e60e5592500d" class="src_link" title="lib/gqli/query.rb">lib/gqli/query.rb</a></td>
|
125
|
+
<td class="red strong">80.0 %</td>
|
126
|
+
<td>29</td>
|
127
|
+
<td>10</td>
|
128
|
+
<td>8</td>
|
129
|
+
<td>2</td>
|
130
|
+
<td>2.2</td>
|
131
|
+
</tr>
|
132
|
+
|
133
|
+
<tr>
|
134
|
+
<td class="strong"><a href="#fc631e4d066aa11a78ad288ef5341c2bc5e2fd9d" class="src_link" title="lib/gqli/response.rb">lib/gqli/response.rb</a></td>
|
135
|
+
<td class="green strong">100.0 %</td>
|
136
|
+
<td>15</td>
|
137
|
+
<td>7</td>
|
138
|
+
<td>7</td>
|
139
|
+
<td>0</td>
|
140
|
+
<td>3.0</td>
|
141
|
+
</tr>
|
142
|
+
|
143
|
+
</tbody>
|
144
|
+
</table>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
</div>
|
150
|
+
|
151
|
+
<div id="footer">
|
152
|
+
Generated by <a href="http://github.com/colszowka/simplecov">simplecov</a> v0.16.1
|
153
|
+
and simplecov-html v0.10.2<br/>
|
154
|
+
using RSpec
|
155
|
+
</div>
|
156
|
+
|
157
|
+
<div class="source_files">
|
158
|
+
|
159
|
+
<div class="source_table" id="c4c0ccce18d53f019a15391e06762c3a041e5bae">
|
160
|
+
<div class="header">
|
161
|
+
<h3>lib/gqli.rb</h3>
|
162
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
163
|
+
<div>
|
164
|
+
<b>4</b> relevant lines.
|
165
|
+
<span class="green"><b>4</b> lines covered</span> and
|
166
|
+
<span class="red"><b>0</b> lines missed.</span>
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<pre>
|
171
|
+
<ol>
|
172
|
+
|
173
|
+
<li class="never" data-hits="" data-linenumber="1">
|
174
|
+
|
175
|
+
|
176
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
177
|
+
</li>
|
178
|
+
|
179
|
+
<li class="never" data-hits="" data-linenumber="2">
|
180
|
+
|
181
|
+
|
182
|
+
<code class="ruby"></code>
|
183
|
+
</li>
|
184
|
+
|
185
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
186
|
+
<span class="hits">1</span>
|
187
|
+
|
188
|
+
<code class="ruby">require_relative './gqli/dsl'</code>
|
189
|
+
</li>
|
190
|
+
|
191
|
+
<li class="covered" data-hits="1" data-linenumber="4">
|
192
|
+
<span class="hits">1</span>
|
193
|
+
|
194
|
+
<code class="ruby">require_relative './gqli/client'</code>
|
195
|
+
</li>
|
196
|
+
|
197
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
198
|
+
<span class="hits">1</span>
|
199
|
+
|
200
|
+
<code class="ruby">require_relative './gqli/introspection'</code>
|
201
|
+
</li>
|
202
|
+
|
203
|
+
<li class="covered" data-hits="1" data-linenumber="6">
|
204
|
+
<span class="hits">1</span>
|
205
|
+
|
206
|
+
<code class="ruby">require_relative './gqli/version'</code>
|
207
|
+
</li>
|
208
|
+
|
209
|
+
</ol>
|
210
|
+
</pre>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
|
214
|
+
<div class="source_table" id="a60af6e9955575ceef3cab9bd3242b9048fa6845">
|
215
|
+
<div class="header">
|
216
|
+
<h3>lib/gqli/base.rb</h3>
|
217
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
218
|
+
<div>
|
219
|
+
<b>27</b> relevant lines.
|
220
|
+
<span class="green"><b>27</b> lines covered</span> and
|
221
|
+
<span class="red"><b>0</b> lines missed.</span>
|
222
|
+
</div>
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<pre>
|
226
|
+
<ol>
|
227
|
+
|
228
|
+
<li class="never" data-hits="" data-linenumber="1">
|
229
|
+
|
230
|
+
|
231
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
232
|
+
</li>
|
233
|
+
|
234
|
+
<li class="never" data-hits="" data-linenumber="2">
|
235
|
+
|
236
|
+
|
237
|
+
<code class="ruby"></code>
|
238
|
+
</li>
|
239
|
+
|
240
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
241
|
+
<span class="hits">1</span>
|
242
|
+
|
243
|
+
<code class="ruby">module GQLi</code>
|
244
|
+
</li>
|
245
|
+
|
246
|
+
<li class="never" data-hits="" data-linenumber="4">
|
247
|
+
|
248
|
+
|
249
|
+
<code class="ruby"> # Base class for GraphQL type wrappers</code>
|
250
|
+
</li>
|
251
|
+
|
252
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
253
|
+
<span class="hits">1</span>
|
254
|
+
|
255
|
+
<code class="ruby"> class Base</code>
|
256
|
+
</li>
|
257
|
+
|
258
|
+
<li class="covered" data-hits="1" data-linenumber="6">
|
259
|
+
<span class="hits">1</span>
|
260
|
+
|
261
|
+
<code class="ruby"> attr_reader :__name, :__depth, :__nodes</code>
|
262
|
+
</li>
|
263
|
+
|
264
|
+
<li class="never" data-hits="" data-linenumber="7">
|
265
|
+
|
266
|
+
|
267
|
+
<code class="ruby"></code>
|
268
|
+
</li>
|
269
|
+
|
270
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
271
|
+
<span class="hits">1</span>
|
272
|
+
|
273
|
+
<code class="ruby"> def initialize(name = nil, depth = 0, &block)</code>
|
274
|
+
</li>
|
275
|
+
|
276
|
+
<li class="covered" data-hits="255" data-linenumber="9">
|
277
|
+
<span class="hits">255</span>
|
278
|
+
|
279
|
+
<code class="ruby"> @__name = name</code>
|
280
|
+
</li>
|
281
|
+
|
282
|
+
<li class="covered" data-hits="255" data-linenumber="10">
|
283
|
+
<span class="hits">255</span>
|
284
|
+
|
285
|
+
<code class="ruby"> @__depth = depth</code>
|
286
|
+
</li>
|
287
|
+
|
288
|
+
<li class="covered" data-hits="255" data-linenumber="11">
|
289
|
+
<span class="hits">255</span>
|
290
|
+
|
291
|
+
<code class="ruby"> @__nodes = []</code>
|
292
|
+
</li>
|
293
|
+
|
294
|
+
<li class="covered" data-hits="255" data-linenumber="12">
|
295
|
+
<span class="hits">255</span>
|
296
|
+
|
297
|
+
<code class="ruby"> instance_eval(&block) unless block.nil?</code>
|
298
|
+
</li>
|
299
|
+
|
300
|
+
<li class="never" data-hits="" data-linenumber="13">
|
301
|
+
|
302
|
+
|
303
|
+
<code class="ruby"> end</code>
|
304
|
+
</li>
|
305
|
+
|
306
|
+
<li class="never" data-hits="" data-linenumber="14">
|
307
|
+
|
308
|
+
|
309
|
+
<code class="ruby"></code>
|
310
|
+
</li>
|
311
|
+
|
312
|
+
<li class="never" data-hits="" data-linenumber="15">
|
313
|
+
|
314
|
+
|
315
|
+
<code class="ruby"> # Inlines fragment nodes into current node</code>
|
316
|
+
</li>
|
317
|
+
|
318
|
+
<li class="covered" data-hits="1" data-linenumber="16">
|
319
|
+
<span class="hits">1</span>
|
320
|
+
|
321
|
+
<code class="ruby"> def ___(fragment)</code>
|
322
|
+
</li>
|
323
|
+
|
324
|
+
<li class="covered" data-hits="8" data-linenumber="17">
|
325
|
+
<span class="hits">8</span>
|
326
|
+
|
327
|
+
<code class="ruby"> @__nodes += __clone_nodes(fragment)</code>
|
328
|
+
</li>
|
329
|
+
|
330
|
+
<li class="never" data-hits="" data-linenumber="18">
|
331
|
+
|
332
|
+
|
333
|
+
<code class="ruby"> end</code>
|
334
|
+
</li>
|
335
|
+
|
336
|
+
<li class="never" data-hits="" data-linenumber="19">
|
337
|
+
|
338
|
+
|
339
|
+
<code class="ruby"></code>
|
340
|
+
</li>
|
341
|
+
|
342
|
+
<li class="never" data-hits="" data-linenumber="20">
|
343
|
+
|
344
|
+
|
345
|
+
<code class="ruby"> # Adds type match node</code>
|
346
|
+
</li>
|
347
|
+
|
348
|
+
<li class="covered" data-hits="1" data-linenumber="21">
|
349
|
+
<span class="hits">1</span>
|
350
|
+
|
351
|
+
<code class="ruby"> def __on(type_name, &block)</code>
|
352
|
+
</li>
|
353
|
+
|
354
|
+
<li class="covered" data-hits="2" data-linenumber="22">
|
355
|
+
<span class="hits">2</span>
|
356
|
+
|
357
|
+
<code class="ruby"> require_relative './node'</code>
|
358
|
+
</li>
|
359
|
+
|
360
|
+
<li class="covered" data-hits="2" data-linenumber="23">
|
361
|
+
<span class="hits">2</span>
|
362
|
+
|
363
|
+
<code class="ruby"> @__nodes << Node.new("... on #{type_name}", [], __depth + 1, &block)</code>
|
364
|
+
</li>
|
365
|
+
|
366
|
+
<li class="never" data-hits="" data-linenumber="24">
|
367
|
+
|
368
|
+
|
369
|
+
<code class="ruby"> end</code>
|
370
|
+
</li>
|
371
|
+
|
372
|
+
<li class="never" data-hits="" data-linenumber="25">
|
373
|
+
|
374
|
+
|
375
|
+
<code class="ruby"></code>
|
376
|
+
</li>
|
377
|
+
|
378
|
+
<li class="covered" data-hits="1" data-linenumber="26">
|
379
|
+
<span class="hits">1</span>
|
380
|
+
|
381
|
+
<code class="ruby"> protected</code>
|
382
|
+
</li>
|
383
|
+
|
384
|
+
<li class="never" data-hits="" data-linenumber="27">
|
385
|
+
|
386
|
+
|
387
|
+
<code class="ruby"></code>
|
388
|
+
</li>
|
389
|
+
|
390
|
+
<li class="covered" data-hits="1" data-linenumber="28">
|
391
|
+
<span class="hits">1</span>
|
392
|
+
|
393
|
+
<code class="ruby"> def __clone_nodes(node_container)</code>
|
394
|
+
</li>
|
395
|
+
|
396
|
+
<li class="covered" data-hits="178" data-linenumber="29">
|
397
|
+
<span class="hits">178</span>
|
398
|
+
|
399
|
+
<code class="ruby"> require_relative './node'</code>
|
400
|
+
</li>
|
401
|
+
|
402
|
+
<li class="covered" data-hits="178" data-linenumber="30">
|
403
|
+
<span class="hits">178</span>
|
404
|
+
|
405
|
+
<code class="ruby"> __clone(node_container.__nodes).map do |n|</code>
|
406
|
+
</li>
|
407
|
+
|
408
|
+
<li class="covered" data-hits="170" data-linenumber="31">
|
409
|
+
<span class="hits">170</span>
|
410
|
+
|
411
|
+
<code class="ruby"> node = Node.new(n.__name, n.__params, __depth + 1)</code>
|
412
|
+
</li>
|
413
|
+
|
414
|
+
<li class="covered" data-hits="170" data-linenumber="32">
|
415
|
+
<span class="hits">170</span>
|
416
|
+
|
417
|
+
<code class="ruby"> node.instance_variable_set(</code>
|
418
|
+
</li>
|
419
|
+
|
420
|
+
<li class="never" data-hits="" data-linenumber="33">
|
421
|
+
|
422
|
+
|
423
|
+
<code class="ruby"> :@__nodes,</code>
|
424
|
+
</li>
|
425
|
+
|
426
|
+
<li class="never" data-hits="" data-linenumber="34">
|
427
|
+
|
428
|
+
|
429
|
+
<code class="ruby"> node.send(:__clone_nodes, n)</code>
|
430
|
+
</li>
|
431
|
+
|
432
|
+
<li class="never" data-hits="" data-linenumber="35">
|
433
|
+
|
434
|
+
|
435
|
+
<code class="ruby"> )</code>
|
436
|
+
</li>
|
437
|
+
|
438
|
+
<li class="covered" data-hits="170" data-linenumber="36">
|
439
|
+
<span class="hits">170</span>
|
440
|
+
|
441
|
+
<code class="ruby"> node</code>
|
442
|
+
</li>
|
443
|
+
|
444
|
+
<li class="never" data-hits="" data-linenumber="37">
|
445
|
+
|
446
|
+
|
447
|
+
<code class="ruby"> end</code>
|
448
|
+
</li>
|
449
|
+
|
450
|
+
<li class="never" data-hits="" data-linenumber="38">
|
451
|
+
|
452
|
+
|
453
|
+
<code class="ruby"> end</code>
|
454
|
+
</li>
|
455
|
+
|
456
|
+
<li class="never" data-hits="" data-linenumber="39">
|
457
|
+
|
458
|
+
|
459
|
+
<code class="ruby"></code>
|
460
|
+
</li>
|
461
|
+
|
462
|
+
<li class="covered" data-hits="1" data-linenumber="40">
|
463
|
+
<span class="hits">1</span>
|
464
|
+
|
465
|
+
<code class="ruby"> def __clone(obj)</code>
|
466
|
+
</li>
|
467
|
+
|
468
|
+
<li class="covered" data-hits="178" data-linenumber="41">
|
469
|
+
<span class="hits">178</span>
|
470
|
+
|
471
|
+
<code class="ruby"> Marshal.load(Marshal.dump(obj))</code>
|
472
|
+
</li>
|
473
|
+
|
474
|
+
<li class="never" data-hits="" data-linenumber="42">
|
475
|
+
|
476
|
+
|
477
|
+
<code class="ruby"> end</code>
|
478
|
+
</li>
|
479
|
+
|
480
|
+
<li class="never" data-hits="" data-linenumber="43">
|
481
|
+
|
482
|
+
|
483
|
+
<code class="ruby"></code>
|
484
|
+
</li>
|
485
|
+
|
486
|
+
<li class="covered" data-hits="1" data-linenumber="44">
|
487
|
+
<span class="hits">1</span>
|
488
|
+
|
489
|
+
<code class="ruby"> def __params_from_args(args)</code>
|
490
|
+
</li>
|
491
|
+
|
492
|
+
<li class="covered" data-hits="72" data-linenumber="45">
|
493
|
+
<span class="hits">72</span>
|
494
|
+
|
495
|
+
<code class="ruby"> args.empty? ? {} : args[0]</code>
|
496
|
+
</li>
|
497
|
+
|
498
|
+
<li class="never" data-hits="" data-linenumber="46">
|
499
|
+
|
500
|
+
|
501
|
+
<code class="ruby"> end</code>
|
502
|
+
</li>
|
503
|
+
|
504
|
+
<li class="never" data-hits="" data-linenumber="47">
|
505
|
+
|
506
|
+
|
507
|
+
<code class="ruby"></code>
|
508
|
+
</li>
|
509
|
+
|
510
|
+
<li class="covered" data-hits="1" data-linenumber="48">
|
511
|
+
<span class="hits">1</span>
|
512
|
+
|
513
|
+
<code class="ruby"> def method_missing(name, *args, &block)</code>
|
514
|
+
</li>
|
515
|
+
|
516
|
+
<li class="covered" data-hits="72" data-linenumber="49">
|
517
|
+
<span class="hits">72</span>
|
518
|
+
|
519
|
+
<code class="ruby"> require_relative './node'</code>
|
520
|
+
</li>
|
521
|
+
|
522
|
+
<li class="covered" data-hits="72" data-linenumber="50">
|
523
|
+
<span class="hits">72</span>
|
524
|
+
|
525
|
+
<code class="ruby"> @__nodes << Node.new(name.to_s, __params_from_args(args), __depth + 1, &block)</code>
|
526
|
+
</li>
|
527
|
+
|
528
|
+
<li class="never" data-hits="" data-linenumber="51">
|
529
|
+
|
530
|
+
|
531
|
+
<code class="ruby"> end</code>
|
532
|
+
</li>
|
533
|
+
|
534
|
+
<li class="never" data-hits="" data-linenumber="52">
|
535
|
+
|
536
|
+
|
537
|
+
<code class="ruby"> end</code>
|
538
|
+
</li>
|
539
|
+
|
540
|
+
<li class="never" data-hits="" data-linenumber="53">
|
541
|
+
|
542
|
+
|
543
|
+
<code class="ruby">end</code>
|
544
|
+
</li>
|
545
|
+
|
546
|
+
</ol>
|
547
|
+
</pre>
|
548
|
+
</div>
|
549
|
+
|
550
|
+
|
551
|
+
<div class="source_table" id="68dcd39c86205e255ffb6dcb92fa9f24c6f7d923">
|
552
|
+
<div class="header">
|
553
|
+
<h3>lib/gqli/client.rb</h3>
|
554
|
+
<h4><span class="yellow">85.71 %</span> covered</h4>
|
555
|
+
<div>
|
556
|
+
<b>28</b> relevant lines.
|
557
|
+
<span class="green"><b>24</b> lines covered</span> and
|
558
|
+
<span class="red"><b>4</b> lines missed.</span>
|
559
|
+
</div>
|
560
|
+
</div>
|
561
|
+
|
562
|
+
<pre>
|
563
|
+
<ol>
|
564
|
+
|
565
|
+
<li class="never" data-hits="" data-linenumber="1">
|
566
|
+
|
567
|
+
|
568
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
569
|
+
</li>
|
570
|
+
|
571
|
+
<li class="never" data-hits="" data-linenumber="2">
|
572
|
+
|
573
|
+
|
574
|
+
<code class="ruby"></code>
|
575
|
+
</li>
|
576
|
+
|
577
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
578
|
+
<span class="hits">1</span>
|
579
|
+
|
580
|
+
<code class="ruby">require 'http'</code>
|
581
|
+
</li>
|
582
|
+
|
583
|
+
<li class="covered" data-hits="1" data-linenumber="4">
|
584
|
+
<span class="hits">1</span>
|
585
|
+
|
586
|
+
<code class="ruby">require 'json'</code>
|
587
|
+
</li>
|
588
|
+
|
589
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
590
|
+
<span class="hits">1</span>
|
591
|
+
|
592
|
+
<code class="ruby">require_relative './response'</code>
|
593
|
+
</li>
|
594
|
+
|
595
|
+
<li class="covered" data-hits="1" data-linenumber="6">
|
596
|
+
<span class="hits">1</span>
|
597
|
+
|
598
|
+
<code class="ruby">require_relative './introspection'</code>
|
599
|
+
</li>
|
600
|
+
|
601
|
+
<li class="covered" data-hits="1" data-linenumber="7">
|
602
|
+
<span class="hits">1</span>
|
603
|
+
|
604
|
+
<code class="ruby">require_relative './version'</code>
|
605
|
+
</li>
|
606
|
+
|
607
|
+
<li class="never" data-hits="" data-linenumber="8">
|
608
|
+
|
609
|
+
|
610
|
+
<code class="ruby"></code>
|
611
|
+
</li>
|
612
|
+
|
613
|
+
<li class="covered" data-hits="1" data-linenumber="9">
|
614
|
+
<span class="hits">1</span>
|
615
|
+
|
616
|
+
<code class="ruby">module GQLi</code>
|
617
|
+
</li>
|
618
|
+
|
619
|
+
<li class="never" data-hits="" data-linenumber="10">
|
620
|
+
|
621
|
+
|
622
|
+
<code class="ruby"> # GraphQL HTTP Client</code>
|
623
|
+
</li>
|
624
|
+
|
625
|
+
<li class="covered" data-hits="1" data-linenumber="11">
|
626
|
+
<span class="hits">1</span>
|
627
|
+
|
628
|
+
<code class="ruby"> class Client</code>
|
629
|
+
</li>
|
630
|
+
|
631
|
+
<li class="covered" data-hits="1" data-linenumber="12">
|
632
|
+
<span class="hits">1</span>
|
633
|
+
|
634
|
+
<code class="ruby"> attr_reader :url, :params, :headers, :validate_query, :schema</code>
|
635
|
+
</li>
|
636
|
+
|
637
|
+
<li class="never" data-hits="" data-linenumber="13">
|
638
|
+
|
639
|
+
|
640
|
+
<code class="ruby"></code>
|
641
|
+
</li>
|
642
|
+
|
643
|
+
<li class="covered" data-hits="1" data-linenumber="14">
|
644
|
+
<span class="hits">1</span>
|
645
|
+
|
646
|
+
<code class="ruby"> def initialize(url, params: {}, headers: {}, validate_query: true)</code>
|
647
|
+
</li>
|
648
|
+
|
649
|
+
<li class="covered" data-hits="8" data-linenumber="15">
|
650
|
+
<span class="hits">8</span>
|
651
|
+
|
652
|
+
<code class="ruby"> @url = url</code>
|
653
|
+
</li>
|
654
|
+
|
655
|
+
<li class="covered" data-hits="8" data-linenumber="16">
|
656
|
+
<span class="hits">8</span>
|
657
|
+
|
658
|
+
<code class="ruby"> @params = params</code>
|
659
|
+
</li>
|
660
|
+
|
661
|
+
<li class="covered" data-hits="8" data-linenumber="17">
|
662
|
+
<span class="hits">8</span>
|
663
|
+
|
664
|
+
<code class="ruby"> @headers = headers</code>
|
665
|
+
</li>
|
666
|
+
|
667
|
+
<li class="covered" data-hits="8" data-linenumber="18">
|
668
|
+
<span class="hits">8</span>
|
669
|
+
|
670
|
+
<code class="ruby"> @validate_query = validate_query</code>
|
671
|
+
</li>
|
672
|
+
|
673
|
+
<li class="never" data-hits="" data-linenumber="19">
|
674
|
+
|
675
|
+
|
676
|
+
<code class="ruby"></code>
|
677
|
+
</li>
|
678
|
+
|
679
|
+
<li class="covered" data-hits="8" data-linenumber="20">
|
680
|
+
<span class="hits">8</span>
|
681
|
+
|
682
|
+
<code class="ruby"> @schema = Introspection.new(self) if validate_query</code>
|
683
|
+
</li>
|
684
|
+
|
685
|
+
<li class="never" data-hits="" data-linenumber="21">
|
686
|
+
|
687
|
+
|
688
|
+
<code class="ruby"> end</code>
|
689
|
+
</li>
|
690
|
+
|
691
|
+
<li class="never" data-hits="" data-linenumber="22">
|
692
|
+
|
693
|
+
|
694
|
+
<code class="ruby"></code>
|
695
|
+
</li>
|
696
|
+
|
697
|
+
<li class="never" data-hits="" data-linenumber="23">
|
698
|
+
|
699
|
+
|
700
|
+
<code class="ruby"> # Executes a query</code>
|
701
|
+
</li>
|
702
|
+
|
703
|
+
<li class="never" data-hits="" data-linenumber="24">
|
704
|
+
|
705
|
+
|
706
|
+
<code class="ruby"> # If validations are enabled, will perform validation check before request.</code>
|
707
|
+
</li>
|
708
|
+
|
709
|
+
<li class="covered" data-hits="1" data-linenumber="25">
|
710
|
+
<span class="hits">1</span>
|
711
|
+
|
712
|
+
<code class="ruby"> def execute(query)</code>
|
713
|
+
</li>
|
714
|
+
|
715
|
+
<li class="missed" data-hits="0" data-linenumber="26">
|
716
|
+
|
717
|
+
|
718
|
+
<code class="ruby"> fail 'Validation Error: query is invalid - HTTP Request not sent' unless valid?(query)</code>
|
719
|
+
</li>
|
720
|
+
|
721
|
+
<li class="never" data-hits="" data-linenumber="27">
|
722
|
+
|
723
|
+
|
724
|
+
<code class="ruby"></code>
|
725
|
+
</li>
|
726
|
+
|
727
|
+
<li class="missed" data-hits="0" data-linenumber="28">
|
728
|
+
|
729
|
+
|
730
|
+
<code class="ruby"> execute!(query)</code>
|
731
|
+
</li>
|
732
|
+
|
733
|
+
<li class="never" data-hits="" data-linenumber="29">
|
734
|
+
|
735
|
+
|
736
|
+
<code class="ruby"> end</code>
|
737
|
+
</li>
|
738
|
+
|
739
|
+
<li class="never" data-hits="" data-linenumber="30">
|
740
|
+
|
741
|
+
|
742
|
+
<code class="ruby"></code>
|
743
|
+
</li>
|
744
|
+
|
745
|
+
<li class="never" data-hits="" data-linenumber="31">
|
746
|
+
|
747
|
+
|
748
|
+
<code class="ruby"> # Executres a query</code>
|
749
|
+
</li>
|
750
|
+
|
751
|
+
<li class="never" data-hits="" data-linenumber="32">
|
752
|
+
|
753
|
+
|
754
|
+
<code class="ruby"> # Ignores validations</code>
|
755
|
+
</li>
|
756
|
+
|
757
|
+
<li class="covered" data-hits="1" data-linenumber="33">
|
758
|
+
<span class="hits">1</span>
|
759
|
+
|
760
|
+
<code class="ruby"> def execute!(query)</code>
|
761
|
+
</li>
|
762
|
+
|
763
|
+
<li class="covered" data-hits="8" data-linenumber="34">
|
764
|
+
<span class="hits">8</span>
|
765
|
+
|
766
|
+
<code class="ruby"> http_response = HTTP.headers(request_headers).post(@url, params: @params, json: { query: query.to_gql })</code>
|
767
|
+
</li>
|
768
|
+
|
769
|
+
<li class="never" data-hits="" data-linenumber="35">
|
770
|
+
|
771
|
+
|
772
|
+
<code class="ruby"></code>
|
773
|
+
</li>
|
774
|
+
|
775
|
+
<li class="covered" data-hits="8" data-linenumber="36">
|
776
|
+
<span class="hits">8</span>
|
777
|
+
|
778
|
+
<code class="ruby"> fail "Error: #{http_response.reason}\nBody: #{http_response.body}" if http_response.status >= 300</code>
|
779
|
+
</li>
|
780
|
+
|
781
|
+
<li class="never" data-hits="" data-linenumber="37">
|
782
|
+
|
783
|
+
|
784
|
+
<code class="ruby"></code>
|
785
|
+
</li>
|
786
|
+
|
787
|
+
<li class="covered" data-hits="8" data-linenumber="38">
|
788
|
+
<span class="hits">8</span>
|
789
|
+
|
790
|
+
<code class="ruby"> data = JSON.parse(http_response.to_s)['data']</code>
|
791
|
+
</li>
|
792
|
+
|
793
|
+
<li class="never" data-hits="" data-linenumber="39">
|
794
|
+
|
795
|
+
|
796
|
+
<code class="ruby"></code>
|
797
|
+
</li>
|
798
|
+
|
799
|
+
<li class="covered" data-hits="8" data-linenumber="40">
|
800
|
+
<span class="hits">8</span>
|
801
|
+
|
802
|
+
<code class="ruby"> Response.new(data, query)</code>
|
803
|
+
</li>
|
804
|
+
|
805
|
+
<li class="never" data-hits="" data-linenumber="41">
|
806
|
+
|
807
|
+
|
808
|
+
<code class="ruby"> end</code>
|
809
|
+
</li>
|
810
|
+
|
811
|
+
<li class="never" data-hits="" data-linenumber="42">
|
812
|
+
|
813
|
+
|
814
|
+
<code class="ruby"></code>
|
815
|
+
</li>
|
816
|
+
|
817
|
+
<li class="never" data-hits="" data-linenumber="43">
|
818
|
+
|
819
|
+
|
820
|
+
<code class="ruby"> # Validates a query against the schema</code>
|
821
|
+
</li>
|
822
|
+
|
823
|
+
<li class="covered" data-hits="1" data-linenumber="44">
|
824
|
+
<span class="hits">1</span>
|
825
|
+
|
826
|
+
<code class="ruby"> def valid?(query)</code>
|
827
|
+
</li>
|
828
|
+
|
829
|
+
<li class="missed" data-hits="0" data-linenumber="45">
|
830
|
+
|
831
|
+
|
832
|
+
<code class="ruby"> return true unless validate_query</code>
|
833
|
+
</li>
|
834
|
+
|
835
|
+
<li class="never" data-hits="" data-linenumber="46">
|
836
|
+
|
837
|
+
|
838
|
+
<code class="ruby"></code>
|
839
|
+
</li>
|
840
|
+
|
841
|
+
<li class="missed" data-hits="0" data-linenumber="47">
|
842
|
+
|
843
|
+
|
844
|
+
<code class="ruby"> @schema.valid?(query)</code>
|
845
|
+
</li>
|
846
|
+
|
847
|
+
<li class="never" data-hits="" data-linenumber="48">
|
848
|
+
|
849
|
+
|
850
|
+
<code class="ruby"> end</code>
|
851
|
+
</li>
|
852
|
+
|
853
|
+
<li class="never" data-hits="" data-linenumber="49">
|
854
|
+
|
855
|
+
|
856
|
+
<code class="ruby"></code>
|
857
|
+
</li>
|
858
|
+
|
859
|
+
<li class="covered" data-hits="1" data-linenumber="50">
|
860
|
+
<span class="hits">1</span>
|
861
|
+
|
862
|
+
<code class="ruby"> protected</code>
|
863
|
+
</li>
|
864
|
+
|
865
|
+
<li class="never" data-hits="" data-linenumber="51">
|
866
|
+
|
867
|
+
|
868
|
+
<code class="ruby"></code>
|
869
|
+
</li>
|
870
|
+
|
871
|
+
<li class="covered" data-hits="1" data-linenumber="52">
|
872
|
+
<span class="hits">1</span>
|
873
|
+
|
874
|
+
<code class="ruby"> def request_headers</code>
|
875
|
+
</li>
|
876
|
+
|
877
|
+
<li class="never" data-hits="" data-linenumber="53">
|
878
|
+
|
879
|
+
|
880
|
+
<code class="ruby"> {</code>
|
881
|
+
</li>
|
882
|
+
|
883
|
+
<li class="never" data-hits="" data-linenumber="54">
|
884
|
+
|
885
|
+
|
886
|
+
<code class="ruby"> accept: 'application/json',</code>
|
887
|
+
</li>
|
888
|
+
|
889
|
+
<li class="never" data-hits="" data-linenumber="55">
|
890
|
+
|
891
|
+
|
892
|
+
<code class="ruby"> user_agent: "gqli.rb/#{VERSION}; http.rb/#{HTTP::VERSION}"</code>
|
893
|
+
</li>
|
894
|
+
|
895
|
+
<li class="covered" data-hits="8" data-linenumber="56">
|
896
|
+
<span class="hits">8</span>
|
897
|
+
|
898
|
+
<code class="ruby"> }.merge(@headers)</code>
|
899
|
+
</li>
|
900
|
+
|
901
|
+
<li class="never" data-hits="" data-linenumber="57">
|
902
|
+
|
903
|
+
|
904
|
+
<code class="ruby"> end</code>
|
905
|
+
</li>
|
906
|
+
|
907
|
+
<li class="never" data-hits="" data-linenumber="58">
|
908
|
+
|
909
|
+
|
910
|
+
<code class="ruby"> end</code>
|
911
|
+
</li>
|
912
|
+
|
913
|
+
<li class="never" data-hits="" data-linenumber="59">
|
914
|
+
|
915
|
+
|
916
|
+
<code class="ruby">end</code>
|
917
|
+
</li>
|
918
|
+
|
919
|
+
</ol>
|
920
|
+
</pre>
|
921
|
+
</div>
|
922
|
+
|
923
|
+
|
924
|
+
<div class="source_table" id="9abd05ccff4ad7a4f5b1bb75901af6e008bc9c5d">
|
925
|
+
<div class="header">
|
926
|
+
<h3>lib/gqli/dsl.rb</h3>
|
927
|
+
<h4><span class="green">91.67 %</span> covered</h4>
|
928
|
+
<div>
|
929
|
+
<b>12</b> relevant lines.
|
930
|
+
<span class="green"><b>11</b> lines covered</span> and
|
931
|
+
<span class="red"><b>1</b> lines missed.</span>
|
932
|
+
</div>
|
933
|
+
</div>
|
934
|
+
|
935
|
+
<pre>
|
936
|
+
<ol>
|
937
|
+
|
938
|
+
<li class="never" data-hits="" data-linenumber="1">
|
939
|
+
|
940
|
+
|
941
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
942
|
+
</li>
|
943
|
+
|
944
|
+
<li class="never" data-hits="" data-linenumber="2">
|
945
|
+
|
946
|
+
|
947
|
+
<code class="ruby"></code>
|
948
|
+
</li>
|
949
|
+
|
950
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
951
|
+
<span class="hits">1</span>
|
952
|
+
|
953
|
+
<code class="ruby">require_relative './query'</code>
|
954
|
+
</li>
|
955
|
+
|
956
|
+
<li class="covered" data-hits="1" data-linenumber="4">
|
957
|
+
<span class="hits">1</span>
|
958
|
+
|
959
|
+
<code class="ruby">require_relative './fragment'</code>
|
960
|
+
</li>
|
961
|
+
|
962
|
+
<li class="never" data-hits="" data-linenumber="5">
|
963
|
+
|
964
|
+
|
965
|
+
<code class="ruby"></code>
|
966
|
+
</li>
|
967
|
+
|
968
|
+
<li class="covered" data-hits="1" data-linenumber="6">
|
969
|
+
<span class="hits">1</span>
|
970
|
+
|
971
|
+
<code class="ruby">module GQLi</code>
|
972
|
+
</li>
|
973
|
+
|
974
|
+
<li class="never" data-hits="" data-linenumber="7">
|
975
|
+
|
976
|
+
|
977
|
+
<code class="ruby"> # GraphQL-like DSL methods</code>
|
978
|
+
</li>
|
979
|
+
|
980
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
981
|
+
<span class="hits">1</span>
|
982
|
+
|
983
|
+
<code class="ruby"> module DSL</code>
|
984
|
+
</li>
|
985
|
+
|
986
|
+
<li class="never" data-hits="" data-linenumber="9">
|
987
|
+
|
988
|
+
|
989
|
+
<code class="ruby"> # Creates a Query object</code>
|
990
|
+
</li>
|
991
|
+
|
992
|
+
<li class="never" data-hits="" data-linenumber="10">
|
993
|
+
|
994
|
+
|
995
|
+
<code class="ruby"> #</code>
|
996
|
+
</li>
|
997
|
+
|
998
|
+
<li class="never" data-hits="" data-linenumber="11">
|
999
|
+
|
1000
|
+
|
1001
|
+
<code class="ruby"> # Can be used at a class level</code>
|
1002
|
+
</li>
|
1003
|
+
|
1004
|
+
<li class="covered" data-hits="1" data-linenumber="12">
|
1005
|
+
<span class="hits">1</span>
|
1006
|
+
|
1007
|
+
<code class="ruby"> def self.query(name = nil, &block)</code>
|
1008
|
+
</li>
|
1009
|
+
|
1010
|
+
<li class="covered" data-hits="7" data-linenumber="13">
|
1011
|
+
<span class="hits">7</span>
|
1012
|
+
|
1013
|
+
<code class="ruby"> Query.new(name, &block)</code>
|
1014
|
+
</li>
|
1015
|
+
|
1016
|
+
<li class="never" data-hits="" data-linenumber="14">
|
1017
|
+
|
1018
|
+
|
1019
|
+
<code class="ruby"> end</code>
|
1020
|
+
</li>
|
1021
|
+
|
1022
|
+
<li class="never" data-hits="" data-linenumber="15">
|
1023
|
+
|
1024
|
+
|
1025
|
+
<code class="ruby"></code>
|
1026
|
+
</li>
|
1027
|
+
|
1028
|
+
<li class="never" data-hits="" data-linenumber="16">
|
1029
|
+
|
1030
|
+
|
1031
|
+
<code class="ruby"> # Creates a Fragment object</code>
|
1032
|
+
</li>
|
1033
|
+
|
1034
|
+
<li class="never" data-hits="" data-linenumber="17">
|
1035
|
+
|
1036
|
+
|
1037
|
+
<code class="ruby"> #</code>
|
1038
|
+
</li>
|
1039
|
+
|
1040
|
+
<li class="never" data-hits="" data-linenumber="18">
|
1041
|
+
|
1042
|
+
|
1043
|
+
<code class="ruby"> # Can be used at a class level</code>
|
1044
|
+
</li>
|
1045
|
+
|
1046
|
+
<li class="covered" data-hits="1" data-linenumber="19">
|
1047
|
+
<span class="hits">1</span>
|
1048
|
+
|
1049
|
+
<code class="ruby"> def self.fragment(name, on, &block)</code>
|
1050
|
+
</li>
|
1051
|
+
|
1052
|
+
<li class="missed" data-hits="0" data-linenumber="20">
|
1053
|
+
|
1054
|
+
|
1055
|
+
<code class="ruby"> Fragment.new(name, on, &block)</code>
|
1056
|
+
</li>
|
1057
|
+
|
1058
|
+
<li class="never" data-hits="" data-linenumber="21">
|
1059
|
+
|
1060
|
+
|
1061
|
+
<code class="ruby"> end</code>
|
1062
|
+
</li>
|
1063
|
+
|
1064
|
+
<li class="never" data-hits="" data-linenumber="22">
|
1065
|
+
|
1066
|
+
|
1067
|
+
<code class="ruby"></code>
|
1068
|
+
</li>
|
1069
|
+
|
1070
|
+
<li class="never" data-hits="" data-linenumber="23">
|
1071
|
+
|
1072
|
+
|
1073
|
+
<code class="ruby"> # Creates a Query object</code>
|
1074
|
+
</li>
|
1075
|
+
|
1076
|
+
<li class="never" data-hits="" data-linenumber="24">
|
1077
|
+
|
1078
|
+
|
1079
|
+
<code class="ruby"> #</code>
|
1080
|
+
</li>
|
1081
|
+
|
1082
|
+
<li class="never" data-hits="" data-linenumber="25">
|
1083
|
+
|
1084
|
+
|
1085
|
+
<code class="ruby"> # Can be used at an instance level</code>
|
1086
|
+
</li>
|
1087
|
+
|
1088
|
+
<li class="covered" data-hits="1" data-linenumber="26">
|
1089
|
+
<span class="hits">1</span>
|
1090
|
+
|
1091
|
+
<code class="ruby"> def query(name = nil, &block)</code>
|
1092
|
+
</li>
|
1093
|
+
|
1094
|
+
<li class="covered" data-hits="1" data-linenumber="27">
|
1095
|
+
<span class="hits">1</span>
|
1096
|
+
|
1097
|
+
<code class="ruby"> Query.new(name, &block)</code>
|
1098
|
+
</li>
|
1099
|
+
|
1100
|
+
<li class="never" data-hits="" data-linenumber="28">
|
1101
|
+
|
1102
|
+
|
1103
|
+
<code class="ruby"> end</code>
|
1104
|
+
</li>
|
1105
|
+
|
1106
|
+
<li class="never" data-hits="" data-linenumber="29">
|
1107
|
+
|
1108
|
+
|
1109
|
+
<code class="ruby"></code>
|
1110
|
+
</li>
|
1111
|
+
|
1112
|
+
<li class="never" data-hits="" data-linenumber="30">
|
1113
|
+
|
1114
|
+
|
1115
|
+
<code class="ruby"> # Creates a Fragment object</code>
|
1116
|
+
</li>
|
1117
|
+
|
1118
|
+
<li class="never" data-hits="" data-linenumber="31">
|
1119
|
+
|
1120
|
+
|
1121
|
+
<code class="ruby"> #</code>
|
1122
|
+
</li>
|
1123
|
+
|
1124
|
+
<li class="never" data-hits="" data-linenumber="32">
|
1125
|
+
|
1126
|
+
|
1127
|
+
<code class="ruby"> # Can be used at an instance level</code>
|
1128
|
+
</li>
|
1129
|
+
|
1130
|
+
<li class="covered" data-hits="1" data-linenumber="33">
|
1131
|
+
<span class="hits">1</span>
|
1132
|
+
|
1133
|
+
<code class="ruby"> def fragment(name, on, &block)</code>
|
1134
|
+
</li>
|
1135
|
+
|
1136
|
+
<li class="covered" data-hits="3" data-linenumber="34">
|
1137
|
+
<span class="hits">3</span>
|
1138
|
+
|
1139
|
+
<code class="ruby"> Fragment.new(name, on, &block)</code>
|
1140
|
+
</li>
|
1141
|
+
|
1142
|
+
<li class="never" data-hits="" data-linenumber="35">
|
1143
|
+
|
1144
|
+
|
1145
|
+
<code class="ruby"> end</code>
|
1146
|
+
</li>
|
1147
|
+
|
1148
|
+
<li class="never" data-hits="" data-linenumber="36">
|
1149
|
+
|
1150
|
+
|
1151
|
+
<code class="ruby"> end</code>
|
1152
|
+
</li>
|
1153
|
+
|
1154
|
+
<li class="never" data-hits="" data-linenumber="37">
|
1155
|
+
|
1156
|
+
|
1157
|
+
<code class="ruby">end</code>
|
1158
|
+
</li>
|
1159
|
+
|
1160
|
+
</ol>
|
1161
|
+
</pre>
|
1162
|
+
</div>
|
1163
|
+
|
1164
|
+
|
1165
|
+
<div class="source_table" id="049f7e831814eec17f9b96573767e0e1613dd427">
|
1166
|
+
<div class="header">
|
1167
|
+
<h3>lib/gqli/fragment.rb</h3>
|
1168
|
+
<h4><span class="yellow">90.0 %</span> covered</h4>
|
1169
|
+
<div>
|
1170
|
+
<b>10</b> relevant lines.
|
1171
|
+
<span class="green"><b>9</b> lines covered</span> and
|
1172
|
+
<span class="red"><b>1</b> lines missed.</span>
|
1173
|
+
</div>
|
1174
|
+
</div>
|
1175
|
+
|
1176
|
+
<pre>
|
1177
|
+
<ol>
|
1178
|
+
|
1179
|
+
<li class="never" data-hits="" data-linenumber="1">
|
1180
|
+
|
1181
|
+
|
1182
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
1183
|
+
</li>
|
1184
|
+
|
1185
|
+
<li class="never" data-hits="" data-linenumber="2">
|
1186
|
+
|
1187
|
+
|
1188
|
+
<code class="ruby"></code>
|
1189
|
+
</li>
|
1190
|
+
|
1191
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
1192
|
+
<span class="hits">1</span>
|
1193
|
+
|
1194
|
+
<code class="ruby">require_relative './base'</code>
|
1195
|
+
</li>
|
1196
|
+
|
1197
|
+
<li class="covered" data-hits="1" data-linenumber="4">
|
1198
|
+
<span class="hits">1</span>
|
1199
|
+
|
1200
|
+
<code class="ruby">require_relative './node'</code>
|
1201
|
+
</li>
|
1202
|
+
|
1203
|
+
<li class="never" data-hits="" data-linenumber="5">
|
1204
|
+
|
1205
|
+
|
1206
|
+
<code class="ruby"></code>
|
1207
|
+
</li>
|
1208
|
+
|
1209
|
+
<li class="covered" data-hits="1" data-linenumber="6">
|
1210
|
+
<span class="hits">1</span>
|
1211
|
+
|
1212
|
+
<code class="ruby">module GQLi</code>
|
1213
|
+
</li>
|
1214
|
+
|
1215
|
+
<li class="never" data-hits="" data-linenumber="7">
|
1216
|
+
|
1217
|
+
|
1218
|
+
<code class="ruby"> # Fragment wrapper</code>
|
1219
|
+
</li>
|
1220
|
+
|
1221
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
1222
|
+
<span class="hits">1</span>
|
1223
|
+
|
1224
|
+
<code class="ruby"> class Fragment < Base</code>
|
1225
|
+
</li>
|
1226
|
+
|
1227
|
+
<li class="covered" data-hits="1" data-linenumber="9">
|
1228
|
+
<span class="hits">1</span>
|
1229
|
+
|
1230
|
+
<code class="ruby"> attr_reader :__on_type</code>
|
1231
|
+
</li>
|
1232
|
+
|
1233
|
+
<li class="never" data-hits="" data-linenumber="10">
|
1234
|
+
|
1235
|
+
|
1236
|
+
<code class="ruby"></code>
|
1237
|
+
</li>
|
1238
|
+
|
1239
|
+
<li class="covered" data-hits="1" data-linenumber="11">
|
1240
|
+
<span class="hits">1</span>
|
1241
|
+
|
1242
|
+
<code class="ruby"> def initialize(name, on, &block)</code>
|
1243
|
+
</li>
|
1244
|
+
|
1245
|
+
<li class="covered" data-hits="3" data-linenumber="12">
|
1246
|
+
<span class="hits">3</span>
|
1247
|
+
|
1248
|
+
<code class="ruby"> super(name, 0, &block)</code>
|
1249
|
+
</li>
|
1250
|
+
|
1251
|
+
<li class="covered" data-hits="3" data-linenumber="13">
|
1252
|
+
<span class="hits">3</span>
|
1253
|
+
|
1254
|
+
<code class="ruby"> @__on_type = on</code>
|
1255
|
+
</li>
|
1256
|
+
|
1257
|
+
<li class="never" data-hits="" data-linenumber="14">
|
1258
|
+
|
1259
|
+
|
1260
|
+
<code class="ruby"> end</code>
|
1261
|
+
</li>
|
1262
|
+
|
1263
|
+
<li class="never" data-hits="" data-linenumber="15">
|
1264
|
+
|
1265
|
+
|
1266
|
+
<code class="ruby"></code>
|
1267
|
+
</li>
|
1268
|
+
|
1269
|
+
<li class="never" data-hits="" data-linenumber="16">
|
1270
|
+
|
1271
|
+
|
1272
|
+
<code class="ruby"> # Serializes to a GraphQL string</code>
|
1273
|
+
</li>
|
1274
|
+
|
1275
|
+
<li class="covered" data-hits="1" data-linenumber="17">
|
1276
|
+
<span class="hits">1</span>
|
1277
|
+
|
1278
|
+
<code class="ruby"> def to_gql</code>
|
1279
|
+
</li>
|
1280
|
+
|
1281
|
+
<li class="missed" data-hits="0" data-linenumber="18">
|
1282
|
+
|
1283
|
+
|
1284
|
+
<code class="ruby"> <<~GQL</code>
|
1285
|
+
</li>
|
1286
|
+
|
1287
|
+
<li class="never" data-hits="" data-linenumber="19">
|
1288
|
+
|
1289
|
+
|
1290
|
+
<code class="ruby"> fragment #{__name} on #{__on_type} {</code>
|
1291
|
+
</li>
|
1292
|
+
|
1293
|
+
<li class="never" data-hits="" data-linenumber="20">
|
1294
|
+
|
1295
|
+
|
1296
|
+
<code class="ruby"> #{__nodes.map(&:to_gql).join("\n")}</code>
|
1297
|
+
</li>
|
1298
|
+
|
1299
|
+
<li class="never" data-hits="" data-linenumber="21">
|
1300
|
+
|
1301
|
+
|
1302
|
+
<code class="ruby"> }</code>
|
1303
|
+
</li>
|
1304
|
+
|
1305
|
+
<li class="never" data-hits="" data-linenumber="22">
|
1306
|
+
|
1307
|
+
|
1308
|
+
<code class="ruby"> GQL</code>
|
1309
|
+
</li>
|
1310
|
+
|
1311
|
+
<li class="never" data-hits="" data-linenumber="23">
|
1312
|
+
|
1313
|
+
|
1314
|
+
<code class="ruby"> end</code>
|
1315
|
+
</li>
|
1316
|
+
|
1317
|
+
<li class="never" data-hits="" data-linenumber="24">
|
1318
|
+
|
1319
|
+
|
1320
|
+
<code class="ruby"> end</code>
|
1321
|
+
</li>
|
1322
|
+
|
1323
|
+
<li class="never" data-hits="" data-linenumber="25">
|
1324
|
+
|
1325
|
+
|
1326
|
+
<code class="ruby">end</code>
|
1327
|
+
</li>
|
1328
|
+
|
1329
|
+
</ol>
|
1330
|
+
</pre>
|
1331
|
+
</div>
|
1332
|
+
|
1333
|
+
|
1334
|
+
<div class="source_table" id="07f15b56d18102110d4b398de85375295500eab7">
|
1335
|
+
<div class="header">
|
1336
|
+
<h3>lib/gqli/introspection.rb</h3>
|
1337
|
+
<h4><span class="green">96.88 %</span> covered</h4>
|
1338
|
+
<div>
|
1339
|
+
<b>128</b> relevant lines.
|
1340
|
+
<span class="green"><b>124</b> lines covered</span> and
|
1341
|
+
<span class="red"><b>4</b> lines missed.</span>
|
1342
|
+
</div>
|
1343
|
+
</div>
|
1344
|
+
|
1345
|
+
<pre>
|
1346
|
+
<ol>
|
1347
|
+
|
1348
|
+
<li class="never" data-hits="" data-linenumber="1">
|
1349
|
+
|
1350
|
+
|
1351
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
1352
|
+
</li>
|
1353
|
+
|
1354
|
+
<li class="never" data-hits="" data-linenumber="2">
|
1355
|
+
|
1356
|
+
|
1357
|
+
<code class="ruby"></code>
|
1358
|
+
</li>
|
1359
|
+
|
1360
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
1361
|
+
<span class="hits">1</span>
|
1362
|
+
|
1363
|
+
<code class="ruby">require_relative './dsl'</code>
|
1364
|
+
</li>
|
1365
|
+
|
1366
|
+
<li class="never" data-hits="" data-linenumber="4">
|
1367
|
+
|
1368
|
+
|
1369
|
+
<code class="ruby"></code>
|
1370
|
+
</li>
|
1371
|
+
|
1372
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
1373
|
+
<span class="hits">1</span>
|
1374
|
+
|
1375
|
+
<code class="ruby">module GQLi</code>
|
1376
|
+
</li>
|
1377
|
+
|
1378
|
+
<li class="never" data-hits="" data-linenumber="6">
|
1379
|
+
|
1380
|
+
|
1381
|
+
<code class="ruby"> # Introspection schema and validator</code>
|
1382
|
+
</li>
|
1383
|
+
|
1384
|
+
<li class="covered" data-hits="1" data-linenumber="7">
|
1385
|
+
<span class="hits">1</span>
|
1386
|
+
|
1387
|
+
<code class="ruby"> class Introspection</code>
|
1388
|
+
</li>
|
1389
|
+
|
1390
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
1391
|
+
<span class="hits">1</span>
|
1392
|
+
|
1393
|
+
<code class="ruby"> extend DSL</code>
|
1394
|
+
</li>
|
1395
|
+
|
1396
|
+
<li class="never" data-hits="" data-linenumber="9">
|
1397
|
+
|
1398
|
+
|
1399
|
+
<code class="ruby"></code>
|
1400
|
+
</li>
|
1401
|
+
|
1402
|
+
<li class="never" data-hits="" data-linenumber="10">
|
1403
|
+
|
1404
|
+
|
1405
|
+
<code class="ruby"> # Specific type kind introspection fragment</code>
|
1406
|
+
</li>
|
1407
|
+
|
1408
|
+
<li class="covered" data-hits="1" data-linenumber="11">
|
1409
|
+
<span class="hits">1</span>
|
1410
|
+
|
1411
|
+
<code class="ruby"> TypeRef = fragment('TypeRef', '__Type') {</code>
|
1412
|
+
</li>
|
1413
|
+
|
1414
|
+
<li class="covered" data-hits="1" data-linenumber="12">
|
1415
|
+
<span class="hits">1</span>
|
1416
|
+
|
1417
|
+
<code class="ruby"> kind</code>
|
1418
|
+
</li>
|
1419
|
+
|
1420
|
+
<li class="covered" data-hits="1" data-linenumber="13">
|
1421
|
+
<span class="hits">1</span>
|
1422
|
+
|
1423
|
+
<code class="ruby"> name</code>
|
1424
|
+
</li>
|
1425
|
+
|
1426
|
+
<li class="covered" data-hits="1" data-linenumber="14">
|
1427
|
+
<span class="hits">1</span>
|
1428
|
+
|
1429
|
+
<code class="ruby"> ofType {</code>
|
1430
|
+
</li>
|
1431
|
+
|
1432
|
+
<li class="covered" data-hits="1" data-linenumber="15">
|
1433
|
+
<span class="hits">1</span>
|
1434
|
+
|
1435
|
+
<code class="ruby"> kind</code>
|
1436
|
+
</li>
|
1437
|
+
|
1438
|
+
<li class="covered" data-hits="1" data-linenumber="16">
|
1439
|
+
<span class="hits">1</span>
|
1440
|
+
|
1441
|
+
<code class="ruby"> name</code>
|
1442
|
+
</li>
|
1443
|
+
|
1444
|
+
<li class="covered" data-hits="1" data-linenumber="17">
|
1445
|
+
<span class="hits">1</span>
|
1446
|
+
|
1447
|
+
<code class="ruby"> ofType {</code>
|
1448
|
+
</li>
|
1449
|
+
|
1450
|
+
<li class="covered" data-hits="1" data-linenumber="18">
|
1451
|
+
<span class="hits">1</span>
|
1452
|
+
|
1453
|
+
<code class="ruby"> kind</code>
|
1454
|
+
</li>
|
1455
|
+
|
1456
|
+
<li class="covered" data-hits="1" data-linenumber="19">
|
1457
|
+
<span class="hits">1</span>
|
1458
|
+
|
1459
|
+
<code class="ruby"> name</code>
|
1460
|
+
</li>
|
1461
|
+
|
1462
|
+
<li class="covered" data-hits="1" data-linenumber="20">
|
1463
|
+
<span class="hits">1</span>
|
1464
|
+
|
1465
|
+
<code class="ruby"> ofType {</code>
|
1466
|
+
</li>
|
1467
|
+
|
1468
|
+
<li class="covered" data-hits="1" data-linenumber="21">
|
1469
|
+
<span class="hits">1</span>
|
1470
|
+
|
1471
|
+
<code class="ruby"> kind</code>
|
1472
|
+
</li>
|
1473
|
+
|
1474
|
+
<li class="covered" data-hits="1" data-linenumber="22">
|
1475
|
+
<span class="hits">1</span>
|
1476
|
+
|
1477
|
+
<code class="ruby"> name</code>
|
1478
|
+
</li>
|
1479
|
+
|
1480
|
+
<li class="never" data-hits="" data-linenumber="23">
|
1481
|
+
|
1482
|
+
|
1483
|
+
<code class="ruby"> }</code>
|
1484
|
+
</li>
|
1485
|
+
|
1486
|
+
<li class="never" data-hits="" data-linenumber="24">
|
1487
|
+
|
1488
|
+
|
1489
|
+
<code class="ruby"> }</code>
|
1490
|
+
</li>
|
1491
|
+
|
1492
|
+
<li class="never" data-hits="" data-linenumber="25">
|
1493
|
+
|
1494
|
+
|
1495
|
+
<code class="ruby"> }</code>
|
1496
|
+
</li>
|
1497
|
+
|
1498
|
+
<li class="never" data-hits="" data-linenumber="26">
|
1499
|
+
|
1500
|
+
|
1501
|
+
<code class="ruby"> }</code>
|
1502
|
+
</li>
|
1503
|
+
|
1504
|
+
<li class="never" data-hits="" data-linenumber="27">
|
1505
|
+
|
1506
|
+
|
1507
|
+
<code class="ruby"></code>
|
1508
|
+
</li>
|
1509
|
+
|
1510
|
+
<li class="never" data-hits="" data-linenumber="28">
|
1511
|
+
|
1512
|
+
|
1513
|
+
<code class="ruby"> # Input value introspection fragment</code>
|
1514
|
+
</li>
|
1515
|
+
|
1516
|
+
<li class="covered" data-hits="1" data-linenumber="29">
|
1517
|
+
<span class="hits">1</span>
|
1518
|
+
|
1519
|
+
<code class="ruby"> InputValue = fragment('InputValue', '__InputValue') {</code>
|
1520
|
+
</li>
|
1521
|
+
|
1522
|
+
<li class="covered" data-hits="1" data-linenumber="30">
|
1523
|
+
<span class="hits">1</span>
|
1524
|
+
|
1525
|
+
<code class="ruby"> name</code>
|
1526
|
+
</li>
|
1527
|
+
|
1528
|
+
<li class="covered" data-hits="1" data-linenumber="31">
|
1529
|
+
<span class="hits">1</span>
|
1530
|
+
|
1531
|
+
<code class="ruby"> description</code>
|
1532
|
+
</li>
|
1533
|
+
|
1534
|
+
<li class="covered" data-hits="2" data-linenumber="32">
|
1535
|
+
<span class="hits">2</span>
|
1536
|
+
|
1537
|
+
<code class="ruby"> type { ___ TypeRef }</code>
|
1538
|
+
</li>
|
1539
|
+
|
1540
|
+
<li class="covered" data-hits="1" data-linenumber="33">
|
1541
|
+
<span class="hits">1</span>
|
1542
|
+
|
1543
|
+
<code class="ruby"> defaultValue</code>
|
1544
|
+
</li>
|
1545
|
+
|
1546
|
+
<li class="never" data-hits="" data-linenumber="34">
|
1547
|
+
|
1548
|
+
|
1549
|
+
<code class="ruby"> }</code>
|
1550
|
+
</li>
|
1551
|
+
|
1552
|
+
<li class="never" data-hits="" data-linenumber="35">
|
1553
|
+
|
1554
|
+
|
1555
|
+
<code class="ruby"></code>
|
1556
|
+
</li>
|
1557
|
+
|
1558
|
+
<li class="never" data-hits="" data-linenumber="36">
|
1559
|
+
|
1560
|
+
|
1561
|
+
<code class="ruby"> # Type introspection fragment</code>
|
1562
|
+
</li>
|
1563
|
+
|
1564
|
+
<li class="covered" data-hits="1" data-linenumber="37">
|
1565
|
+
<span class="hits">1</span>
|
1566
|
+
|
1567
|
+
<code class="ruby"> FullType = fragment('FullType', '__Type') {</code>
|
1568
|
+
</li>
|
1569
|
+
|
1570
|
+
<li class="covered" data-hits="1" data-linenumber="38">
|
1571
|
+
<span class="hits">1</span>
|
1572
|
+
|
1573
|
+
<code class="ruby"> kind</code>
|
1574
|
+
</li>
|
1575
|
+
|
1576
|
+
<li class="covered" data-hits="1" data-linenumber="39">
|
1577
|
+
<span class="hits">1</span>
|
1578
|
+
|
1579
|
+
<code class="ruby"> name</code>
|
1580
|
+
</li>
|
1581
|
+
|
1582
|
+
<li class="covered" data-hits="1" data-linenumber="40">
|
1583
|
+
<span class="hits">1</span>
|
1584
|
+
|
1585
|
+
<code class="ruby"> description</code>
|
1586
|
+
</li>
|
1587
|
+
|
1588
|
+
<li class="covered" data-hits="1" data-linenumber="41">
|
1589
|
+
<span class="hits">1</span>
|
1590
|
+
|
1591
|
+
<code class="ruby"> fields(includeDeprecated: true) {</code>
|
1592
|
+
</li>
|
1593
|
+
|
1594
|
+
<li class="covered" data-hits="1" data-linenumber="42">
|
1595
|
+
<span class="hits">1</span>
|
1596
|
+
|
1597
|
+
<code class="ruby"> name</code>
|
1598
|
+
</li>
|
1599
|
+
|
1600
|
+
<li class="covered" data-hits="1" data-linenumber="43">
|
1601
|
+
<span class="hits">1</span>
|
1602
|
+
|
1603
|
+
<code class="ruby"> description</code>
|
1604
|
+
</li>
|
1605
|
+
|
1606
|
+
<li class="covered" data-hits="2" data-linenumber="44">
|
1607
|
+
<span class="hits">2</span>
|
1608
|
+
|
1609
|
+
<code class="ruby"> args { ___ InputValue }</code>
|
1610
|
+
</li>
|
1611
|
+
|
1612
|
+
<li class="covered" data-hits="2" data-linenumber="45">
|
1613
|
+
<span class="hits">2</span>
|
1614
|
+
|
1615
|
+
<code class="ruby"> type { ___ TypeRef }</code>
|
1616
|
+
</li>
|
1617
|
+
|
1618
|
+
<li class="covered" data-hits="1" data-linenumber="46">
|
1619
|
+
<span class="hits">1</span>
|
1620
|
+
|
1621
|
+
<code class="ruby"> isDeprecated</code>
|
1622
|
+
</li>
|
1623
|
+
|
1624
|
+
<li class="covered" data-hits="1" data-linenumber="47">
|
1625
|
+
<span class="hits">1</span>
|
1626
|
+
|
1627
|
+
<code class="ruby"> deprecationReason</code>
|
1628
|
+
</li>
|
1629
|
+
|
1630
|
+
<li class="never" data-hits="" data-linenumber="48">
|
1631
|
+
|
1632
|
+
|
1633
|
+
<code class="ruby"> }</code>
|
1634
|
+
</li>
|
1635
|
+
|
1636
|
+
<li class="covered" data-hits="2" data-linenumber="49">
|
1637
|
+
<span class="hits">2</span>
|
1638
|
+
|
1639
|
+
<code class="ruby"> inputFields { ___ InputValue }</code>
|
1640
|
+
</li>
|
1641
|
+
|
1642
|
+
<li class="covered" data-hits="2" data-linenumber="50">
|
1643
|
+
<span class="hits">2</span>
|
1644
|
+
|
1645
|
+
<code class="ruby"> interfaces { ___ TypeRef }</code>
|
1646
|
+
</li>
|
1647
|
+
|
1648
|
+
<li class="covered" data-hits="1" data-linenumber="51">
|
1649
|
+
<span class="hits">1</span>
|
1650
|
+
|
1651
|
+
<code class="ruby"> enumValues(includeDeprecated: true) {</code>
|
1652
|
+
</li>
|
1653
|
+
|
1654
|
+
<li class="covered" data-hits="1" data-linenumber="52">
|
1655
|
+
<span class="hits">1</span>
|
1656
|
+
|
1657
|
+
<code class="ruby"> name</code>
|
1658
|
+
</li>
|
1659
|
+
|
1660
|
+
<li class="covered" data-hits="1" data-linenumber="53">
|
1661
|
+
<span class="hits">1</span>
|
1662
|
+
|
1663
|
+
<code class="ruby"> description</code>
|
1664
|
+
</li>
|
1665
|
+
|
1666
|
+
<li class="covered" data-hits="1" data-linenumber="54">
|
1667
|
+
<span class="hits">1</span>
|
1668
|
+
|
1669
|
+
<code class="ruby"> isDeprecated</code>
|
1670
|
+
</li>
|
1671
|
+
|
1672
|
+
<li class="covered" data-hits="1" data-linenumber="55">
|
1673
|
+
<span class="hits">1</span>
|
1674
|
+
|
1675
|
+
<code class="ruby"> deprecationReason</code>
|
1676
|
+
</li>
|
1677
|
+
|
1678
|
+
<li class="never" data-hits="" data-linenumber="56">
|
1679
|
+
|
1680
|
+
|
1681
|
+
<code class="ruby"> }</code>
|
1682
|
+
</li>
|
1683
|
+
|
1684
|
+
<li class="covered" data-hits="2" data-linenumber="57">
|
1685
|
+
<span class="hits">2</span>
|
1686
|
+
|
1687
|
+
<code class="ruby"> possibleTypes { ___ TypeRef }</code>
|
1688
|
+
</li>
|
1689
|
+
|
1690
|
+
<li class="never" data-hits="" data-linenumber="58">
|
1691
|
+
|
1692
|
+
|
1693
|
+
<code class="ruby"> }</code>
|
1694
|
+
</li>
|
1695
|
+
|
1696
|
+
<li class="never" data-hits="" data-linenumber="59">
|
1697
|
+
|
1698
|
+
|
1699
|
+
<code class="ruby"></code>
|
1700
|
+
</li>
|
1701
|
+
|
1702
|
+
<li class="never" data-hits="" data-linenumber="60">
|
1703
|
+
|
1704
|
+
|
1705
|
+
<code class="ruby"> # Query for fetching the complete schema</code>
|
1706
|
+
</li>
|
1707
|
+
|
1708
|
+
<li class="covered" data-hits="1" data-linenumber="61">
|
1709
|
+
<span class="hits">1</span>
|
1710
|
+
|
1711
|
+
<code class="ruby"> IntrospectionQuery = query {</code>
|
1712
|
+
</li>
|
1713
|
+
|
1714
|
+
<li class="covered" data-hits="1" data-linenumber="62">
|
1715
|
+
<span class="hits">1</span>
|
1716
|
+
|
1717
|
+
<code class="ruby"> __schema {</code>
|
1718
|
+
</li>
|
1719
|
+
|
1720
|
+
<li class="covered" data-hits="2" data-linenumber="63">
|
1721
|
+
<span class="hits">2</span>
|
1722
|
+
|
1723
|
+
<code class="ruby"> queryType { name }</code>
|
1724
|
+
</li>
|
1725
|
+
|
1726
|
+
<li class="covered" data-hits="2" data-linenumber="64">
|
1727
|
+
<span class="hits">2</span>
|
1728
|
+
|
1729
|
+
<code class="ruby"> mutationType { name }</code>
|
1730
|
+
</li>
|
1731
|
+
|
1732
|
+
<li class="covered" data-hits="2" data-linenumber="65">
|
1733
|
+
<span class="hits">2</span>
|
1734
|
+
|
1735
|
+
<code class="ruby"> subscriptionType { name }</code>
|
1736
|
+
</li>
|
1737
|
+
|
1738
|
+
<li class="covered" data-hits="2" data-linenumber="66">
|
1739
|
+
<span class="hits">2</span>
|
1740
|
+
|
1741
|
+
<code class="ruby"> types { ___ FullType }</code>
|
1742
|
+
</li>
|
1743
|
+
|
1744
|
+
<li class="covered" data-hits="1" data-linenumber="67">
|
1745
|
+
<span class="hits">1</span>
|
1746
|
+
|
1747
|
+
<code class="ruby"> directives {</code>
|
1748
|
+
</li>
|
1749
|
+
|
1750
|
+
<li class="covered" data-hits="1" data-linenumber="68">
|
1751
|
+
<span class="hits">1</span>
|
1752
|
+
|
1753
|
+
<code class="ruby"> name</code>
|
1754
|
+
</li>
|
1755
|
+
|
1756
|
+
<li class="covered" data-hits="1" data-linenumber="69">
|
1757
|
+
<span class="hits">1</span>
|
1758
|
+
|
1759
|
+
<code class="ruby"> description</code>
|
1760
|
+
</li>
|
1761
|
+
|
1762
|
+
<li class="covered" data-hits="2" data-linenumber="70">
|
1763
|
+
<span class="hits">2</span>
|
1764
|
+
|
1765
|
+
<code class="ruby"> args { ___ InputValue }</code>
|
1766
|
+
</li>
|
1767
|
+
|
1768
|
+
<li class="covered" data-hits="1" data-linenumber="71">
|
1769
|
+
<span class="hits">1</span>
|
1770
|
+
|
1771
|
+
<code class="ruby"> onOperation</code>
|
1772
|
+
</li>
|
1773
|
+
|
1774
|
+
<li class="covered" data-hits="1" data-linenumber="72">
|
1775
|
+
<span class="hits">1</span>
|
1776
|
+
|
1777
|
+
<code class="ruby"> onFragment</code>
|
1778
|
+
</li>
|
1779
|
+
|
1780
|
+
<li class="covered" data-hits="1" data-linenumber="73">
|
1781
|
+
<span class="hits">1</span>
|
1782
|
+
|
1783
|
+
<code class="ruby"> onField</code>
|
1784
|
+
</li>
|
1785
|
+
|
1786
|
+
<li class="never" data-hits="" data-linenumber="74">
|
1787
|
+
|
1788
|
+
|
1789
|
+
<code class="ruby"> }</code>
|
1790
|
+
</li>
|
1791
|
+
|
1792
|
+
<li class="never" data-hits="" data-linenumber="75">
|
1793
|
+
|
1794
|
+
|
1795
|
+
<code class="ruby"> }</code>
|
1796
|
+
</li>
|
1797
|
+
|
1798
|
+
<li class="never" data-hits="" data-linenumber="76">
|
1799
|
+
|
1800
|
+
|
1801
|
+
<code class="ruby"> }</code>
|
1802
|
+
</li>
|
1803
|
+
|
1804
|
+
<li class="never" data-hits="" data-linenumber="77">
|
1805
|
+
|
1806
|
+
|
1807
|
+
<code class="ruby"></code>
|
1808
|
+
</li>
|
1809
|
+
|
1810
|
+
<li class="covered" data-hits="1" data-linenumber="78">
|
1811
|
+
<span class="hits">1</span>
|
1812
|
+
|
1813
|
+
<code class="ruby"> attr_reader :schema, :query_type, :mutation_type, :subscription_type, :types</code>
|
1814
|
+
</li>
|
1815
|
+
|
1816
|
+
<li class="never" data-hits="" data-linenumber="79">
|
1817
|
+
|
1818
|
+
|
1819
|
+
<code class="ruby"></code>
|
1820
|
+
</li>
|
1821
|
+
|
1822
|
+
<li class="covered" data-hits="1" data-linenumber="80">
|
1823
|
+
<span class="hits">1</span>
|
1824
|
+
|
1825
|
+
<code class="ruby"> def initialize(client)</code>
|
1826
|
+
</li>
|
1827
|
+
|
1828
|
+
<li class="covered" data-hits="8" data-linenumber="81">
|
1829
|
+
<span class="hits">8</span>
|
1830
|
+
|
1831
|
+
<code class="ruby"> @schema = client.execute!(IntrospectionQuery).data.__schema</code>
|
1832
|
+
</li>
|
1833
|
+
|
1834
|
+
<li class="covered" data-hits="8" data-linenumber="82">
|
1835
|
+
<span class="hits">8</span>
|
1836
|
+
|
1837
|
+
<code class="ruby"> @query_type = schema.queryType</code>
|
1838
|
+
</li>
|
1839
|
+
|
1840
|
+
<li class="covered" data-hits="8" data-linenumber="83">
|
1841
|
+
<span class="hits">8</span>
|
1842
|
+
|
1843
|
+
<code class="ruby"> @mutation_type = schema.mutationType</code>
|
1844
|
+
</li>
|
1845
|
+
|
1846
|
+
<li class="covered" data-hits="8" data-linenumber="84">
|
1847
|
+
<span class="hits">8</span>
|
1848
|
+
|
1849
|
+
<code class="ruby"> @subscription_type = schema.subscriptionType</code>
|
1850
|
+
</li>
|
1851
|
+
|
1852
|
+
<li class="covered" data-hits="8" data-linenumber="85">
|
1853
|
+
<span class="hits">8</span>
|
1854
|
+
|
1855
|
+
<code class="ruby"> @types = schema.types</code>
|
1856
|
+
</li>
|
1857
|
+
|
1858
|
+
<li class="never" data-hits="" data-linenumber="86">
|
1859
|
+
|
1860
|
+
|
1861
|
+
<code class="ruby"> end</code>
|
1862
|
+
</li>
|
1863
|
+
|
1864
|
+
<li class="never" data-hits="" data-linenumber="87">
|
1865
|
+
|
1866
|
+
|
1867
|
+
<code class="ruby"></code>
|
1868
|
+
</li>
|
1869
|
+
|
1870
|
+
<li class="never" data-hits="" data-linenumber="88">
|
1871
|
+
|
1872
|
+
|
1873
|
+
<code class="ruby"> # Returns wether the query is valid or not</code>
|
1874
|
+
</li>
|
1875
|
+
|
1876
|
+
<li class="covered" data-hits="1" data-linenumber="89">
|
1877
|
+
<span class="hits">1</span>
|
1878
|
+
|
1879
|
+
<code class="ruby"> def valid?(query)</code>
|
1880
|
+
</li>
|
1881
|
+
|
1882
|
+
<li class="covered" data-hits="7" data-linenumber="90">
|
1883
|
+
<span class="hits">7</span>
|
1884
|
+
|
1885
|
+
<code class="ruby"> return false unless query.is_a?(Query)</code>
|
1886
|
+
</li>
|
1887
|
+
|
1888
|
+
<li class="never" data-hits="" data-linenumber="91">
|
1889
|
+
|
1890
|
+
|
1891
|
+
<code class="ruby"></code>
|
1892
|
+
</li>
|
1893
|
+
|
1894
|
+
<li class="covered" data-hits="14" data-linenumber="92">
|
1895
|
+
<span class="hits">14</span>
|
1896
|
+
|
1897
|
+
<code class="ruby"> query_type = types.find { |t| t.name.casecmp('query').zero? }</code>
|
1898
|
+
</li>
|
1899
|
+
|
1900
|
+
<li class="covered" data-hits="7" data-linenumber="93">
|
1901
|
+
<span class="hits">7</span>
|
1902
|
+
|
1903
|
+
<code class="ruby"> query.__nodes.each do |node|</code>
|
1904
|
+
</li>
|
1905
|
+
|
1906
|
+
<li class="covered" data-hits="7" data-linenumber="94">
|
1907
|
+
<span class="hits">7</span>
|
1908
|
+
|
1909
|
+
<code class="ruby"> return false unless valid_node?(query_type, node)</code>
|
1910
|
+
</li>
|
1911
|
+
|
1912
|
+
<li class="never" data-hits="" data-linenumber="95">
|
1913
|
+
|
1914
|
+
|
1915
|
+
<code class="ruby"> end</code>
|
1916
|
+
</li>
|
1917
|
+
|
1918
|
+
<li class="never" data-hits="" data-linenumber="96">
|
1919
|
+
|
1920
|
+
|
1921
|
+
<code class="ruby"></code>
|
1922
|
+
</li>
|
1923
|
+
|
1924
|
+
<li class="covered" data-hits="1" data-linenumber="97">
|
1925
|
+
<span class="hits">1</span>
|
1926
|
+
|
1927
|
+
<code class="ruby"> true</code>
|
1928
|
+
</li>
|
1929
|
+
|
1930
|
+
<li class="never" data-hits="" data-linenumber="98">
|
1931
|
+
|
1932
|
+
|
1933
|
+
<code class="ruby"> end</code>
|
1934
|
+
</li>
|
1935
|
+
|
1936
|
+
<li class="never" data-hits="" data-linenumber="99">
|
1937
|
+
|
1938
|
+
|
1939
|
+
<code class="ruby"></code>
|
1940
|
+
</li>
|
1941
|
+
|
1942
|
+
<li class="covered" data-hits="1" data-linenumber="100">
|
1943
|
+
<span class="hits">1</span>
|
1944
|
+
|
1945
|
+
<code class="ruby"> private</code>
|
1946
|
+
</li>
|
1947
|
+
|
1948
|
+
<li class="never" data-hits="" data-linenumber="101">
|
1949
|
+
|
1950
|
+
|
1951
|
+
<code class="ruby"></code>
|
1952
|
+
</li>
|
1953
|
+
|
1954
|
+
<li class="covered" data-hits="1" data-linenumber="102">
|
1955
|
+
<span class="hits">1</span>
|
1956
|
+
|
1957
|
+
<code class="ruby"> def valid_node?(parent_type, node)</code>
|
1958
|
+
</li>
|
1959
|
+
|
1960
|
+
<li class="covered" data-hits="20" data-linenumber="103">
|
1961
|
+
<span class="hits">20</span>
|
1962
|
+
|
1963
|
+
<code class="ruby"> return true if parent_type.kind == 'SCALAR'</code>
|
1964
|
+
</li>
|
1965
|
+
|
1966
|
+
<li class="never" data-hits="" data-linenumber="104">
|
1967
|
+
|
1968
|
+
|
1969
|
+
<code class="ruby"></code>
|
1970
|
+
</li>
|
1971
|
+
|
1972
|
+
<li class="covered" data-hits="20" data-linenumber="105">
|
1973
|
+
<span class="hits">20</span>
|
1974
|
+
|
1975
|
+
<code class="ruby"> return valid_match_node?(parent_type, node) if node.__name.start_with?('... on')</code>
|
1976
|
+
</li>
|
1977
|
+
|
1978
|
+
<li class="never" data-hits="" data-linenumber="106">
|
1979
|
+
|
1980
|
+
|
1981
|
+
<code class="ruby"></code>
|
1982
|
+
</li>
|
1983
|
+
|
1984
|
+
<li class="covered" data-hits="117" data-linenumber="107">
|
1985
|
+
<span class="hits">117</span>
|
1986
|
+
|
1987
|
+
<code class="ruby"> node_type = parent_type.fetch('fields', []).find { |f| f.name == node.__name }</code>
|
1988
|
+
</li>
|
1989
|
+
|
1990
|
+
<li class="covered" data-hits="18" data-linenumber="108">
|
1991
|
+
<span class="hits">18</span>
|
1992
|
+
|
1993
|
+
<code class="ruby"> return false if node_type.nil?</code>
|
1994
|
+
</li>
|
1995
|
+
|
1996
|
+
<li class="never" data-hits="" data-linenumber="109">
|
1997
|
+
|
1998
|
+
|
1999
|
+
<code class="ruby"></code>
|
2000
|
+
</li>
|
2001
|
+
|
2002
|
+
<li class="covered" data-hits="17" data-linenumber="110">
|
2003
|
+
<span class="hits">17</span>
|
2004
|
+
|
2005
|
+
<code class="ruby"> return false unless valid_params?(node_type, node)</code>
|
2006
|
+
</li>
|
2007
|
+
|
2008
|
+
<li class="never" data-hits="" data-linenumber="111">
|
2009
|
+
|
2010
|
+
|
2011
|
+
<code class="ruby"></code>
|
2012
|
+
</li>
|
2013
|
+
|
2014
|
+
<li class="covered" data-hits="15" data-linenumber="112">
|
2015
|
+
<span class="hits">15</span>
|
2016
|
+
|
2017
|
+
<code class="ruby"> resolved_node_type = type_for(node_type)</code>
|
2018
|
+
</li>
|
2019
|
+
|
2020
|
+
<li class="covered" data-hits="15" data-linenumber="113">
|
2021
|
+
<span class="hits">15</span>
|
2022
|
+
|
2023
|
+
<code class="ruby"> return false if resolved_node_type.nil?</code>
|
2024
|
+
</li>
|
2025
|
+
|
2026
|
+
<li class="never" data-hits="" data-linenumber="114">
|
2027
|
+
|
2028
|
+
|
2029
|
+
<code class="ruby"></code>
|
2030
|
+
</li>
|
2031
|
+
|
2032
|
+
<li class="covered" data-hits="15" data-linenumber="115">
|
2033
|
+
<span class="hits">15</span>
|
2034
|
+
|
2035
|
+
<code class="ruby"> return false unless valid_nesting_node?(resolved_node_type, node)</code>
|
2036
|
+
</li>
|
2037
|
+
|
2038
|
+
<li class="never" data-hits="" data-linenumber="116">
|
2039
|
+
|
2040
|
+
|
2041
|
+
<code class="ruby"></code>
|
2042
|
+
</li>
|
2043
|
+
|
2044
|
+
<li class="covered" data-hits="26" data-linenumber="117">
|
2045
|
+
<span class="hits">26</span>
|
2046
|
+
|
2047
|
+
<code class="ruby"> node.__nodes.all? { |n| valid_node?(resolved_node_type, n) }</code>
|
2048
|
+
</li>
|
2049
|
+
|
2050
|
+
<li class="never" data-hits="" data-linenumber="118">
|
2051
|
+
|
2052
|
+
|
2053
|
+
<code class="ruby"> end</code>
|
2054
|
+
</li>
|
2055
|
+
|
2056
|
+
<li class="never" data-hits="" data-linenumber="119">
|
2057
|
+
|
2058
|
+
|
2059
|
+
<code class="ruby"></code>
|
2060
|
+
</li>
|
2061
|
+
|
2062
|
+
<li class="covered" data-hits="1" data-linenumber="120">
|
2063
|
+
<span class="hits">1</span>
|
2064
|
+
|
2065
|
+
<code class="ruby"> def valid_match_node?(parent_type, node)</code>
|
2066
|
+
</li>
|
2067
|
+
|
2068
|
+
<li class="covered" data-hits="7" data-linenumber="121">
|
2069
|
+
<span class="hits">7</span>
|
2070
|
+
|
2071
|
+
<code class="ruby"> return true if parent_type.fetch('possibleTypes', []).find { |t| t.name == node.__name.gsub('... on ', '') }</code>
|
2072
|
+
</li>
|
2073
|
+
|
2074
|
+
<li class="covered" data-hits="1" data-linenumber="122">
|
2075
|
+
<span class="hits">1</span>
|
2076
|
+
|
2077
|
+
<code class="ruby"> false</code>
|
2078
|
+
</li>
|
2079
|
+
|
2080
|
+
<li class="never" data-hits="" data-linenumber="123">
|
2081
|
+
|
2082
|
+
|
2083
|
+
<code class="ruby"> end</code>
|
2084
|
+
</li>
|
2085
|
+
|
2086
|
+
<li class="never" data-hits="" data-linenumber="124">
|
2087
|
+
|
2088
|
+
|
2089
|
+
<code class="ruby"></code>
|
2090
|
+
</li>
|
2091
|
+
|
2092
|
+
<li class="covered" data-hits="1" data-linenumber="125">
|
2093
|
+
<span class="hits">1</span>
|
2094
|
+
|
2095
|
+
<code class="ruby"> def valid_params?(node_type, node)</code>
|
2096
|
+
</li>
|
2097
|
+
|
2098
|
+
<li class="covered" data-hits="17" data-linenumber="126">
|
2099
|
+
<span class="hits">17</span>
|
2100
|
+
|
2101
|
+
<code class="ruby"> node.__params.each do |param, value|</code>
|
2102
|
+
</li>
|
2103
|
+
|
2104
|
+
<li class="covered" data-hits="24" data-linenumber="127">
|
2105
|
+
<span class="hits">24</span>
|
2106
|
+
|
2107
|
+
<code class="ruby"> arg = node_type.fetch('args', []).find { |a| a.name == param.to_s }</code>
|
2108
|
+
</li>
|
2109
|
+
|
2110
|
+
<li class="covered" data-hits="5" data-linenumber="128">
|
2111
|
+
<span class="hits">5</span>
|
2112
|
+
|
2113
|
+
<code class="ruby"> return false if arg.nil?</code>
|
2114
|
+
</li>
|
2115
|
+
|
2116
|
+
<li class="never" data-hits="" data-linenumber="129">
|
2117
|
+
|
2118
|
+
|
2119
|
+
<code class="ruby"></code>
|
2120
|
+
</li>
|
2121
|
+
|
2122
|
+
<li class="covered" data-hits="4" data-linenumber="130">
|
2123
|
+
<span class="hits">4</span>
|
2124
|
+
|
2125
|
+
<code class="ruby"> arg_type = type_for(arg)</code>
|
2126
|
+
</li>
|
2127
|
+
|
2128
|
+
<li class="covered" data-hits="4" data-linenumber="131">
|
2129
|
+
<span class="hits">4</span>
|
2130
|
+
|
2131
|
+
<code class="ruby"> return false if arg_type.nil?</code>
|
2132
|
+
</li>
|
2133
|
+
|
2134
|
+
<li class="never" data-hits="" data-linenumber="132">
|
2135
|
+
|
2136
|
+
|
2137
|
+
<code class="ruby"></code>
|
2138
|
+
</li>
|
2139
|
+
|
2140
|
+
<li class="covered" data-hits="4" data-linenumber="133">
|
2141
|
+
<span class="hits">4</span>
|
2142
|
+
|
2143
|
+
<code class="ruby"> return false unless valid_value_for_type?(arg_type, value)</code>
|
2144
|
+
</li>
|
2145
|
+
|
2146
|
+
<li class="never" data-hits="" data-linenumber="134">
|
2147
|
+
|
2148
|
+
|
2149
|
+
<code class="ruby"> end</code>
|
2150
|
+
</li>
|
2151
|
+
|
2152
|
+
<li class="never" data-hits="" data-linenumber="135">
|
2153
|
+
|
2154
|
+
|
2155
|
+
<code class="ruby"></code>
|
2156
|
+
</li>
|
2157
|
+
|
2158
|
+
<li class="covered" data-hits="15" data-linenumber="136">
|
2159
|
+
<span class="hits">15</span>
|
2160
|
+
|
2161
|
+
<code class="ruby"> true</code>
|
2162
|
+
</li>
|
2163
|
+
|
2164
|
+
<li class="never" data-hits="" data-linenumber="137">
|
2165
|
+
|
2166
|
+
|
2167
|
+
<code class="ruby"> end</code>
|
2168
|
+
</li>
|
2169
|
+
|
2170
|
+
<li class="never" data-hits="" data-linenumber="138">
|
2171
|
+
|
2172
|
+
|
2173
|
+
<code class="ruby"></code>
|
2174
|
+
</li>
|
2175
|
+
|
2176
|
+
<li class="covered" data-hits="1" data-linenumber="139">
|
2177
|
+
<span class="hits">1</span>
|
2178
|
+
|
2179
|
+
<code class="ruby"> def valid_nesting_node?(node_type, node)</code>
|
2180
|
+
</li>
|
2181
|
+
|
2182
|
+
<li class="covered" data-hits="15" data-linenumber="140">
|
2183
|
+
<span class="hits">15</span>
|
2184
|
+
|
2185
|
+
<code class="ruby"> return false unless valid_object_node?(node_type, node)</code>
|
2186
|
+
</li>
|
2187
|
+
|
2188
|
+
<li class="covered" data-hits="13" data-linenumber="141">
|
2189
|
+
<span class="hits">13</span>
|
2190
|
+
|
2191
|
+
<code class="ruby"> return false unless valid_array_node?(node_type, node)</code>
|
2192
|
+
</li>
|
2193
|
+
|
2194
|
+
<li class="covered" data-hits="13" data-linenumber="142">
|
2195
|
+
<span class="hits">13</span>
|
2196
|
+
|
2197
|
+
<code class="ruby"> true</code>
|
2198
|
+
</li>
|
2199
|
+
|
2200
|
+
<li class="never" data-hits="" data-linenumber="143">
|
2201
|
+
|
2202
|
+
|
2203
|
+
<code class="ruby"> end</code>
|
2204
|
+
</li>
|
2205
|
+
|
2206
|
+
<li class="never" data-hits="" data-linenumber="144">
|
2207
|
+
|
2208
|
+
|
2209
|
+
<code class="ruby"></code>
|
2210
|
+
</li>
|
2211
|
+
|
2212
|
+
<li class="covered" data-hits="1" data-linenumber="145">
|
2213
|
+
<span class="hits">1</span>
|
2214
|
+
|
2215
|
+
<code class="ruby"> def valid_object_node?(node_type, node)</code>
|
2216
|
+
</li>
|
2217
|
+
|
2218
|
+
<li class="covered" data-hits="15" data-linenumber="146">
|
2219
|
+
<span class="hits">15</span>
|
2220
|
+
|
2221
|
+
<code class="ruby"> return false if %w[OBJECT INTERFACE].include?(node_type.kind) && node.__nodes.empty?</code>
|
2222
|
+
</li>
|
2223
|
+
|
2224
|
+
<li class="covered" data-hits="13" data-linenumber="147">
|
2225
|
+
<span class="hits">13</span>
|
2226
|
+
|
2227
|
+
<code class="ruby"> true</code>
|
2228
|
+
</li>
|
2229
|
+
|
2230
|
+
<li class="never" data-hits="" data-linenumber="148">
|
2231
|
+
|
2232
|
+
|
2233
|
+
<code class="ruby"> end</code>
|
2234
|
+
</li>
|
2235
|
+
|
2236
|
+
<li class="never" data-hits="" data-linenumber="149">
|
2237
|
+
|
2238
|
+
|
2239
|
+
<code class="ruby"></code>
|
2240
|
+
</li>
|
2241
|
+
|
2242
|
+
<li class="covered" data-hits="1" data-linenumber="150">
|
2243
|
+
<span class="hits">1</span>
|
2244
|
+
|
2245
|
+
<code class="ruby"> def valid_array_node?(node_type, node)</code>
|
2246
|
+
</li>
|
2247
|
+
|
2248
|
+
<li class="covered" data-hits="13" data-linenumber="151">
|
2249
|
+
<span class="hits">13</span>
|
2250
|
+
|
2251
|
+
<code class="ruby"> return false if %w[OBJECT INTERFACE].include?(node_type.kind) && node.__nodes.empty?</code>
|
2252
|
+
</li>
|
2253
|
+
|
2254
|
+
<li class="covered" data-hits="13" data-linenumber="152">
|
2255
|
+
<span class="hits">13</span>
|
2256
|
+
|
2257
|
+
<code class="ruby"> true</code>
|
2258
|
+
</li>
|
2259
|
+
|
2260
|
+
<li class="never" data-hits="" data-linenumber="153">
|
2261
|
+
|
2262
|
+
|
2263
|
+
<code class="ruby"> end</code>
|
2264
|
+
</li>
|
2265
|
+
|
2266
|
+
<li class="never" data-hits="" data-linenumber="154">
|
2267
|
+
|
2268
|
+
|
2269
|
+
<code class="ruby"></code>
|
2270
|
+
</li>
|
2271
|
+
|
2272
|
+
<li class="covered" data-hits="1" data-linenumber="155">
|
2273
|
+
<span class="hits">1</span>
|
2274
|
+
|
2275
|
+
<code class="ruby"> def valid_value_for_type?(arg_type, value)</code>
|
2276
|
+
</li>
|
2277
|
+
|
2278
|
+
<li class="covered" data-hits="7" data-linenumber="156">
|
2279
|
+
<span class="hits">7</span>
|
2280
|
+
|
2281
|
+
<code class="ruby"> case value</code>
|
2282
|
+
</li>
|
2283
|
+
|
2284
|
+
<li class="never" data-hits="" data-linenumber="157">
|
2285
|
+
|
2286
|
+
|
2287
|
+
<code class="ruby"> when ::String</code>
|
2288
|
+
</li>
|
2289
|
+
|
2290
|
+
<li class="covered" data-hits="4" data-linenumber="158">
|
2291
|
+
<span class="hits">4</span>
|
2292
|
+
|
2293
|
+
<code class="ruby"> return false unless arg_type.name == 'String' || arg_type.name == 'ID'</code>
|
2294
|
+
</li>
|
2295
|
+
|
2296
|
+
<li class="never" data-hits="" data-linenumber="159">
|
2297
|
+
|
2298
|
+
|
2299
|
+
<code class="ruby"> when ::Integer</code>
|
2300
|
+
</li>
|
2301
|
+
|
2302
|
+
<li class="covered" data-hits="1" data-linenumber="160">
|
2303
|
+
<span class="hits">1</span>
|
2304
|
+
|
2305
|
+
<code class="ruby"> return false unless arg_type.name == 'Int'</code>
|
2306
|
+
</li>
|
2307
|
+
|
2308
|
+
<li class="never" data-hits="" data-linenumber="161">
|
2309
|
+
|
2310
|
+
|
2311
|
+
<code class="ruby"> when ::Float</code>
|
2312
|
+
</li>
|
2313
|
+
|
2314
|
+
<li class="missed" data-hits="0" data-linenumber="162">
|
2315
|
+
|
2316
|
+
|
2317
|
+
<code class="ruby"> return false unless arg_type.name == 'Float'</code>
|
2318
|
+
</li>
|
2319
|
+
|
2320
|
+
<li class="never" data-hits="" data-linenumber="163">
|
2321
|
+
|
2322
|
+
|
2323
|
+
<code class="ruby"> when ::Hash</code>
|
2324
|
+
</li>
|
2325
|
+
|
2326
|
+
<li class="covered" data-hits="2" data-linenumber="164">
|
2327
|
+
<span class="hits">2</span>
|
2328
|
+
|
2329
|
+
<code class="ruby"> return valid_hash_value?(arg_type, value)</code>
|
2330
|
+
</li>
|
2331
|
+
|
2332
|
+
<li class="never" data-hits="" data-linenumber="165">
|
2333
|
+
|
2334
|
+
|
2335
|
+
<code class="ruby"> when true, false</code>
|
2336
|
+
</li>
|
2337
|
+
|
2338
|
+
<li class="missed" data-hits="0" data-linenumber="166">
|
2339
|
+
|
2340
|
+
|
2341
|
+
<code class="ruby"> return false unless arg_type.name == 'Boolean'</code>
|
2342
|
+
</li>
|
2343
|
+
|
2344
|
+
<li class="never" data-hits="" data-linenumber="167">
|
2345
|
+
|
2346
|
+
|
2347
|
+
<code class="ruby"> else</code>
|
2348
|
+
</li>
|
2349
|
+
|
2350
|
+
<li class="missed" data-hits="0" data-linenumber="168">
|
2351
|
+
|
2352
|
+
|
2353
|
+
<code class="ruby"> return false</code>
|
2354
|
+
</li>
|
2355
|
+
|
2356
|
+
<li class="never" data-hits="" data-linenumber="169">
|
2357
|
+
|
2358
|
+
|
2359
|
+
<code class="ruby"> end</code>
|
2360
|
+
</li>
|
2361
|
+
|
2362
|
+
<li class="never" data-hits="" data-linenumber="170">
|
2363
|
+
|
2364
|
+
|
2365
|
+
<code class="ruby"></code>
|
2366
|
+
</li>
|
2367
|
+
|
2368
|
+
<li class="covered" data-hits="4" data-linenumber="171">
|
2369
|
+
<span class="hits">4</span>
|
2370
|
+
|
2371
|
+
<code class="ruby"> true</code>
|
2372
|
+
</li>
|
2373
|
+
|
2374
|
+
<li class="never" data-hits="" data-linenumber="172">
|
2375
|
+
|
2376
|
+
|
2377
|
+
<code class="ruby"> end</code>
|
2378
|
+
</li>
|
2379
|
+
|
2380
|
+
<li class="never" data-hits="" data-linenumber="173">
|
2381
|
+
|
2382
|
+
|
2383
|
+
<code class="ruby"></code>
|
2384
|
+
</li>
|
2385
|
+
|
2386
|
+
<li class="covered" data-hits="1" data-linenumber="174">
|
2387
|
+
<span class="hits">1</span>
|
2388
|
+
|
2389
|
+
<code class="ruby"> def valid_hash_value?(arg_type, value)</code>
|
2390
|
+
</li>
|
2391
|
+
|
2392
|
+
<li class="covered" data-hits="2" data-linenumber="175">
|
2393
|
+
<span class="hits">2</span>
|
2394
|
+
|
2395
|
+
<code class="ruby"> return false unless arg_type.kind == 'INPUT_OBJECT'</code>
|
2396
|
+
</li>
|
2397
|
+
|
2398
|
+
<li class="never" data-hits="" data-linenumber="176">
|
2399
|
+
|
2400
|
+
|
2401
|
+
<code class="ruby"></code>
|
2402
|
+
</li>
|
2403
|
+
|
2404
|
+
<li class="covered" data-hits="48" data-linenumber="177">
|
2405
|
+
<span class="hits">48</span>
|
2406
|
+
|
2407
|
+
<code class="ruby"> type = types.find { |f| f.name == arg_type.name }</code>
|
2408
|
+
</li>
|
2409
|
+
|
2410
|
+
<li class="covered" data-hits="2" data-linenumber="178">
|
2411
|
+
<span class="hits">2</span>
|
2412
|
+
|
2413
|
+
<code class="ruby"> return false if type.nil?</code>
|
2414
|
+
</li>
|
2415
|
+
|
2416
|
+
<li class="never" data-hits="" data-linenumber="179">
|
2417
|
+
|
2418
|
+
|
2419
|
+
<code class="ruby"></code>
|
2420
|
+
</li>
|
2421
|
+
|
2422
|
+
<li class="covered" data-hits="2" data-linenumber="180">
|
2423
|
+
<span class="hits">2</span>
|
2424
|
+
|
2425
|
+
<code class="ruby"> value.each do |k, v|</code>
|
2426
|
+
</li>
|
2427
|
+
|
2428
|
+
<li class="covered" data-hits="52" data-linenumber="181">
|
2429
|
+
<span class="hits">52</span>
|
2430
|
+
|
2431
|
+
<code class="ruby"> input_field = type.fetch('inputFields', []).find { |f| f.name == k.to_s }</code>
|
2432
|
+
</li>
|
2433
|
+
|
2434
|
+
<li class="covered" data-hits="3" data-linenumber="182">
|
2435
|
+
<span class="hits">3</span>
|
2436
|
+
|
2437
|
+
<code class="ruby"> return false if input_field.nil?</code>
|
2438
|
+
</li>
|
2439
|
+
|
2440
|
+
<li class="never" data-hits="" data-linenumber="183">
|
2441
|
+
|
2442
|
+
|
2443
|
+
<code class="ruby"></code>
|
2444
|
+
</li>
|
2445
|
+
|
2446
|
+
<li class="covered" data-hits="3" data-linenumber="184">
|
2447
|
+
<span class="hits">3</span>
|
2448
|
+
|
2449
|
+
<code class="ruby"> input_field_type = type_for(input_field)</code>
|
2450
|
+
</li>
|
2451
|
+
|
2452
|
+
<li class="covered" data-hits="3" data-linenumber="185">
|
2453
|
+
<span class="hits">3</span>
|
2454
|
+
|
2455
|
+
<code class="ruby"> return false if input_field_type.nil?</code>
|
2456
|
+
</li>
|
2457
|
+
|
2458
|
+
<li class="never" data-hits="" data-linenumber="186">
|
2459
|
+
|
2460
|
+
|
2461
|
+
<code class="ruby"></code>
|
2462
|
+
</li>
|
2463
|
+
|
2464
|
+
<li class="covered" data-hits="3" data-linenumber="187">
|
2465
|
+
<span class="hits">3</span>
|
2466
|
+
|
2467
|
+
<code class="ruby"> return false unless valid_value_for_type?(input_field_type, v)</code>
|
2468
|
+
</li>
|
2469
|
+
|
2470
|
+
<li class="never" data-hits="" data-linenumber="188">
|
2471
|
+
|
2472
|
+
|
2473
|
+
<code class="ruby"> end</code>
|
2474
|
+
</li>
|
2475
|
+
|
2476
|
+
<li class="never" data-hits="" data-linenumber="189">
|
2477
|
+
|
2478
|
+
|
2479
|
+
<code class="ruby"> end</code>
|
2480
|
+
</li>
|
2481
|
+
|
2482
|
+
<li class="never" data-hits="" data-linenumber="190">
|
2483
|
+
|
2484
|
+
|
2485
|
+
<code class="ruby"></code>
|
2486
|
+
</li>
|
2487
|
+
|
2488
|
+
<li class="covered" data-hits="1" data-linenumber="191">
|
2489
|
+
<span class="hits">1</span>
|
2490
|
+
|
2491
|
+
<code class="ruby"> def type_for(field_type)</code>
|
2492
|
+
</li>
|
2493
|
+
|
2494
|
+
<li class="covered" data-hits="22" data-linenumber="192">
|
2495
|
+
<span class="hits">22</span>
|
2496
|
+
|
2497
|
+
<code class="ruby"> type = case field_type.type.kind</code>
|
2498
|
+
</li>
|
2499
|
+
|
2500
|
+
<li class="never" data-hits="" data-linenumber="193">
|
2501
|
+
|
2502
|
+
|
2503
|
+
<code class="ruby"> when 'NON_NULL'</code>
|
2504
|
+
</li>
|
2505
|
+
|
2506
|
+
<li class="covered" data-hits="3" data-linenumber="194">
|
2507
|
+
<span class="hits">3</span>
|
2508
|
+
|
2509
|
+
<code class="ruby"> non_null_type(field_type.type.ofType)</code>
|
2510
|
+
</li>
|
2511
|
+
|
2512
|
+
<li class="never" data-hits="" data-linenumber="195">
|
2513
|
+
|
2514
|
+
|
2515
|
+
<code class="ruby"> when 'LIST'</code>
|
2516
|
+
</li>
|
2517
|
+
|
2518
|
+
<li class="covered" data-hits="1" data-linenumber="196">
|
2519
|
+
<span class="hits">1</span>
|
2520
|
+
|
2521
|
+
<code class="ruby"> field_type.type.ofType</code>
|
2522
|
+
</li>
|
2523
|
+
|
2524
|
+
<li class="never" data-hits="" data-linenumber="197">
|
2525
|
+
|
2526
|
+
|
2527
|
+
<code class="ruby"> when 'OBJECT', 'INTERFACE', 'INPUT_OBJECT'</code>
|
2528
|
+
</li>
|
2529
|
+
|
2530
|
+
<li class="covered" data-hits="8" data-linenumber="198">
|
2531
|
+
<span class="hits">8</span>
|
2532
|
+
|
2533
|
+
<code class="ruby"> field_type.type</code>
|
2534
|
+
</li>
|
2535
|
+
|
2536
|
+
<li class="never" data-hits="" data-linenumber="199">
|
2537
|
+
|
2538
|
+
|
2539
|
+
<code class="ruby"> when 'SCALAR'</code>
|
2540
|
+
</li>
|
2541
|
+
|
2542
|
+
<li class="covered" data-hits="10" data-linenumber="200">
|
2543
|
+
<span class="hits">10</span>
|
2544
|
+
|
2545
|
+
<code class="ruby"> field_type.type</code>
|
2546
|
+
</li>
|
2547
|
+
|
2548
|
+
<li class="never" data-hits="" data-linenumber="201">
|
2549
|
+
|
2550
|
+
|
2551
|
+
<code class="ruby"> end</code>
|
2552
|
+
</li>
|
2553
|
+
|
2554
|
+
<li class="never" data-hits="" data-linenumber="202">
|
2555
|
+
|
2556
|
+
|
2557
|
+
<code class="ruby"></code>
|
2558
|
+
</li>
|
2559
|
+
|
2560
|
+
<li class="covered" data-hits="206" data-linenumber="203">
|
2561
|
+
<span class="hits">206</span>
|
2562
|
+
|
2563
|
+
<code class="ruby"> types.find { |t| t.name == type.name }</code>
|
2564
|
+
</li>
|
2565
|
+
|
2566
|
+
<li class="never" data-hits="" data-linenumber="204">
|
2567
|
+
|
2568
|
+
|
2569
|
+
<code class="ruby"> end</code>
|
2570
|
+
</li>
|
2571
|
+
|
2572
|
+
<li class="never" data-hits="" data-linenumber="205">
|
2573
|
+
|
2574
|
+
|
2575
|
+
<code class="ruby"></code>
|
2576
|
+
</li>
|
2577
|
+
|
2578
|
+
<li class="covered" data-hits="1" data-linenumber="206">
|
2579
|
+
<span class="hits">1</span>
|
2580
|
+
|
2581
|
+
<code class="ruby"> def non_null_type(non_null)</code>
|
2582
|
+
</li>
|
2583
|
+
|
2584
|
+
<li class="covered" data-hits="3" data-linenumber="207">
|
2585
|
+
<span class="hits">3</span>
|
2586
|
+
|
2587
|
+
<code class="ruby"> case non_null.kind</code>
|
2588
|
+
</li>
|
2589
|
+
|
2590
|
+
<li class="never" data-hits="" data-linenumber="208">
|
2591
|
+
|
2592
|
+
|
2593
|
+
<code class="ruby"> when 'LIST'</code>
|
2594
|
+
</li>
|
2595
|
+
|
2596
|
+
<li class="covered" data-hits="3" data-linenumber="209">
|
2597
|
+
<span class="hits">3</span>
|
2598
|
+
|
2599
|
+
<code class="ruby"> non_null.ofType</code>
|
2600
|
+
</li>
|
2601
|
+
|
2602
|
+
<li class="never" data-hits="" data-linenumber="210">
|
2603
|
+
|
2604
|
+
|
2605
|
+
<code class="ruby"> else</code>
|
2606
|
+
</li>
|
2607
|
+
|
2608
|
+
<li class="missed" data-hits="0" data-linenumber="211">
|
2609
|
+
|
2610
|
+
|
2611
|
+
<code class="ruby"> non_null</code>
|
2612
|
+
</li>
|
2613
|
+
|
2614
|
+
<li class="never" data-hits="" data-linenumber="212">
|
2615
|
+
|
2616
|
+
|
2617
|
+
<code class="ruby"> end</code>
|
2618
|
+
</li>
|
2619
|
+
|
2620
|
+
<li class="never" data-hits="" data-linenumber="213">
|
2621
|
+
|
2622
|
+
|
2623
|
+
<code class="ruby"> end</code>
|
2624
|
+
</li>
|
2625
|
+
|
2626
|
+
<li class="never" data-hits="" data-linenumber="214">
|
2627
|
+
|
2628
|
+
|
2629
|
+
<code class="ruby"> end</code>
|
2630
|
+
</li>
|
2631
|
+
|
2632
|
+
<li class="never" data-hits="" data-linenumber="215">
|
2633
|
+
|
2634
|
+
|
2635
|
+
<code class="ruby">end</code>
|
2636
|
+
</li>
|
2637
|
+
|
2638
|
+
</ol>
|
2639
|
+
</pre>
|
2640
|
+
</div>
|
2641
|
+
|
2642
|
+
|
2643
|
+
<div class="source_table" id="827311add0f30734381233709eff6f2feef29107">
|
2644
|
+
<div class="header">
|
2645
|
+
<h3>lib/gqli/node.rb</h3>
|
2646
|
+
<h4><span class="yellow">88.0 %</span> covered</h4>
|
2647
|
+
<div>
|
2648
|
+
<b>25</b> relevant lines.
|
2649
|
+
<span class="green"><b>22</b> lines covered</span> and
|
2650
|
+
<span class="red"><b>3</b> lines missed.</span>
|
2651
|
+
</div>
|
2652
|
+
</div>
|
2653
|
+
|
2654
|
+
<pre>
|
2655
|
+
<ol>
|
2656
|
+
|
2657
|
+
<li class="never" data-hits="" data-linenumber="1">
|
2658
|
+
|
2659
|
+
|
2660
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
2661
|
+
</li>
|
2662
|
+
|
2663
|
+
<li class="never" data-hits="" data-linenumber="2">
|
2664
|
+
|
2665
|
+
|
2666
|
+
<code class="ruby"></code>
|
2667
|
+
</li>
|
2668
|
+
|
2669
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
2670
|
+
<span class="hits">1</span>
|
2671
|
+
|
2672
|
+
<code class="ruby">require_relative './base'</code>
|
2673
|
+
</li>
|
2674
|
+
|
2675
|
+
<li class="never" data-hits="" data-linenumber="4">
|
2676
|
+
|
2677
|
+
|
2678
|
+
<code class="ruby"></code>
|
2679
|
+
</li>
|
2680
|
+
|
2681
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
2682
|
+
<span class="hits">1</span>
|
2683
|
+
|
2684
|
+
<code class="ruby">module GQLi</code>
|
2685
|
+
</li>
|
2686
|
+
|
2687
|
+
<li class="never" data-hits="" data-linenumber="6">
|
2688
|
+
|
2689
|
+
|
2690
|
+
<code class="ruby"> # Node wrapper</code>
|
2691
|
+
</li>
|
2692
|
+
|
2693
|
+
<li class="covered" data-hits="1" data-linenumber="7">
|
2694
|
+
<span class="hits">1</span>
|
2695
|
+
|
2696
|
+
<code class="ruby"> class Node < Base</code>
|
2697
|
+
</li>
|
2698
|
+
|
2699
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
2700
|
+
<span class="hits">1</span>
|
2701
|
+
|
2702
|
+
<code class="ruby"> attr_reader :__params</code>
|
2703
|
+
</li>
|
2704
|
+
|
2705
|
+
<li class="never" data-hits="" data-linenumber="9">
|
2706
|
+
|
2707
|
+
|
2708
|
+
<code class="ruby"></code>
|
2709
|
+
</li>
|
2710
|
+
|
2711
|
+
<li class="covered" data-hits="1" data-linenumber="10">
|
2712
|
+
<span class="hits">1</span>
|
2713
|
+
|
2714
|
+
<code class="ruby"> def initialize(name, params = {}, depth = 1, &block)</code>
|
2715
|
+
</li>
|
2716
|
+
|
2717
|
+
<li class="covered" data-hits="244" data-linenumber="11">
|
2718
|
+
<span class="hits">244</span>
|
2719
|
+
|
2720
|
+
<code class="ruby"> super(name, depth, &block)</code>
|
2721
|
+
</li>
|
2722
|
+
|
2723
|
+
<li class="covered" data-hits="244" data-linenumber="12">
|
2724
|
+
<span class="hits">244</span>
|
2725
|
+
|
2726
|
+
<code class="ruby"> @__params = params</code>
|
2727
|
+
</li>
|
2728
|
+
|
2729
|
+
<li class="never" data-hits="" data-linenumber="13">
|
2730
|
+
|
2731
|
+
|
2732
|
+
<code class="ruby"> end</code>
|
2733
|
+
</li>
|
2734
|
+
|
2735
|
+
<li class="never" data-hits="" data-linenumber="14">
|
2736
|
+
|
2737
|
+
|
2738
|
+
<code class="ruby"></code>
|
2739
|
+
</li>
|
2740
|
+
|
2741
|
+
<li class="never" data-hits="" data-linenumber="15">
|
2742
|
+
|
2743
|
+
|
2744
|
+
<code class="ruby"> # Serializes to a GraphQL string</code>
|
2745
|
+
</li>
|
2746
|
+
|
2747
|
+
<li class="covered" data-hits="1" data-linenumber="16">
|
2748
|
+
<span class="hits">1</span>
|
2749
|
+
|
2750
|
+
<code class="ruby"> def to_gql</code>
|
2751
|
+
</li>
|
2752
|
+
|
2753
|
+
<li class="covered" data-hits="888" data-linenumber="17">
|
2754
|
+
<span class="hits">888</span>
|
2755
|
+
|
2756
|
+
<code class="ruby"> result = ' ' * __depth + __name</code>
|
2757
|
+
</li>
|
2758
|
+
|
2759
|
+
<li class="covered" data-hits="888" data-linenumber="18">
|
2760
|
+
<span class="hits">888</span>
|
2761
|
+
|
2762
|
+
<code class="ruby"> result += '(' + __params_to_s(__params, true) + ')' unless __params.empty?</code>
|
2763
|
+
</li>
|
2764
|
+
|
2765
|
+
<li class="covered" data-hits="888" data-linenumber="19">
|
2766
|
+
<span class="hits">888</span>
|
2767
|
+
|
2768
|
+
<code class="ruby"> unless __nodes.empty?</code>
|
2769
|
+
</li>
|
2770
|
+
|
2771
|
+
<li class="covered" data-hits="280" data-linenumber="20">
|
2772
|
+
<span class="hits">280</span>
|
2773
|
+
|
2774
|
+
<code class="ruby"> result += " {\n"</code>
|
2775
|
+
</li>
|
2776
|
+
|
2777
|
+
<li class="covered" data-hits="280" data-linenumber="21">
|
2778
|
+
<span class="hits">280</span>
|
2779
|
+
|
2780
|
+
<code class="ruby"> result += __nodes.map(&:to_gql).join("\n")</code>
|
2781
|
+
</li>
|
2782
|
+
|
2783
|
+
<li class="covered" data-hits="280" data-linenumber="22">
|
2784
|
+
<span class="hits">280</span>
|
2785
|
+
|
2786
|
+
<code class="ruby"> result += "\n#{' ' * __depth}}"</code>
|
2787
|
+
</li>
|
2788
|
+
|
2789
|
+
<li class="never" data-hits="" data-linenumber="23">
|
2790
|
+
|
2791
|
+
|
2792
|
+
<code class="ruby"> end</code>
|
2793
|
+
</li>
|
2794
|
+
|
2795
|
+
<li class="never" data-hits="" data-linenumber="24">
|
2796
|
+
|
2797
|
+
|
2798
|
+
<code class="ruby"></code>
|
2799
|
+
</li>
|
2800
|
+
|
2801
|
+
<li class="covered" data-hits="888" data-linenumber="25">
|
2802
|
+
<span class="hits">888</span>
|
2803
|
+
|
2804
|
+
<code class="ruby"> result</code>
|
2805
|
+
</li>
|
2806
|
+
|
2807
|
+
<li class="never" data-hits="" data-linenumber="26">
|
2808
|
+
|
2809
|
+
|
2810
|
+
<code class="ruby"> end</code>
|
2811
|
+
</li>
|
2812
|
+
|
2813
|
+
<li class="never" data-hits="" data-linenumber="27">
|
2814
|
+
|
2815
|
+
|
2816
|
+
<code class="ruby"></code>
|
2817
|
+
</li>
|
2818
|
+
|
2819
|
+
<li class="covered" data-hits="1" data-linenumber="28">
|
2820
|
+
<span class="hits">1</span>
|
2821
|
+
|
2822
|
+
<code class="ruby"> private</code>
|
2823
|
+
</li>
|
2824
|
+
|
2825
|
+
<li class="never" data-hits="" data-linenumber="29">
|
2826
|
+
|
2827
|
+
|
2828
|
+
<code class="ruby"></code>
|
2829
|
+
</li>
|
2830
|
+
|
2831
|
+
<li class="covered" data-hits="1" data-linenumber="30">
|
2832
|
+
<span class="hits">1</span>
|
2833
|
+
|
2834
|
+
<code class="ruby"> def __params_to_s(params, initial = false)</code>
|
2835
|
+
</li>
|
2836
|
+
|
2837
|
+
<li class="covered" data-hits="32" data-linenumber="31">
|
2838
|
+
<span class="hits">32</span>
|
2839
|
+
|
2840
|
+
<code class="ruby"> case params</code>
|
2841
|
+
</li>
|
2842
|
+
|
2843
|
+
<li class="never" data-hits="" data-linenumber="32">
|
2844
|
+
|
2845
|
+
|
2846
|
+
<code class="ruby"> when ::Hash</code>
|
2847
|
+
</li>
|
2848
|
+
|
2849
|
+
<li class="covered" data-hits="16" data-linenumber="33">
|
2850
|
+
<span class="hits">16</span>
|
2851
|
+
|
2852
|
+
<code class="ruby"> result = params.map do |k, v|</code>
|
2853
|
+
</li>
|
2854
|
+
|
2855
|
+
<li class="covered" data-hits="16" data-linenumber="34">
|
2856
|
+
<span class="hits">16</span>
|
2857
|
+
|
2858
|
+
<code class="ruby"> "#{k}: #{__params_to_s(v)}"</code>
|
2859
|
+
</li>
|
2860
|
+
|
2861
|
+
<li class="never" data-hits="" data-linenumber="35">
|
2862
|
+
|
2863
|
+
|
2864
|
+
<code class="ruby"> end.join(', ')</code>
|
2865
|
+
</li>
|
2866
|
+
|
2867
|
+
<li class="never" data-hits="" data-linenumber="36">
|
2868
|
+
|
2869
|
+
|
2870
|
+
<code class="ruby"></code>
|
2871
|
+
</li>
|
2872
|
+
|
2873
|
+
<li class="covered" data-hits="16" data-linenumber="37">
|
2874
|
+
<span class="hits">16</span>
|
2875
|
+
|
2876
|
+
<code class="ruby"> return result if initial</code>
|
2877
|
+
</li>
|
2878
|
+
|
2879
|
+
<li class="missed" data-hits="0" data-linenumber="38">
|
2880
|
+
|
2881
|
+
|
2882
|
+
<code class="ruby"> "{#{result}}"</code>
|
2883
|
+
</li>
|
2884
|
+
|
2885
|
+
<li class="never" data-hits="" data-linenumber="39">
|
2886
|
+
|
2887
|
+
|
2888
|
+
<code class="ruby"> when ::Array</code>
|
2889
|
+
</li>
|
2890
|
+
|
2891
|
+
<li class="missed" data-hits="0" data-linenumber="40">
|
2892
|
+
|
2893
|
+
|
2894
|
+
<code class="ruby"> "[#{params.map { |p| __params_to_s(p) }.join(', ')}]"</code>
|
2895
|
+
</li>
|
2896
|
+
|
2897
|
+
<li class="never" data-hits="" data-linenumber="41">
|
2898
|
+
|
2899
|
+
|
2900
|
+
<code class="ruby"> when ::String</code>
|
2901
|
+
</li>
|
2902
|
+
|
2903
|
+
<li class="missed" data-hits="0" data-linenumber="42">
|
2904
|
+
|
2905
|
+
|
2906
|
+
<code class="ruby"> "\"#{params}\""</code>
|
2907
|
+
</li>
|
2908
|
+
|
2909
|
+
<li class="never" data-hits="" data-linenumber="43">
|
2910
|
+
|
2911
|
+
|
2912
|
+
<code class="ruby"> else</code>
|
2913
|
+
</li>
|
2914
|
+
|
2915
|
+
<li class="covered" data-hits="16" data-linenumber="44">
|
2916
|
+
<span class="hits">16</span>
|
2917
|
+
|
2918
|
+
<code class="ruby"> params.to_s</code>
|
2919
|
+
</li>
|
2920
|
+
|
2921
|
+
<li class="never" data-hits="" data-linenumber="45">
|
2922
|
+
|
2923
|
+
|
2924
|
+
<code class="ruby"> end</code>
|
2925
|
+
</li>
|
2926
|
+
|
2927
|
+
<li class="never" data-hits="" data-linenumber="46">
|
2928
|
+
|
2929
|
+
|
2930
|
+
<code class="ruby"> end</code>
|
2931
|
+
</li>
|
2932
|
+
|
2933
|
+
<li class="never" data-hits="" data-linenumber="47">
|
2934
|
+
|
2935
|
+
|
2936
|
+
<code class="ruby"> end</code>
|
2937
|
+
</li>
|
2938
|
+
|
2939
|
+
<li class="never" data-hits="" data-linenumber="48">
|
2940
|
+
|
2941
|
+
|
2942
|
+
<code class="ruby">end</code>
|
2943
|
+
</li>
|
2944
|
+
|
2945
|
+
</ol>
|
2946
|
+
</pre>
|
2947
|
+
</div>
|
2948
|
+
|
2949
|
+
|
2950
|
+
<div class="source_table" id="add3b96d53406d04d830c517b925e60e5592500d">
|
2951
|
+
<div class="header">
|
2952
|
+
<h3>lib/gqli/query.rb</h3>
|
2953
|
+
<h4><span class="red">80.0 %</span> covered</h4>
|
2954
|
+
<div>
|
2955
|
+
<b>10</b> relevant lines.
|
2956
|
+
<span class="green"><b>8</b> lines covered</span> and
|
2957
|
+
<span class="red"><b>2</b> lines missed.</span>
|
2958
|
+
</div>
|
2959
|
+
</div>
|
2960
|
+
|
2961
|
+
<pre>
|
2962
|
+
<ol>
|
2963
|
+
|
2964
|
+
<li class="never" data-hits="" data-linenumber="1">
|
2965
|
+
|
2966
|
+
|
2967
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
2968
|
+
</li>
|
2969
|
+
|
2970
|
+
<li class="never" data-hits="" data-linenumber="2">
|
2971
|
+
|
2972
|
+
|
2973
|
+
<code class="ruby"></code>
|
2974
|
+
</li>
|
2975
|
+
|
2976
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
2977
|
+
<span class="hits">1</span>
|
2978
|
+
|
2979
|
+
<code class="ruby">require_relative './base'</code>
|
2980
|
+
</li>
|
2981
|
+
|
2982
|
+
<li class="never" data-hits="" data-linenumber="4">
|
2983
|
+
|
2984
|
+
|
2985
|
+
<code class="ruby"></code>
|
2986
|
+
</li>
|
2987
|
+
|
2988
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
2989
|
+
<span class="hits">1</span>
|
2990
|
+
|
2991
|
+
<code class="ruby">module GQLi</code>
|
2992
|
+
</li>
|
2993
|
+
|
2994
|
+
<li class="never" data-hits="" data-linenumber="6">
|
2995
|
+
|
2996
|
+
|
2997
|
+
<code class="ruby"> # Query node</code>
|
2998
|
+
</li>
|
2999
|
+
|
3000
|
+
<li class="covered" data-hits="1" data-linenumber="7">
|
3001
|
+
<span class="hits">1</span>
|
3002
|
+
|
3003
|
+
<code class="ruby"> class Query < Base</code>
|
3004
|
+
</li>
|
3005
|
+
|
3006
|
+
<li class="never" data-hits="" data-linenumber="8">
|
3007
|
+
|
3008
|
+
|
3009
|
+
<code class="ruby"> # Serializes to a GraphQL string</code>
|
3010
|
+
</li>
|
3011
|
+
|
3012
|
+
<li class="covered" data-hits="1" data-linenumber="9">
|
3013
|
+
<span class="hits">1</span>
|
3014
|
+
|
3015
|
+
<code class="ruby"> def to_gql</code>
|
3016
|
+
</li>
|
3017
|
+
|
3018
|
+
<li class="covered" data-hits="8" data-linenumber="10">
|
3019
|
+
<span class="hits">8</span>
|
3020
|
+
|
3021
|
+
<code class="ruby"> result = <<~GQL</code>
|
3022
|
+
</li>
|
3023
|
+
|
3024
|
+
<li class="never" data-hits="" data-linenumber="11">
|
3025
|
+
|
3026
|
+
|
3027
|
+
<code class="ruby"> query #{__name ? __name + ' ' : ''}{</code>
|
3028
|
+
</li>
|
3029
|
+
|
3030
|
+
<li class="never" data-hits="" data-linenumber="12">
|
3031
|
+
|
3032
|
+
|
3033
|
+
<code class="ruby"> #{__nodes.map(&:to_gql).join("\n")}</code>
|
3034
|
+
</li>
|
3035
|
+
|
3036
|
+
<li class="never" data-hits="" data-linenumber="13">
|
3037
|
+
|
3038
|
+
|
3039
|
+
<code class="ruby"> }</code>
|
3040
|
+
</li>
|
3041
|
+
|
3042
|
+
<li class="never" data-hits="" data-linenumber="14">
|
3043
|
+
|
3044
|
+
|
3045
|
+
<code class="ruby"> GQL</code>
|
3046
|
+
</li>
|
3047
|
+
|
3048
|
+
<li class="never" data-hits="" data-linenumber="15">
|
3049
|
+
|
3050
|
+
|
3051
|
+
<code class="ruby"></code>
|
3052
|
+
</li>
|
3053
|
+
|
3054
|
+
<li class="covered" data-hits="8" data-linenumber="16">
|
3055
|
+
<span class="hits">8</span>
|
3056
|
+
|
3057
|
+
<code class="ruby"> result.lstrip</code>
|
3058
|
+
</li>
|
3059
|
+
|
3060
|
+
<li class="never" data-hits="" data-linenumber="17">
|
3061
|
+
|
3062
|
+
|
3063
|
+
<code class="ruby"> end</code>
|
3064
|
+
</li>
|
3065
|
+
|
3066
|
+
<li class="never" data-hits="" data-linenumber="18">
|
3067
|
+
|
3068
|
+
|
3069
|
+
<code class="ruby"></code>
|
3070
|
+
</li>
|
3071
|
+
|
3072
|
+
<li class="never" data-hits="" data-linenumber="19">
|
3073
|
+
|
3074
|
+
|
3075
|
+
<code class="ruby"> # Delegates itself to the client to be executed</code>
|
3076
|
+
</li>
|
3077
|
+
|
3078
|
+
<li class="covered" data-hits="1" data-linenumber="20">
|
3079
|
+
<span class="hits">1</span>
|
3080
|
+
|
3081
|
+
<code class="ruby"> def __execute(client)</code>
|
3082
|
+
</li>
|
3083
|
+
|
3084
|
+
<li class="missed" data-hits="0" data-linenumber="21">
|
3085
|
+
|
3086
|
+
|
3087
|
+
<code class="ruby"> client.execute(self)</code>
|
3088
|
+
</li>
|
3089
|
+
|
3090
|
+
<li class="never" data-hits="" data-linenumber="22">
|
3091
|
+
|
3092
|
+
|
3093
|
+
<code class="ruby"> end</code>
|
3094
|
+
</li>
|
3095
|
+
|
3096
|
+
<li class="never" data-hits="" data-linenumber="23">
|
3097
|
+
|
3098
|
+
|
3099
|
+
<code class="ruby"></code>
|
3100
|
+
</li>
|
3101
|
+
|
3102
|
+
<li class="never" data-hits="" data-linenumber="24">
|
3103
|
+
|
3104
|
+
|
3105
|
+
<code class="ruby"> # Serializes to a GraphQL string</code>
|
3106
|
+
</li>
|
3107
|
+
|
3108
|
+
<li class="covered" data-hits="1" data-linenumber="25">
|
3109
|
+
<span class="hits">1</span>
|
3110
|
+
|
3111
|
+
<code class="ruby"> def to_s</code>
|
3112
|
+
</li>
|
3113
|
+
|
3114
|
+
<li class="missed" data-hits="0" data-linenumber="26">
|
3115
|
+
|
3116
|
+
|
3117
|
+
<code class="ruby"> to_gql</code>
|
3118
|
+
</li>
|
3119
|
+
|
3120
|
+
<li class="never" data-hits="" data-linenumber="27">
|
3121
|
+
|
3122
|
+
|
3123
|
+
<code class="ruby"> end</code>
|
3124
|
+
</li>
|
3125
|
+
|
3126
|
+
<li class="never" data-hits="" data-linenumber="28">
|
3127
|
+
|
3128
|
+
|
3129
|
+
<code class="ruby"> end</code>
|
3130
|
+
</li>
|
3131
|
+
|
3132
|
+
<li class="never" data-hits="" data-linenumber="29">
|
3133
|
+
|
3134
|
+
|
3135
|
+
<code class="ruby">end</code>
|
3136
|
+
</li>
|
3137
|
+
|
3138
|
+
</ol>
|
3139
|
+
</pre>
|
3140
|
+
</div>
|
3141
|
+
|
3142
|
+
|
3143
|
+
<div class="source_table" id="fc631e4d066aa11a78ad288ef5341c2bc5e2fd9d">
|
3144
|
+
<div class="header">
|
3145
|
+
<h3>lib/gqli/response.rb</h3>
|
3146
|
+
<h4><span class="green">100.0 %</span> covered</h4>
|
3147
|
+
<div>
|
3148
|
+
<b>7</b> relevant lines.
|
3149
|
+
<span class="green"><b>7</b> lines covered</span> and
|
3150
|
+
<span class="red"><b>0</b> lines missed.</span>
|
3151
|
+
</div>
|
3152
|
+
</div>
|
3153
|
+
|
3154
|
+
<pre>
|
3155
|
+
<ol>
|
3156
|
+
|
3157
|
+
<li class="never" data-hits="" data-linenumber="1">
|
3158
|
+
|
3159
|
+
|
3160
|
+
<code class="ruby"># frozen_string_literal: true</code>
|
3161
|
+
</li>
|
3162
|
+
|
3163
|
+
<li class="never" data-hits="" data-linenumber="2">
|
3164
|
+
|
3165
|
+
|
3166
|
+
<code class="ruby"></code>
|
3167
|
+
</li>
|
3168
|
+
|
3169
|
+
<li class="covered" data-hits="1" data-linenumber="3">
|
3170
|
+
<span class="hits">1</span>
|
3171
|
+
|
3172
|
+
<code class="ruby">require 'hashie/mash'</code>
|
3173
|
+
</li>
|
3174
|
+
|
3175
|
+
<li class="never" data-hits="" data-linenumber="4">
|
3176
|
+
|
3177
|
+
|
3178
|
+
<code class="ruby"></code>
|
3179
|
+
</li>
|
3180
|
+
|
3181
|
+
<li class="covered" data-hits="1" data-linenumber="5">
|
3182
|
+
<span class="hits">1</span>
|
3183
|
+
|
3184
|
+
<code class="ruby">module GQLi</code>
|
3185
|
+
</li>
|
3186
|
+
|
3187
|
+
<li class="never" data-hits="" data-linenumber="6">
|
3188
|
+
|
3189
|
+
|
3190
|
+
<code class="ruby"> # Response object wrapper</code>
|
3191
|
+
</li>
|
3192
|
+
|
3193
|
+
<li class="covered" data-hits="1" data-linenumber="7">
|
3194
|
+
<span class="hits">1</span>
|
3195
|
+
|
3196
|
+
<code class="ruby"> class Response</code>
|
3197
|
+
</li>
|
3198
|
+
|
3199
|
+
<li class="covered" data-hits="1" data-linenumber="8">
|
3200
|
+
<span class="hits">1</span>
|
3201
|
+
|
3202
|
+
<code class="ruby"> attr_reader :data, :query</code>
|
3203
|
+
</li>
|
3204
|
+
|
3205
|
+
<li class="never" data-hits="" data-linenumber="9">
|
3206
|
+
|
3207
|
+
|
3208
|
+
<code class="ruby"></code>
|
3209
|
+
</li>
|
3210
|
+
|
3211
|
+
<li class="covered" data-hits="1" data-linenumber="10">
|
3212
|
+
<span class="hits">1</span>
|
3213
|
+
|
3214
|
+
<code class="ruby"> def initialize(data, query)</code>
|
3215
|
+
</li>
|
3216
|
+
|
3217
|
+
<li class="covered" data-hits="8" data-linenumber="11">
|
3218
|
+
<span class="hits">8</span>
|
3219
|
+
|
3220
|
+
<code class="ruby"> @data = Hashie::Mash.new(data)</code>
|
3221
|
+
</li>
|
3222
|
+
|
3223
|
+
<li class="covered" data-hits="8" data-linenumber="12">
|
3224
|
+
<span class="hits">8</span>
|
3225
|
+
|
3226
|
+
<code class="ruby"> @query = query</code>
|
3227
|
+
</li>
|
3228
|
+
|
3229
|
+
<li class="never" data-hits="" data-linenumber="13">
|
3230
|
+
|
3231
|
+
|
3232
|
+
<code class="ruby"> end</code>
|
3233
|
+
</li>
|
3234
|
+
|
3235
|
+
<li class="never" data-hits="" data-linenumber="14">
|
3236
|
+
|
3237
|
+
|
3238
|
+
<code class="ruby"> end</code>
|
3239
|
+
</li>
|
3240
|
+
|
3241
|
+
<li class="never" data-hits="" data-linenumber="15">
|
3242
|
+
|
3243
|
+
|
3244
|
+
<code class="ruby">end</code>
|
3245
|
+
</li>
|
3246
|
+
|
3247
|
+
</ol>
|
3248
|
+
</pre>
|
3249
|
+
</div>
|
3250
|
+
|
3251
|
+
|
3252
|
+
</div>
|
3253
|
+
</div>
|
3254
|
+
</body>
|
3255
|
+
</html>
|