gqli 0.6.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/CHANGELOG.md +17 -0
- data/Gemfile.lock +103 -82
- data/README.md +0 -5
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +1774 -1205
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_asc_disabled.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_both.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc.png +0 -0
- data/coverage/assets/0.12.3/DataTables-1.10.20/images/sort_desc_disabled.png +0 -0
- data/coverage/assets/0.12.3/application.css +1 -0
- data/coverage/assets/0.12.3/application.js +7 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/border.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/controls.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/loading.gif +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/colorbox/loading_background.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/favicon_green.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/favicon_red.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/favicon_yellow.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/{0.10.2/smoothness → 0.12.3}/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/loading.gif +0 -0
- data/coverage/assets/{0.10.2 → 0.12.3}/magnify.png +0 -0
- data/coverage/index.html +19376 -7403
- data/doc/GQLi/Base.html +11 -11
- data/doc/GQLi/Client.html +175 -41
- data/doc/GQLi/Contentful.html +13 -11
- data/doc/GQLi/DSL.html +298 -30
- data/doc/GQLi/EnumValue.html +8 -8
- data/doc/GQLi/Fragment.html +8 -8
- data/doc/GQLi/Github.html +6 -6
- data/doc/GQLi/Introspection.html +46 -48
- data/doc/GQLi/Mutation.html +390 -0
- data/doc/GQLi/Node.html +8 -8
- data/doc/GQLi/Query.html +6 -6
- data/doc/GQLi/Response.html +87 -13
- data/doc/GQLi/Subscription.html +390 -0
- data/doc/GQLi/Validation.html +20 -20
- data/doc/GQLi.html +9 -9
- data/doc/_index.html +37 -7
- data/doc/class_list.html +3 -3
- data/doc/css/style.css +3 -2
- data/doc/file.CHANGELOG.html +43 -13
- data/doc/file.LICENSE.html +6 -6
- data/doc/file.README.html +31 -84
- data/doc/file_list.html +2 -2
- data/doc/frames.html +2 -2
- data/doc/index.html +31 -84
- data/doc/js/app.js +25 -3
- data/doc/method_list.html +147 -43
- data/doc/top-level-namespace.html +6 -6
- data/gqli.gemspec +5 -6
- data/lib/gqli/client.rb +25 -5
- data/lib/gqli/clients/contentful.rb +3 -2
- data/lib/gqli/dsl.rb +16 -1
- data/lib/gqli/introspection.rb +1 -3
- data/lib/gqli/mutation.rb +27 -0
- data/lib/gqli/response.rb +15 -2
- data/lib/gqli/subscription.rb +1 -1
- data/lib/gqli/validation.rb +15 -12
- data/lib/gqli/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/client.yml +98 -27
- data/spec/fixtures/vcr_cassettes/mutation_client.yml +4364 -0
- data/spec/lib/gqli/client_spec.rb +53 -0
- data/spec/lib/gqli/dsl_spec.rb +72 -2
- data/spec/lib/gqli/introspection_spec.rb +54 -0
- data/spec/lib/gqli/response_spec.rb +51 -0
- metadata +64 -73
- data/coverage/assets/0.10.2/application.css +0 -799
- data/coverage/assets/0.10.2/application.js +0 -1707
data/doc/file.README.html
CHANGED
@@ -6,15 +6,15 @@
|
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.27
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
16
|
|
17
|
-
<script type="text/javascript"
|
17
|
+
<script type="text/javascript">
|
18
18
|
pathId = "README";
|
19
19
|
relpath = '';
|
20
20
|
</script>
|
@@ -65,9 +65,7 @@
|
|
65
65
|
<blockquote>
|
66
66
|
<p><strong>DISCLAIMER:</strong></p>
|
67
67
|
|
68
|
-
<p>This gem is in stable state and will be updated with more features. You can
|
69
|
-
start using it for your respective projects, although there is no support
|
70
|
-
available from Contentful.</p>
|
68
|
+
<p>This gem is in stable state and will be updated with more features. You can start using it for your respective projects, although there is no support available from Contentful.</p>
|
71
69
|
|
72
70
|
<p>This gem is not covered under the Contentful SLAs.</p>
|
73
71
|
|
@@ -90,9 +88,7 @@ available from Contentful.</p>
|
|
90
88
|
|
91
89
|
<h3 id="label-Creating+a+GraphQL+Client">Creating a GraphQL Client</h3>
|
92
90
|
|
93
|
-
<p>For the examples throughout this README, we'll be using the Contentful
|
94
|
-
and Github GraphQL APIs, for which we have factory methods. Therefore,
|
95
|
-
here's the initialization code required for both of them:</p>
|
91
|
+
<p>For the examples throughout this README, we'll be using the Contentful and Github GraphQL APIs, for which we have factory methods. Therefore, here's the initialization code required for both of them:</p>
|
96
92
|
|
97
93
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>gqli</span><span class='tstring_end'>'</span></span>
|
98
94
|
|
@@ -106,8 +102,7 @@ here's the initialization code required for both of them:</p>
|
|
106
102
|
<span class='const'>GITHUB_GQL</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/Github.html" title="GQLi::Github (module)">Github</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create'><span class='object_link'><a href="GQLi/Github.html#create-class_method" title="GQLi::Github.create (method)">create</a></span></span><span class='lparen'>(</span><span class='const'>GITHUB_ACCESS_TOKEN</span><span class='rparen'>)</span>
|
107
103
|
</code></pre>
|
108
104
|
|
109
|
-
<p><em>Note</em>: Please feel free to contribute factories for your favorite
|
110
|
-
GraphQL services.</p>
|
105
|
+
<p><em>Note</em>: Please feel free to contribute factories for your favorite GraphQL services.</p>
|
111
106
|
|
112
107
|
<p>For creating a custom GraphQL client:</p>
|
113
108
|
|
@@ -124,8 +119,7 @@ GraphQL services.</p>
|
|
124
119
|
|
125
120
|
<h3 id="label-Creating+a+Query">Creating a Query</h3>
|
126
121
|
|
127
|
-
<p>Queries are the way to request data from a GraphQL API. This gem provides a
|
128
|
-
simple DSL to create your own queries.</p>
|
122
|
+
<p>Queries are the way to request data from a GraphQL API. This gem provides a simple DSL to create your own queries.</p>
|
129
123
|
|
130
124
|
<p>The query operator is <code>GQLi::DSL.query</code>.</p>
|
131
125
|
|
@@ -153,13 +147,11 @@ simple DSL to create your own queries.</p>
|
|
153
147
|
|
154
148
|
<h3 id="label-Divide+and+conquer+-+using+Fragments">Divide and conquer - using Fragments</h3>
|
155
149
|
|
156
|
-
<p>In order to reuse parts of queries, we can split chunks of our queries into
|
157
|
-
Fragments.</p>
|
150
|
+
<p>In order to reuse parts of queries, we can split chunks of our queries into Fragments.</p>
|
158
151
|
|
159
152
|
<p>The fragment operator is <code>GQLi::DSL.fragment</code>.</p>
|
160
153
|
|
161
|
-
<p>To include fragments within other nodes, use the <code><em>_</em></code>
|
162
|
-
operator as shown below.</p>
|
154
|
+
<p>To include fragments within other nodes, use the <code><em>_</em></code> operator as shown below.</p>
|
163
155
|
|
164
156
|
<p>To do type matching, use the <code>__on</code> operator as shown below.</p>
|
165
157
|
|
@@ -203,10 +195,7 @@ operator as shown below.</p>
|
|
203
195
|
|
204
196
|
<h3 id="label-Executing+the+queries">Executing the queries</h3>
|
205
197
|
|
206
|
-
<p>To execute the queries, you need to pass a <code>Query</code> object to the
|
207
|
-
client's <code>#execute</code> method. This will return a
|
208
|
-
<code>Response</code> object which contains the <code>data</code> and the
|
209
|
-
<code>query</code> executed.</p>
|
198
|
+
<p>To execute the queries, you need to pass a <code>Query</code> object to the client's <code>#execute</code> method. This will return a <code>Response</code> object which contains the <code>data</code> and the <code>query</code> executed.</p>
|
210
199
|
|
211
200
|
<p>For example:</p>
|
212
201
|
|
@@ -265,33 +254,21 @@ Best Friend:
|
|
265
254
|
|
266
255
|
<h3 id="label-Schema+Introspection+and+Validation">Schema Introspection and Validation</h3>
|
267
256
|
|
268
|
-
<p>By default this library will fetch and cache a copy of the GraphQL Schema
|
269
|
-
for any API you create a client for.</p>
|
257
|
+
<p>By default this library will fetch and cache a copy of the GraphQL Schema for any API you create a client for.</p>
|
270
258
|
|
271
|
-
<p>This schema is used for query validation before running queries against the
|
272
|
-
APIs. In case a query is invalid for the given schema, an exception will be
|
273
|
-
raised.</p>
|
259
|
+
<p>This schema is used for query validation before running queries against the APIs. In case a query is invalid for the given schema, an exception will be raised.</p>
|
274
260
|
|
275
|
-
<p>To disable schema caching completely, when you initialize your client, send
|
276
|
-
<code>validate_query: false</code>.</p>
|
261
|
+
<p>To disable schema caching completely, when you initialize your client, send <code>validate_query: false</code>.</p>
|
277
262
|
|
278
|
-
<p>Queries executed using the <code>#execute</code> method on the client will
|
279
|
-
be validated before executing the request if the option is set to
|
280
|
-
<code>true</code> (which it is by default).</p>
|
263
|
+
<p>Queries executed using the <code>#execute</code> method on the client will be validated before executing the request if the option is set to <code>true</code> (which it is by default).</p>
|
281
264
|
|
282
265
|
<p>To avoid validating a query, you can use <code>#execute!</code> instead.</p>
|
283
266
|
|
284
|
-
<p>To validate the query outside of the scope of an HTTP request, you can use
|
285
|
-
<code>MY_CLIENT.schema.valid?(query)</code>.</p>
|
267
|
+
<p>To validate the query outside of the scope of an HTTP request, you can use <code>MY_CLIENT.schema.valid?(query)</code>.</p>
|
286
268
|
|
287
269
|
<h3 id="label-Embedding+the+DSL+in+your+classes">Embedding the DSL in your classes</h3>
|
288
270
|
|
289
|
-
<p>If you want to avoid the need for prepending all GQLi DSL's calls with
|
290
|
-
<code>GQLi::DSL.</code>, then you can <code>extend</code> and/or
|
291
|
-
<code>include</code> the module within your own classes. When using
|
292
|
-
<code>extend</code>, you will have access to the DSL at a class level. When
|
293
|
-
using <code>include</code> you will have access to the DSL at an object
|
294
|
-
level.</p>
|
271
|
+
<p>If you want to avoid the need for prepending all GQLi DSL's calls with <code>GQLi::DSL.</code>, then you can <code>extend</code> and/or <code>include</code> the module within your own classes. When using <code>extend</code>, you will have access to the DSL at a class level. When using <code>include</code> you will have access to the DSL at an object level.</p>
|
295
272
|
|
296
273
|
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>ContentfulClient</span>
|
297
274
|
<span class='id identifier rubyid_extend'>extend</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span> <span class='comment'># Makes DSL available at a class level
|
@@ -344,12 +321,9 @@ level.</p>
|
|
344
321
|
|
345
322
|
<h3 id="label-Dealing+with+name+collisions">Dealing with name collisions</h3>
|
346
323
|
|
347
|
-
<p>By defining queries via a DSL, you may sometimes find that the fields you
|
348
|
-
query for are also the names of built-in methods or reserved keywords of
|
349
|
-
the language.</p>
|
324
|
+
<p>By defining queries via a DSL, you may sometimes find that the fields you query for are also the names of built-in methods or reserved keywords of the language.</p>
|
350
325
|
|
351
|
-
<p>To avoid collisions you can use the <code>__node</code> helper, for
|
352
|
-
example:</p>
|
326
|
+
<p>To avoid collisions you can use the <code>__node</code> helper, for example:</p>
|
353
327
|
|
354
328
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
355
329
|
<span class='id identifier rubyid_catCollection'>catCollection</span> <span class='lbrace'>{</span>
|
@@ -362,8 +336,7 @@ example:</p>
|
|
362
336
|
<span class='rbrace'>}</span>
|
363
337
|
</code></pre>
|
364
338
|
|
365
|
-
<p>The helper method <code>__node</code>, can also receive arguments and have
|
366
|
-
children nodes as expected from any other node declaration, for example:</p>
|
339
|
+
<p>The helper method <code>__node</code>, can also receive arguments and have children nodes as expected from any other node declaration, for example:</p>
|
367
340
|
|
368
341
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
369
342
|
<span class='id identifier rubyid___node'>__node</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>catCollection</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>limit:</span> <span class='int'>5</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
@@ -376,9 +349,7 @@ children nodes as expected from any other node declaration, for example:</p>
|
|
376
349
|
|
377
350
|
<h3 id="label-Directives">Directives</h3>
|
378
351
|
|
379
|
-
<p>In GraphQL, nodes can be selectively included or removed by the usage of
|
380
|
-
directives, there are 2 directives available for the querying specification
|
381
|
-
to do this: <code>@include</code> and <code>@skip</code>.</p>
|
352
|
+
<p>In GraphQL, nodes can be selectively included or removed by the usage of directives, there are 2 directives available for the querying specification to do this: <code>@include</code> and <code>@skip</code>.</p>
|
382
353
|
|
383
354
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
384
355
|
<span class='id identifier rubyid_someNode'>someNode</span><span class='lparen'>(</span><span class='symbol'>:@include</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='label'>if:</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_includes_some_node?'>includes_some_node?</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
@@ -392,25 +363,18 @@ to do this: <code>@include</code> and <code>@skip</code>.</p>
|
|
392
363
|
}
|
393
364
|
</code></pre>
|
394
365
|
|
395
|
-
<p>This behaviour is equivalent to using native Ruby to include/exclude a
|
396
|
-
field from the query:</p>
|
366
|
+
<p>This behaviour is equivalent to using native Ruby to include/exclude a field from the query:</p>
|
397
367
|
|
398
368
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
399
369
|
<span class='id identifier rubyid_someNode'>someNode</span> <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_includes_some_node?'>includes_some_node?</span>
|
400
370
|
<span class='rbrace'>}</span>
|
401
371
|
</code></pre>
|
402
372
|
|
403
|
-
<p>The difference is that by using the native implementation, in case of the
|
404
|
-
condition not being met, the node will be completely not included in the
|
405
|
-
outgoing query.</p>
|
373
|
+
<p>The difference is that by using the native implementation, in case of the condition not being met, the node will be completely not included in the outgoing query.</p>
|
406
374
|
|
407
375
|
<h3 id="label-Enums">Enums</h3>
|
408
376
|
|
409
|
-
<p><a href="https://graphql.org/learn/schema/#enumeration-types">Enums</a> are
|
410
|
-
a list of predefined values that are defined on the type system level.
|
411
|
-
Since Ruby doesn't have built-in Enums that can be translated directly
|
412
|
-
into GraphQL Enums, we created the <code>__enum</code> helper that you can
|
413
|
-
use within your queries to transform your values into an Enum value.</p>
|
377
|
+
<p><a href="https://graphql.org/learn/schema/#enumeration-types">Enums</a> are a list of predefined values that are defined on the type system level. Since Ruby doesn't have built-in Enums that can be translated directly into GraphQL Enums, we created the <code>__enum</code> helper that you can use within your queries to transform your values into an Enum value.</p>
|
414
378
|
|
415
379
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
416
380
|
<span class='id identifier rubyid_catCollection'>catCollection</span><span class='lparen'>(</span><span class='label'>order:</span> <span class='id identifier rubyid___enum'>__enum</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>lives_ASC</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
@@ -434,9 +398,7 @@ use within your queries to transform your values into an Enum value.</p>
|
|
434
398
|
|
435
399
|
<h3 id="label-Aliases">Aliases</h3>
|
436
400
|
|
437
|
-
<p>There may be times where it is useful to have parts of the query aliased,
|
438
|
-
for example, when querying for <code>pinned</code> and
|
439
|
-
<code>unpinned</code> articles for a news site.</p>
|
401
|
+
<p>There may be times where it is useful to have parts of the query aliased, for example, when querying for <code>pinned</code> and <code>unpinned</code> articles for a news site.</p>
|
440
402
|
|
441
403
|
<p>This can be accomplished as follows:</p>
|
442
404
|
|
@@ -464,42 +426,27 @@ for example, when querying for <code>pinned</code> and
|
|
464
426
|
<span class='rbrace'>}</span>
|
465
427
|
</code></pre>
|
466
428
|
|
467
|
-
<h2 id="label-Yet+to+be+implemented">Yet to be implemented</h2>
|
468
|
-
<ul><li>
|
469
|
-
<p>Mutation queries</p>
|
470
|
-
</li><li>
|
471
|
-
<p>Subscription queries</p>
|
472
|
-
</li></ul>
|
473
|
-
|
474
429
|
<h2 id="label-Get+involved">Get involved</h2>
|
475
430
|
|
476
|
-
<p><a href="http://makeapullrequest.com"><img
|
477
|
-
src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600"></a></p>
|
431
|
+
<p><a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600"></a></p>
|
478
432
|
|
479
433
|
<p>We appreciate any help on our repositories.</p>
|
480
434
|
|
481
435
|
<h2 id="label-License">License</h2>
|
482
436
|
|
483
|
-
<p>This repository is published under the <a href="LICENSE.txt">MIT</a>
|
484
|
-
license.</p>
|
437
|
+
<p>This repository is published under the <a href="LICENSE.txt">MIT</a> license.</p>
|
485
438
|
|
486
439
|
<h2 id="label-Code+of+Conduct">Code of Conduct</h2>
|
487
440
|
|
488
|
-
<p>We want to provide a safe, inclusive, welcoming, and harassment-free space
|
489
|
-
and experience for all participants, regardless of gender identity and
|
490
|
-
expression, sexual orientation, disability, physical appearance,
|
491
|
-
socioeconomic status, body size, ethnicity, nationality, level of
|
492
|
-
experience, age, religion (or lack thereof), or other identity markers.</p>
|
441
|
+
<p>We want to provide a safe, inclusive, welcoming, and harassment-free space and experience for all participants, regardless of gender identity and expression, sexual orientation, disability, physical appearance, socioeconomic status, body size, ethnicity, nationality, level of experience, age, religion (or lack thereof), or other identity markers.</p>
|
493
442
|
|
494
|
-
<p><a
|
495
|
-
href="https://github.com/contentful-developer-relations/community-code-of-conduct">Read
|
496
|
-
our full Code of Conduct</a>.</p>
|
443
|
+
<p><a href="https://github.com/contentful-developer-relations/community-code-of-conduct">Read our full Code of Conduct</a>.</p>
|
497
444
|
</div></div>
|
498
445
|
|
499
446
|
<div id="footer">
|
500
|
-
Generated on
|
447
|
+
Generated on Mon Jan 3 17:37:12 2022 by
|
501
448
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
502
|
-
0.9.
|
449
|
+
0.9.27 (ruby-3.0.3).
|
503
450
|
</div>
|
504
451
|
|
505
452
|
</div>
|
data/doc/file_list.html
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
5
|
<meta charset="utf-8" />
|
6
6
|
|
7
|
-
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen"
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
|
8
8
|
|
9
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen"
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
|
10
10
|
|
11
11
|
|
12
12
|
|
data/doc/frames.html
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
<html>
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
|
-
<title>Documentation by YARD 0.9.
|
5
|
+
<title>Documentation by YARD 0.9.27</title>
|
6
6
|
</head>
|
7
|
-
<script type="text/javascript"
|
7
|
+
<script type="text/javascript">
|
8
8
|
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
9
9
|
var name = match ? match[1] : 'index.html';
|
10
10
|
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
data/doc/index.html
CHANGED
@@ -6,15 +6,15 @@
|
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.9.
|
9
|
+
— Documentation by YARD 0.9.27
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
16
|
|
17
|
-
<script type="text/javascript"
|
17
|
+
<script type="text/javascript">
|
18
18
|
pathId = "README";
|
19
19
|
relpath = '';
|
20
20
|
</script>
|
@@ -65,9 +65,7 @@
|
|
65
65
|
<blockquote>
|
66
66
|
<p><strong>DISCLAIMER:</strong></p>
|
67
67
|
|
68
|
-
<p>This gem is in stable state and will be updated with more features. You can
|
69
|
-
start using it for your respective projects, although there is no support
|
70
|
-
available from Contentful.</p>
|
68
|
+
<p>This gem is in stable state and will be updated with more features. You can start using it for your respective projects, although there is no support available from Contentful.</p>
|
71
69
|
|
72
70
|
<p>This gem is not covered under the Contentful SLAs.</p>
|
73
71
|
|
@@ -90,9 +88,7 @@ available from Contentful.</p>
|
|
90
88
|
|
91
89
|
<h3 id="label-Creating+a+GraphQL+Client">Creating a GraphQL Client</h3>
|
92
90
|
|
93
|
-
<p>For the examples throughout this README, we'll be using the Contentful
|
94
|
-
and Github GraphQL APIs, for which we have factory methods. Therefore,
|
95
|
-
here's the initialization code required for both of them:</p>
|
91
|
+
<p>For the examples throughout this README, we'll be using the Contentful and Github GraphQL APIs, for which we have factory methods. Therefore, here's the initialization code required for both of them:</p>
|
96
92
|
|
97
93
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>gqli</span><span class='tstring_end'>'</span></span>
|
98
94
|
|
@@ -106,8 +102,7 @@ here's the initialization code required for both of them:</p>
|
|
106
102
|
<span class='const'>GITHUB_GQL</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/Github.html" title="GQLi::Github (module)">Github</a></span></span><span class='period'>.</span><span class='id identifier rubyid_create'><span class='object_link'><a href="GQLi/Github.html#create-class_method" title="GQLi::Github.create (method)">create</a></span></span><span class='lparen'>(</span><span class='const'>GITHUB_ACCESS_TOKEN</span><span class='rparen'>)</span>
|
107
103
|
</code></pre>
|
108
104
|
|
109
|
-
<p><em>Note</em>: Please feel free to contribute factories for your favorite
|
110
|
-
GraphQL services.</p>
|
105
|
+
<p><em>Note</em>: Please feel free to contribute factories for your favorite GraphQL services.</p>
|
111
106
|
|
112
107
|
<p>For creating a custom GraphQL client:</p>
|
113
108
|
|
@@ -124,8 +119,7 @@ GraphQL services.</p>
|
|
124
119
|
|
125
120
|
<h3 id="label-Creating+a+Query">Creating a Query</h3>
|
126
121
|
|
127
|
-
<p>Queries are the way to request data from a GraphQL API. This gem provides a
|
128
|
-
simple DSL to create your own queries.</p>
|
122
|
+
<p>Queries are the way to request data from a GraphQL API. This gem provides a simple DSL to create your own queries.</p>
|
129
123
|
|
130
124
|
<p>The query operator is <code>GQLi::DSL.query</code>.</p>
|
131
125
|
|
@@ -153,13 +147,11 @@ simple DSL to create your own queries.</p>
|
|
153
147
|
|
154
148
|
<h3 id="label-Divide+and+conquer+-+using+Fragments">Divide and conquer - using Fragments</h3>
|
155
149
|
|
156
|
-
<p>In order to reuse parts of queries, we can split chunks of our queries into
|
157
|
-
Fragments.</p>
|
150
|
+
<p>In order to reuse parts of queries, we can split chunks of our queries into Fragments.</p>
|
158
151
|
|
159
152
|
<p>The fragment operator is <code>GQLi::DSL.fragment</code>.</p>
|
160
153
|
|
161
|
-
<p>To include fragments within other nodes, use the <code><em>_</em></code>
|
162
|
-
operator as shown below.</p>
|
154
|
+
<p>To include fragments within other nodes, use the <code><em>_</em></code> operator as shown below.</p>
|
163
155
|
|
164
156
|
<p>To do type matching, use the <code>__on</code> operator as shown below.</p>
|
165
157
|
|
@@ -203,10 +195,7 @@ operator as shown below.</p>
|
|
203
195
|
|
204
196
|
<h3 id="label-Executing+the+queries">Executing the queries</h3>
|
205
197
|
|
206
|
-
<p>To execute the queries, you need to pass a <code>Query</code> object to the
|
207
|
-
client's <code>#execute</code> method. This will return a
|
208
|
-
<code>Response</code> object which contains the <code>data</code> and the
|
209
|
-
<code>query</code> executed.</p>
|
198
|
+
<p>To execute the queries, you need to pass a <code>Query</code> object to the client's <code>#execute</code> method. This will return a <code>Response</code> object which contains the <code>data</code> and the <code>query</code> executed.</p>
|
210
199
|
|
211
200
|
<p>For example:</p>
|
212
201
|
|
@@ -265,33 +254,21 @@ Best Friend:
|
|
265
254
|
|
266
255
|
<h3 id="label-Schema+Introspection+and+Validation">Schema Introspection and Validation</h3>
|
267
256
|
|
268
|
-
<p>By default this library will fetch and cache a copy of the GraphQL Schema
|
269
|
-
for any API you create a client for.</p>
|
257
|
+
<p>By default this library will fetch and cache a copy of the GraphQL Schema for any API you create a client for.</p>
|
270
258
|
|
271
|
-
<p>This schema is used for query validation before running queries against the
|
272
|
-
APIs. In case a query is invalid for the given schema, an exception will be
|
273
|
-
raised.</p>
|
259
|
+
<p>This schema is used for query validation before running queries against the APIs. In case a query is invalid for the given schema, an exception will be raised.</p>
|
274
260
|
|
275
|
-
<p>To disable schema caching completely, when you initialize your client, send
|
276
|
-
<code>validate_query: false</code>.</p>
|
261
|
+
<p>To disable schema caching completely, when you initialize your client, send <code>validate_query: false</code>.</p>
|
277
262
|
|
278
|
-
<p>Queries executed using the <code>#execute</code> method on the client will
|
279
|
-
be validated before executing the request if the option is set to
|
280
|
-
<code>true</code> (which it is by default).</p>
|
263
|
+
<p>Queries executed using the <code>#execute</code> method on the client will be validated before executing the request if the option is set to <code>true</code> (which it is by default).</p>
|
281
264
|
|
282
265
|
<p>To avoid validating a query, you can use <code>#execute!</code> instead.</p>
|
283
266
|
|
284
|
-
<p>To validate the query outside of the scope of an HTTP request, you can use
|
285
|
-
<code>MY_CLIENT.schema.valid?(query)</code>.</p>
|
267
|
+
<p>To validate the query outside of the scope of an HTTP request, you can use <code>MY_CLIENT.schema.valid?(query)</code>.</p>
|
286
268
|
|
287
269
|
<h3 id="label-Embedding+the+DSL+in+your+classes">Embedding the DSL in your classes</h3>
|
288
270
|
|
289
|
-
<p>If you want to avoid the need for prepending all GQLi DSL's calls with
|
290
|
-
<code>GQLi::DSL.</code>, then you can <code>extend</code> and/or
|
291
|
-
<code>include</code> the module within your own classes. When using
|
292
|
-
<code>extend</code>, you will have access to the DSL at a class level. When
|
293
|
-
using <code>include</code> you will have access to the DSL at an object
|
294
|
-
level.</p>
|
271
|
+
<p>If you want to avoid the need for prepending all GQLi DSL's calls with <code>GQLi::DSL.</code>, then you can <code>extend</code> and/or <code>include</code> the module within your own classes. When using <code>extend</code>, you will have access to the DSL at a class level. When using <code>include</code> you will have access to the DSL at an object level.</p>
|
295
272
|
|
296
273
|
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>ContentfulClient</span>
|
297
274
|
<span class='id identifier rubyid_extend'>extend</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span> <span class='comment'># Makes DSL available at a class level
|
@@ -344,12 +321,9 @@ level.</p>
|
|
344
321
|
|
345
322
|
<h3 id="label-Dealing+with+name+collisions">Dealing with name collisions</h3>
|
346
323
|
|
347
|
-
<p>By defining queries via a DSL, you may sometimes find that the fields you
|
348
|
-
query for are also the names of built-in methods or reserved keywords of
|
349
|
-
the language.</p>
|
324
|
+
<p>By defining queries via a DSL, you may sometimes find that the fields you query for are also the names of built-in methods or reserved keywords of the language.</p>
|
350
325
|
|
351
|
-
<p>To avoid collisions you can use the <code>__node</code> helper, for
|
352
|
-
example:</p>
|
326
|
+
<p>To avoid collisions you can use the <code>__node</code> helper, for example:</p>
|
353
327
|
|
354
328
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
355
329
|
<span class='id identifier rubyid_catCollection'>catCollection</span> <span class='lbrace'>{</span>
|
@@ -362,8 +336,7 @@ example:</p>
|
|
362
336
|
<span class='rbrace'>}</span>
|
363
337
|
</code></pre>
|
364
338
|
|
365
|
-
<p>The helper method <code>__node</code>, can also receive arguments and have
|
366
|
-
children nodes as expected from any other node declaration, for example:</p>
|
339
|
+
<p>The helper method <code>__node</code>, can also receive arguments and have children nodes as expected from any other node declaration, for example:</p>
|
367
340
|
|
368
341
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
369
342
|
<span class='id identifier rubyid___node'>__node</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>catCollection</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>limit:</span> <span class='int'>5</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
@@ -376,9 +349,7 @@ children nodes as expected from any other node declaration, for example:</p>
|
|
376
349
|
|
377
350
|
<h3 id="label-Directives">Directives</h3>
|
378
351
|
|
379
|
-
<p>In GraphQL, nodes can be selectively included or removed by the usage of
|
380
|
-
directives, there are 2 directives available for the querying specification
|
381
|
-
to do this: <code>@include</code> and <code>@skip</code>.</p>
|
352
|
+
<p>In GraphQL, nodes can be selectively included or removed by the usage of directives, there are 2 directives available for the querying specification to do this: <code>@include</code> and <code>@skip</code>.</p>
|
382
353
|
|
383
354
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
384
355
|
<span class='id identifier rubyid_someNode'>someNode</span><span class='lparen'>(</span><span class='symbol'>:@include</span> <span class='op'>=></span> <span class='lbrace'>{</span><span class='label'>if:</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_includes_some_node?'>includes_some_node?</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
@@ -392,25 +363,18 @@ to do this: <code>@include</code> and <code>@skip</code>.</p>
|
|
392
363
|
}
|
393
364
|
</code></pre>
|
394
365
|
|
395
|
-
<p>This behaviour is equivalent to using native Ruby to include/exclude a
|
396
|
-
field from the query:</p>
|
366
|
+
<p>This behaviour is equivalent to using native Ruby to include/exclude a field from the query:</p>
|
397
367
|
|
398
368
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
399
369
|
<span class='id identifier rubyid_someNode'>someNode</span> <span class='kw'>if</span> <span class='id identifier rubyid_object'>object</span><span class='period'>.</span><span class='id identifier rubyid_includes_some_node?'>includes_some_node?</span>
|
400
370
|
<span class='rbrace'>}</span>
|
401
371
|
</code></pre>
|
402
372
|
|
403
|
-
<p>The difference is that by using the native implementation, in case of the
|
404
|
-
condition not being met, the node will be completely not included in the
|
405
|
-
outgoing query.</p>
|
373
|
+
<p>The difference is that by using the native implementation, in case of the condition not being met, the node will be completely not included in the outgoing query.</p>
|
406
374
|
|
407
375
|
<h3 id="label-Enums">Enums</h3>
|
408
376
|
|
409
|
-
<p><a href="https://graphql.org/learn/schema/#enumeration-types">Enums</a> are
|
410
|
-
a list of predefined values that are defined on the type system level.
|
411
|
-
Since Ruby doesn't have built-in Enums that can be translated directly
|
412
|
-
into GraphQL Enums, we created the <code>__enum</code> helper that you can
|
413
|
-
use within your queries to transform your values into an Enum value.</p>
|
377
|
+
<p><a href="https://graphql.org/learn/schema/#enumeration-types">Enums</a> are a list of predefined values that are defined on the type system level. Since Ruby doesn't have built-in Enums that can be translated directly into GraphQL Enums, we created the <code>__enum</code> helper that you can use within your queries to transform your values into an Enum value.</p>
|
414
378
|
|
415
379
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="GQLi.html" title="GQLi (module)">GQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="GQLi/DSL.html" title="GQLi::DSL (module)">DSL</a></span></span><span class='period'>.</span><span class='id identifier rubyid_query'><span class='object_link'><a href="GQLi/DSL.html#query-class_method" title="GQLi::DSL.query (method)">query</a></span></span> <span class='lbrace'>{</span>
|
416
380
|
<span class='id identifier rubyid_catCollection'>catCollection</span><span class='lparen'>(</span><span class='label'>order:</span> <span class='id identifier rubyid___enum'>__enum</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>lives_ASC</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='lbrace'>{</span>
|
@@ -434,9 +398,7 @@ use within your queries to transform your values into an Enum value.</p>
|
|
434
398
|
|
435
399
|
<h3 id="label-Aliases">Aliases</h3>
|
436
400
|
|
437
|
-
<p>There may be times where it is useful to have parts of the query aliased,
|
438
|
-
for example, when querying for <code>pinned</code> and
|
439
|
-
<code>unpinned</code> articles for a news site.</p>
|
401
|
+
<p>There may be times where it is useful to have parts of the query aliased, for example, when querying for <code>pinned</code> and <code>unpinned</code> articles for a news site.</p>
|
440
402
|
|
441
403
|
<p>This can be accomplished as follows:</p>
|
442
404
|
|
@@ -464,42 +426,27 @@ for example, when querying for <code>pinned</code> and
|
|
464
426
|
<span class='rbrace'>}</span>
|
465
427
|
</code></pre>
|
466
428
|
|
467
|
-
<h2 id="label-Yet+to+be+implemented">Yet to be implemented</h2>
|
468
|
-
<ul><li>
|
469
|
-
<p>Mutation queries</p>
|
470
|
-
</li><li>
|
471
|
-
<p>Subscription queries</p>
|
472
|
-
</li></ul>
|
473
|
-
|
474
429
|
<h2 id="label-Get+involved">Get involved</h2>
|
475
430
|
|
476
|
-
<p><a href="http://makeapullrequest.com"><img
|
477
|
-
src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600"></a></p>
|
431
|
+
<p><a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600"></a></p>
|
478
432
|
|
479
433
|
<p>We appreciate any help on our repositories.</p>
|
480
434
|
|
481
435
|
<h2 id="label-License">License</h2>
|
482
436
|
|
483
|
-
<p>This repository is published under the <a href="LICENSE.txt">MIT</a>
|
484
|
-
license.</p>
|
437
|
+
<p>This repository is published under the <a href="LICENSE.txt">MIT</a> license.</p>
|
485
438
|
|
486
439
|
<h2 id="label-Code+of+Conduct">Code of Conduct</h2>
|
487
440
|
|
488
|
-
<p>We want to provide a safe, inclusive, welcoming, and harassment-free space
|
489
|
-
and experience for all participants, regardless of gender identity and
|
490
|
-
expression, sexual orientation, disability, physical appearance,
|
491
|
-
socioeconomic status, body size, ethnicity, nationality, level of
|
492
|
-
experience, age, religion (or lack thereof), or other identity markers.</p>
|
441
|
+
<p>We want to provide a safe, inclusive, welcoming, and harassment-free space and experience for all participants, regardless of gender identity and expression, sexual orientation, disability, physical appearance, socioeconomic status, body size, ethnicity, nationality, level of experience, age, religion (or lack thereof), or other identity markers.</p>
|
493
442
|
|
494
|
-
<p><a
|
495
|
-
href="https://github.com/contentful-developer-relations/community-code-of-conduct">Read
|
496
|
-
our full Code of Conduct</a>.</p>
|
443
|
+
<p><a href="https://github.com/contentful-developer-relations/community-code-of-conduct">Read our full Code of Conduct</a>.</p>
|
497
444
|
</div></div>
|
498
445
|
|
499
446
|
<div id="footer">
|
500
|
-
Generated on
|
447
|
+
Generated on Mon Jan 3 17:37:12 2022 by
|
501
448
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
502
|
-
0.9.
|
449
|
+
0.9.27 (ruby-3.0.3).
|
503
450
|
</div>
|
504
451
|
|
505
452
|
</div>
|
data/doc/js/app.js
CHANGED
@@ -171,6 +171,7 @@ function generateTOC() {
|
|
171
171
|
var counter = 0;
|
172
172
|
var tags = ['h2', 'h3', 'h4', 'h5', 'h6'];
|
173
173
|
var i;
|
174
|
+
var curli;
|
174
175
|
if ($('#filecontents h1').length > 1) tags.unshift('h1');
|
175
176
|
for (i = 0; i < tags.length; i++) { tags[i] = '#filecontents ' + tags[i]; }
|
176
177
|
var lastTag = parseInt(tags[0][1], 10);
|
@@ -190,15 +191,25 @@ function generateTOC() {
|
|
190
191
|
}
|
191
192
|
if (thisTag > lastTag) {
|
192
193
|
for (i = 0; i < thisTag - lastTag; i++) {
|
193
|
-
|
194
|
+
if ( typeof(curli) == "undefined" ) {
|
195
|
+
curli = $('<li/>');
|
196
|
+
toc.append(curli);
|
197
|
+
}
|
198
|
+
toc = $('<ol/>');
|
199
|
+
curli.append(toc);
|
200
|
+
curli = undefined;
|
194
201
|
}
|
195
202
|
}
|
196
203
|
if (thisTag < lastTag) {
|
197
|
-
for (i = 0; i < lastTag - thisTag; i++)
|
204
|
+
for (i = 0; i < lastTag - thisTag; i++) {
|
205
|
+
toc = toc.parent();
|
206
|
+
toc = toc.parent();
|
207
|
+
}
|
198
208
|
}
|
199
209
|
var title = $(this).attr('toc-title');
|
200
210
|
if (typeof(title) == "undefined") title = $(this).text();
|
201
|
-
|
211
|
+
curli =$('<li><a href="#' + this.id + '">' + title + '</a></li>');
|
212
|
+
toc.append(curli);
|
202
213
|
lastTag = thisTag;
|
203
214
|
});
|
204
215
|
if (!show) return;
|
@@ -275,6 +286,16 @@ function mainFocus() {
|
|
275
286
|
setTimeout(function() { $('#main').focus(); }, 10);
|
276
287
|
}
|
277
288
|
|
289
|
+
function navigationChange() {
|
290
|
+
// This works around the broken anchor navigation with the YARD template.
|
291
|
+
window.onpopstate = function() {
|
292
|
+
var hash = window.location.hash;
|
293
|
+
if (hash !== '' && $(hash)[0]) {
|
294
|
+
$(hash)[0].scrollIntoView();
|
295
|
+
}
|
296
|
+
};
|
297
|
+
}
|
298
|
+
|
278
299
|
$(document).ready(function() {
|
279
300
|
navResizer();
|
280
301
|
navExpander();
|
@@ -287,6 +308,7 @@ $(document).ready(function() {
|
|
287
308
|
constantSummaryToggle();
|
288
309
|
generateTOC();
|
289
310
|
mainFocus();
|
311
|
+
navigationChange();
|
290
312
|
});
|
291
313
|
|
292
314
|
})();
|