prismic.io 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -1
- data/Gemfile.lock +1 -1
- data/README.md +6 -14
- data/docs/Prismic.html +1074 -0
- data/docs/Prismic/API.html +2987 -0
- data/docs/Prismic/API/BadPrismicResponseError.html +147 -0
- data/docs/Prismic/API/OAuth.html +560 -0
- data/docs/Prismic/API/PrismicWSAuthError.html +375 -0
- data/docs/Prismic/API/PrismicWSConnectionError.html +221 -0
- data/docs/Prismic/BasicNullCache.html +255 -0
- data/docs/Prismic/DefaultHTTPClient.html +350 -0
- data/docs/Prismic/Document.html +873 -0
- data/docs/Prismic/Error.html +418 -0
- data/docs/Prismic/Experiment.html +633 -0
- data/docs/Prismic/Experiments.html +633 -0
- data/docs/Prismic/Field.html +424 -0
- data/docs/Prismic/Form.html +827 -0
- data/docs/Prismic/Fragments.html +117 -0
- data/docs/Prismic/Fragments/Color.html +632 -0
- data/docs/Prismic/Fragments/Date.html +399 -0
- data/docs/Prismic/Fragments/DocumentLink.html +1048 -0
- data/docs/Prismic/Fragments/Embed.html +679 -0
- data/docs/Prismic/Fragments/FileLink.html +604 -0
- data/docs/Prismic/Fragments/Fragment.html +339 -0
- data/docs/Prismic/Fragments/GeoPoint.html +469 -0
- data/docs/Prismic/Fragments/Group.html +710 -0
- data/docs/Prismic/Fragments/GroupDocument.html +382 -0
- data/docs/Prismic/Fragments/Image.html +780 -0
- data/docs/Prismic/Fragments/Image/View.html +759 -0
- data/docs/Prismic/Fragments/Image/ViewDoesNotExistException.html +147 -0
- data/docs/Prismic/Fragments/ImageLink.html +336 -0
- data/docs/Prismic/Fragments/Link.html +412 -0
- data/docs/Prismic/Fragments/Multiple.html +513 -0
- data/docs/Prismic/Fragments/Number.html +401 -0
- data/docs/Prismic/Fragments/Select.html +349 -0
- data/docs/Prismic/Fragments/Separator.html +396 -0
- data/docs/Prismic/Fragments/Slice.html +632 -0
- data/docs/Prismic/Fragments/SliceZone.html +474 -0
- data/docs/Prismic/Fragments/StructuredText.html +664 -0
- data/docs/Prismic/Fragments/StructuredText/Block.html +232 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Embed.html +367 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Heading.html +366 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Image.html +755 -0
- data/docs/Prismic/Fragments/StructuredText/Block/ListItem.html +372 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Paragraph.html +223 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Preformatted.html +223 -0
- data/docs/Prismic/Fragments/StructuredText/Block/Text.html +818 -0
- data/docs/Prismic/Fragments/StructuredText/BlockGroup.html +423 -0
- data/docs/Prismic/Fragments/StructuredText/Span.html +384 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Em.html +213 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Hyperlink.html +359 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Label.html +362 -0
- data/docs/Prismic/Fragments/StructuredText/Span/Strong.html +213 -0
- data/docs/Prismic/Fragments/Text.html +396 -0
- data/docs/Prismic/Fragments/Timestamp.html +399 -0
- data/docs/Prismic/Fragments/WebLink.html +340 -0
- data/docs/Prismic/HtmlSerializer.html +270 -0
- data/docs/Prismic/JsonParser.html +1764 -0
- data/docs/Prismic/LinkResolver.html +399 -0
- data/docs/Prismic/LruCache.html +1140 -0
- data/docs/Prismic/Predicates.html +1630 -0
- data/docs/Prismic/Ref.html +643 -0
- data/docs/Prismic/Response.html +1159 -0
- data/docs/Prismic/SearchForm.html +2172 -0
- data/docs/Prismic/SearchForm/AuthenticationException.html +147 -0
- data/docs/Prismic/SearchForm/AuthorizationException.html +147 -0
- data/docs/Prismic/SearchForm/FormSearchException.html +147 -0
- data/docs/Prismic/SearchForm/NoRefSetException.html +147 -0
- data/docs/Prismic/SearchForm/RefNotFoundException.html +147 -0
- data/docs/Prismic/SearchForm/UnsupportedFormKind.html +147 -0
- data/docs/Prismic/Variation.html +546 -0
- data/docs/Prismic/WithFragments.html +1803 -0
- data/docs/_index.html +752 -0
- data/docs/class_list.html +54 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +57 -0
- data/docs/css/style.css +339 -0
- data/docs/file.README.html +180 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +26 -0
- data/docs/index.html +180 -0
- data/docs/js/app.js +219 -0
- data/docs/js/full_list.js +178 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +2381 -0
- data/docs/top-level-namespace.html +112 -0
- data/lib/prismic.rb +17 -1
- data/lib/prismic/api.rb +31 -19
- data/lib/prismic/fragments/image.rb +6 -0
- data/lib/prismic/json_parsers.rb +2 -0
- data/lib/prismic/version.rb +1 -1
- data/spec/cache_spec.rb +12 -12
- data/spec/json_parsers_spec.rb +10 -5
- data/spec/oauth_spec.rb +3 -3
- data/spec/prismic_spec.rb +7 -7
- data/spec/responses_mocks/api.json +12 -12
- data/spec/responses_mocks/document.json +4 -2
- data/spec/responses_mocks/document_with_unknown_fragment.json +2 -0
- data/spec/responses_mocks/fragments.json +5 -3
- data/spec/responses_mocks/slices.json +2 -0
- data/spec/responses_mocks/structured_text_with_labels.json +2 -2
- data/spec/simple_search_spec.rb +55 -0
- metadata +103 -24
- data/deploy-doc.sh +0 -9
- data/spec/doc_spec.rb +0 -298
- data/spec/lesbonneschoses_spec.rb +0 -228
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 397ea2cd56addd7eb0044a8fc9fef772df40f174
|
|
4
|
+
data.tar.gz: fe7638bd984fb3162ecb9c9e3b6383f23d0458a7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a075bc85ebda03d3c35c6afd0136f6b8c4d82b86aae1a3a1371a200069bdbecaf0baf5a67b4f5e33fc50dd31937d030697122d5c083c99f1e937636b3252fca6
|
|
7
|
+
data.tar.gz: b74c4f82f34faf7e3186ad518840135a04a7a4254564c10b4813edcb5dfd045348a3ba8bdb2f05eff1d040edf3a2af7d5798d569901a56c183dda171f3f90e2a
|
data/.yardopts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
--markup markdown
|
|
2
|
-
|
|
2
|
+
--output-dir ./docs
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -30,21 +30,13 @@ To add the gem as a dependency to your project with [Bundler](http://bundler.io/
|
|
|
30
30
|
gem 'prismic.io', require: 'prismic'
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
#### Get started
|
|
33
|
+
#### Get started
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
- [developer documentation](https://prismic.io/docs)
|
|
36
|
+
- [quickstart](https://prismic.io/quickstart)
|
|
37
|
+
- [API reference](http://prismicio.github.io/ruby-kit/)
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
Also on our [prismic.io developer's portal](https://developers.prismic.io/), on top of our full documentation, you will:
|
|
40
|
-
* get a thorough introduction of [how to use prismic.io kits](https://developers.prismic.io/documentation/UjBe8bGIJ3EKtgBZ/api-documentation#kits-and-helpers), including this one.
|
|
41
|
-
* see [what else is available for Ruby](https://developers.prismic.io/technologies/UjBh6MuvzeMJvE4m/ruby): starter projects, examples, ...
|
|
42
|
-
|
|
43
|
-
### Using the kit
|
|
44
|
-
|
|
45
|
-
#### Kit's detailed documentation
|
|
46
|
-
|
|
47
|
-
To get a detailed documentation of the Ruby kit's variables and methods, please check out the [prismic.io Ruby kit's documentation](http://rubydoc.info/github/prismicio/ruby-kit/master/frames).
|
|
39
|
+
The quickstart is not available for Ruby yet, but if you understand Javascript you can easily adapt the code.
|
|
48
40
|
|
|
49
41
|
#### Specific Ruby kit syntax
|
|
50
42
|
|
|
@@ -59,7 +51,7 @@ Thanks to Ruby's syntax, this kit contains some mild differences and syntastic s
|
|
|
59
51
|
Knowing all that, here is typical code written with the Ruby kit:
|
|
60
52
|
|
|
61
53
|
* A typical API object instantiation looks like this: `Prismic.api(url, opts)`
|
|
62
|
-
* A typical querying looks like this: `api.
|
|
54
|
+
* A typical querying looks like this: `api.query('[[:d = at(document.type, "product")]]')`
|
|
63
55
|
* A typical fragment manipulation looks like this: `doc['article.image'].get_view('icon').url`
|
|
64
56
|
* A typical fragment serialization to HTML looks like this: `doc['article.body'].as_html(@link_resolver)`
|
|
65
57
|
|
data/docs/Prismic.html
ADDED
|
@@ -0,0 +1,1074 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Module: Prismic
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.7.4
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '';
|
|
20
|
+
framesUrl = "frames.html#!Prismic.html";
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="_index.html">Index (P)</a> »
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
<span class="title">Prismic</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Module: Prismic
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
|
82
|
+
<dd class="r1 last">lib/prismic.rb<span class="defines">,<br />
|
|
83
|
+
lib/prismic/api.rb,<br /> lib/prismic/form.rb,<br /> lib/prismic/version.rb,<br /> lib/prismic/cache/lru.rb,<br /> lib/prismic/predicates.rb,<br /> lib/prismic/experiments.rb,<br /> lib/prismic/json_parsers.rb,<br /> lib/prismic/with_fragments.rb,<br /> lib/prismic/fragments/date.rb,<br /> lib/prismic/fragments/link.rb,<br /> lib/prismic/fragments/text.rb,<br /> lib/prismic/fragments/image.rb,<br /> lib/prismic/fragments/embed.rb,<br /> lib/prismic/fragments/color.rb,<br /> lib/prismic/fragments/group.rb,<br /> lib/prismic/fragments/select.rb,<br /> lib/prismic/fragments/slices.rb,<br /> lib/prismic/fragments/number.rb,<br /> lib/prismic/fragments/multiple.rb,<br /> lib/prismic/fragments/fragment.rb,<br /> lib/prismic/fragments/geopoint.rb,<br /> lib/prismic/fragments/timestamp.rb,<br /> lib/prismic/fragments/separator.rb,<br /> lib/prismic/fragments/structured_text.rb</span>
|
|
84
|
+
</dd>
|
|
85
|
+
|
|
86
|
+
</dl>
|
|
87
|
+
<div class="clear"></div>
|
|
88
|
+
|
|
89
|
+
<h2>Defined Under Namespace</h2>
|
|
90
|
+
<p class="children">
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Prismic/DefaultHTTPClient.html" title="Prismic::DefaultHTTPClient (module)">DefaultHTTPClient</a></span>, <span class='object_link'><a href="Prismic/Fragments.html" title="Prismic::Fragments (module)">Fragments</a></span>, <span class='object_link'><a href="Prismic/JsonParser.html" title="Prismic::JsonParser (module)">JsonParser</a></span>, <span class='object_link'><a href="Prismic/Predicates.html" title="Prismic::Predicates (module)">Predicates</a></span>, <span class='object_link'><a href="Prismic/WithFragments.html" title="Prismic::WithFragments (module)">WithFragments</a></span>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span>, <span class='object_link'><a href="Prismic/BasicNullCache.html" title="Prismic::BasicNullCache (class)">BasicNullCache</a></span>, <span class='object_link'><a href="Prismic/Document.html" title="Prismic::Document (class)">Document</a></span>, <span class='object_link'><a href="Prismic/Error.html" title="Prismic::Error (class)">Error</a></span>, <span class='object_link'><a href="Prismic/Experiment.html" title="Prismic::Experiment (class)">Experiment</a></span>, <span class='object_link'><a href="Prismic/Experiments.html" title="Prismic::Experiments (class)">Experiments</a></span>, <span class='object_link'><a href="Prismic/Field.html" title="Prismic::Field (class)">Field</a></span>, <span class='object_link'><a href="Prismic/Form.html" title="Prismic::Form (class)">Form</a></span>, <span class='object_link'><a href="Prismic/HtmlSerializer.html" title="Prismic::HtmlSerializer (class)">HtmlSerializer</a></span>, <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span>, <span class='object_link'><a href="Prismic/LruCache.html" title="Prismic::LruCache (class)">LruCache</a></span>, <span class='object_link'><a href="Prismic/Ref.html" title="Prismic::Ref (class)">Ref</a></span>, <span class='object_link'><a href="Prismic/Response.html" title="Prismic::Response (class)">Response</a></span>, <span class='object_link'><a href="Prismic/SearchForm.html" title="Prismic::SearchForm (class)">SearchForm</a></span>, <span class='object_link'><a href="Prismic/Variation.html" title="Prismic::Variation (class)">Variation</a></span>
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
</p>
|
|
101
|
+
|
|
102
|
+
<h2>Constant Summary</h2>
|
|
103
|
+
|
|
104
|
+
<dl class="constants">
|
|
105
|
+
|
|
106
|
+
<dt id="EXPERIMENTS_COOKIE-constant" class="">EXPERIMENTS_COOKIE =
|
|
107
|
+
|
|
108
|
+
</dt>
|
|
109
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>io.prismic.experiment</span><span class='tstring_end'>'</span></span></pre></dd>
|
|
110
|
+
|
|
111
|
+
<dt id="PREVIEW_COOKIE-constant" class="">PREVIEW_COOKIE =
|
|
112
|
+
|
|
113
|
+
</dt>
|
|
114
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>io.prismic.preview</span><span class='tstring_end'>'</span></span></pre></dd>
|
|
115
|
+
|
|
116
|
+
<dt id="VERSION-constant" class="">VERSION =
|
|
117
|
+
|
|
118
|
+
</dt>
|
|
119
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>1.4.1</span><span class='tstring_end'>'</span></span></pre></dd>
|
|
120
|
+
|
|
121
|
+
<dt id="DefaultCache-constant" class="">DefaultCache =
|
|
122
|
+
<div class="docstring">
|
|
123
|
+
<div class="discussion">
|
|
124
|
+
<p>This default instance is used by the API to avoid creating a new instance
|
|
125
|
+
per request (which would make the cache useless).</p>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
<div class="tags">
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
</div>
|
|
134
|
+
</dt>
|
|
135
|
+
<dd><pre class="code"><span class='const'>LruCache</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span></pre></dd>
|
|
136
|
+
|
|
137
|
+
</dl>
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
<h2>
|
|
148
|
+
Class Method Summary
|
|
149
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
150
|
+
</h2>
|
|
151
|
+
|
|
152
|
+
<ul class="summary">
|
|
153
|
+
|
|
154
|
+
<li class="public ">
|
|
155
|
+
<span class="summary_signature">
|
|
156
|
+
|
|
157
|
+
<a href="#api-class_method" title="api (class method)">+ (API) <strong>api</strong>(url, opts = nil) </a>
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
</span>
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
<span class="summary_desc"><div class='inline'><p>Return an API instance The access token and HTTP client can be provided.</p>
|
|
172
|
+
</div></span>
|
|
173
|
+
|
|
174
|
+
</li>
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
<li class="public ">
|
|
178
|
+
<span class="summary_signature">
|
|
179
|
+
|
|
180
|
+
<a href="#html_serializer-class_method" title="html_serializer (class method)">+ (Object) <strong>html_serializer</strong>(&blk) </a>
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
</span>
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
|
195
|
+
|
|
196
|
+
</li>
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
<li class="public ">
|
|
200
|
+
<span class="summary_signature">
|
|
201
|
+
|
|
202
|
+
<a href="#link_resolver-class_method" title="link_resolver (class method)">+ (LinkResolver) <strong>link_resolver</strong>(ref) {|doc_link| ... }</a>
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
</span>
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
<span class="summary_desc"><div class='inline'><p>Build a <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> instance The <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> will help to build URL specific to an application, based on a generic prismic.io's <span class='object_link'><a href="Prismic/Fragments/DocumentLink.html" title="Prismic::Fragments::DocumentLink (class)">Document link</a></span>.</p>
|
|
217
|
+
</div></span>
|
|
218
|
+
|
|
219
|
+
</li>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
<li class="public ">
|
|
223
|
+
<span class="summary_signature">
|
|
224
|
+
|
|
225
|
+
<a href="#oauth_check_token-class_method" title="oauth_check_token (class method)">+ (String) <strong>oauth_check_token</strong>(url, oauth_opts, api_opts = nil) </a>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
</span>
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
<span class="summary_desc"><div class='inline'><p>Check a token and return an access_token.</p>
|
|
240
|
+
</div></span>
|
|
241
|
+
|
|
242
|
+
</li>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
<li class="public ">
|
|
246
|
+
<span class="summary_signature">
|
|
247
|
+
|
|
248
|
+
<a href="#oauth_initiate_url-class_method" title="oauth_initiate_url (class method)">+ (String) <strong>oauth_initiate_url</strong>(url, oauth_opts, api_opts = nil) </a>
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
</span>
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
<span class="summary_desc"><div class='inline'><p>Build the URL where the user can be redirected to authenticated himself using OAuth2.</p>
|
|
263
|
+
</div></span>
|
|
264
|
+
|
|
265
|
+
</li>
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
</ul>
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
<div id="class_method_details" class="method_details_list">
|
|
274
|
+
<h2>Class Method Details</h2>
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
<div class="method_details first">
|
|
278
|
+
<h3 class="signature first" id="api-class_method">
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
<span class="overload">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url) </span>
|
|
282
|
+
|
|
283
|
+
<span class="overload">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url, opts) </span>
|
|
284
|
+
|
|
285
|
+
<span class="overload">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url, access_token) </span>
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
</h3><div class="docstring">
|
|
293
|
+
<div class="discussion">
|
|
294
|
+
<p>Return an API instance
|
|
295
|
+
The access token and HTTP client can be provided.</p>
|
|
296
|
+
|
|
297
|
+
<p>The HTTP Client must responds to same method than <span class='object_link'><a href="Prismic/DefaultHTTPClient.html" title="Prismic::DefaultHTTPClient (module)">DefaultHTTPClient</a></span>.</p>
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
<div class="tags">
|
|
303
|
+
|
|
304
|
+
<p class="tag_title">Overloads:</p>
|
|
305
|
+
<ul class="overload">
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
<li class="overload_item">
|
|
309
|
+
<span class="signature">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url) </span>
|
|
310
|
+
<div class="docstring">
|
|
311
|
+
<div class="discussion">
|
|
312
|
+
<p>Simpler syntax (no configuration)</p>
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
</div>
|
|
316
|
+
</div>
|
|
317
|
+
<div class="tags">
|
|
318
|
+
<p class="tag_title">Parameters:</p>
|
|
319
|
+
<ul class="param">
|
|
320
|
+
|
|
321
|
+
<li>
|
|
322
|
+
|
|
323
|
+
<span class='name'>url</span>
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
—
|
|
331
|
+
<div class='inline'><p>The URL of the prismic.io repository</p>
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
</li>
|
|
335
|
+
|
|
336
|
+
</ul>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
</div>
|
|
340
|
+
</li>
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
<li class="overload_item">
|
|
344
|
+
<span class="signature">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url, opts) </span>
|
|
345
|
+
<div class="docstring">
|
|
346
|
+
<div class="discussion">
|
|
347
|
+
<p>Standard use</p>
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
</div>
|
|
351
|
+
</div>
|
|
352
|
+
<div class="tags">
|
|
353
|
+
<p class="tag_title">Parameters:</p>
|
|
354
|
+
<ul class="param">
|
|
355
|
+
|
|
356
|
+
<li>
|
|
357
|
+
|
|
358
|
+
<span class='name'>url</span>
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
—
|
|
366
|
+
<div class='inline'><p>The URL of the prismic.io repository</p>
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
</li>
|
|
370
|
+
|
|
371
|
+
<li>
|
|
372
|
+
|
|
373
|
+
<span class='name'>opts</span>
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
—
|
|
381
|
+
<div class='inline'><p>The options</p>
|
|
382
|
+
</div>
|
|
383
|
+
|
|
384
|
+
</li>
|
|
385
|
+
|
|
386
|
+
</ul>
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
<p class="tag_title">Options Hash (<tt>opts</tt>):</p>
|
|
394
|
+
<ul class="option">
|
|
395
|
+
|
|
396
|
+
<li>
|
|
397
|
+
<span class="name">:access_token</span>
|
|
398
|
+
<span class="type">(<tt>String</tt>)</span>
|
|
399
|
+
<span class="default">
|
|
400
|
+
|
|
401
|
+
— default:
|
|
402
|
+
<tt>nil</tt>
|
|
403
|
+
|
|
404
|
+
</span>
|
|
405
|
+
|
|
406
|
+
— <div class='inline'><p>The access_token</p>
|
|
407
|
+
</div>
|
|
408
|
+
|
|
409
|
+
</li>
|
|
410
|
+
|
|
411
|
+
<li>
|
|
412
|
+
<span class="name">:http_client</span>
|
|
413
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
414
|
+
<span class="default">
|
|
415
|
+
|
|
416
|
+
— default:
|
|
417
|
+
<tt>DefaultHTTPClient</tt>
|
|
418
|
+
|
|
419
|
+
</span>
|
|
420
|
+
|
|
421
|
+
— <div class='inline'><p>The HTTP client to use</p>
|
|
422
|
+
</div>
|
|
423
|
+
|
|
424
|
+
</li>
|
|
425
|
+
|
|
426
|
+
<li>
|
|
427
|
+
<span class="name">:cache</span>
|
|
428
|
+
<span class="type">(<tt>Object</tt>)</span>
|
|
429
|
+
<span class="default">
|
|
430
|
+
|
|
431
|
+
— default:
|
|
432
|
+
<tt>nil</tt>
|
|
433
|
+
|
|
434
|
+
</span>
|
|
435
|
+
|
|
436
|
+
— <div class='inline'><p>The caching object (for instance Prismic::Cache) to use, or false for no caching</p>
|
|
437
|
+
</div>
|
|
438
|
+
|
|
439
|
+
</li>
|
|
440
|
+
|
|
441
|
+
</ul>
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
</div>
|
|
446
|
+
</li>
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
<li class="overload_item">
|
|
450
|
+
<span class="signature">+ (<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>) <strong>api</strong>(url, access_token) </span>
|
|
451
|
+
<div class="docstring">
|
|
452
|
+
<div class="discussion">
|
|
453
|
+
<p>Provide the access_token (only)</p>
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
</div>
|
|
457
|
+
</div>
|
|
458
|
+
<div class="tags">
|
|
459
|
+
<p class="tag_title">Parameters:</p>
|
|
460
|
+
<ul class="param">
|
|
461
|
+
|
|
462
|
+
<li>
|
|
463
|
+
|
|
464
|
+
<span class='name'>url</span>
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
—
|
|
472
|
+
<div class='inline'><p>The URL of the prismic.io repository</p>
|
|
473
|
+
</div>
|
|
474
|
+
|
|
475
|
+
</li>
|
|
476
|
+
|
|
477
|
+
<li>
|
|
478
|
+
|
|
479
|
+
<span class='name'>access_token</span>
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
—
|
|
487
|
+
<div class='inline'><p>The access token</p>
|
|
488
|
+
</div>
|
|
489
|
+
|
|
490
|
+
</li>
|
|
491
|
+
|
|
492
|
+
</ul>
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
</div>
|
|
496
|
+
</li>
|
|
497
|
+
|
|
498
|
+
</ul>
|
|
499
|
+
|
|
500
|
+
<p class="tag_title">Returns:</p>
|
|
501
|
+
<ul class="return">
|
|
502
|
+
|
|
503
|
+
<li>
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
<span class='type'>(<tt><span class='object_link'><a href="Prismic/API.html" title="Prismic::API (class)">API</a></span></tt>)</span>
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
—
|
|
511
|
+
<div class='inline'><p>The API instance related to this repository</p>
|
|
512
|
+
</div>
|
|
513
|
+
|
|
514
|
+
</li>
|
|
515
|
+
|
|
516
|
+
</ul>
|
|
517
|
+
<p class="tag_title">Raises:</p>
|
|
518
|
+
<ul class="raise">
|
|
519
|
+
|
|
520
|
+
<li>
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
<span class='type'></span>
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
<div class='inline'><p>PrismicWSConnectionError</p>
|
|
529
|
+
</div>
|
|
530
|
+
|
|
531
|
+
</li>
|
|
532
|
+
|
|
533
|
+
</ul>
|
|
534
|
+
|
|
535
|
+
</div><table class="source_code">
|
|
536
|
+
<tr>
|
|
537
|
+
<td>
|
|
538
|
+
<pre class="lines">
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
64
|
|
542
|
+
65
|
|
543
|
+
66
|
|
544
|
+
67
|
|
545
|
+
68
|
|
546
|
+
69
|
|
547
|
+
70
|
|
548
|
+
71</pre>
|
|
549
|
+
</td>
|
|
550
|
+
<td>
|
|
551
|
+
<pre class="code"><span class="info file"># File 'lib/prismic.rb', line 64</span>
|
|
552
|
+
|
|
553
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_api'>api</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
|
554
|
+
<span class='kw'>if</span> <span class='lparen'>(</span><span class='kw'>not</span> <span class='id identifier rubyid_url'>url</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\A</span><span class='embexpr_beg'>#{</span><span class='const'>URI</span><span class='op'>::</span><span class='id identifier rubyid_regexp'>regexp</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>http</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>https</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>\z</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span>
|
|
555
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Valid web URI expected</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
|
556
|
+
<span class='kw'>end</span>
|
|
557
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
558
|
+
<span class='id identifier rubyid_opts'>opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>access_token:</span> <span class='id identifier rubyid_opts'>opts</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_opts'>opts</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
559
|
+
<span class='const'>API</span><span class='period'>.</span><span class='id identifier rubyid_start'>start</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_opts'>opts</span><span class='rparen'>)</span>
|
|
560
|
+
<span class='kw'>end</span></pre>
|
|
561
|
+
</td>
|
|
562
|
+
</tr>
|
|
563
|
+
</table>
|
|
564
|
+
</div>
|
|
565
|
+
|
|
566
|
+
<div class="method_details ">
|
|
567
|
+
<h3 class="signature " id="html_serializer-class_method">
|
|
568
|
+
|
|
569
|
+
+ (<tt>Object</tt>) <strong>html_serializer</strong>(&blk)
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
</h3><table class="source_code">
|
|
576
|
+
<tr>
|
|
577
|
+
<td>
|
|
578
|
+
<pre class="lines">
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
621
|
|
582
|
+
622
|
|
583
|
+
623</pre>
|
|
584
|
+
</td>
|
|
585
|
+
<td>
|
|
586
|
+
<pre class="code"><span class="info file"># File 'lib/prismic.rb', line 621</span>
|
|
587
|
+
|
|
588
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_html_serializer'>html_serializer</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
|
|
589
|
+
<span class='const'>HtmlSerializer</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
|
|
590
|
+
<span class='kw'>end</span></pre>
|
|
591
|
+
</td>
|
|
592
|
+
</tr>
|
|
593
|
+
</table>
|
|
594
|
+
</div>
|
|
595
|
+
|
|
596
|
+
<div class="method_details ">
|
|
597
|
+
<h3 class="signature " id="link_resolver-class_method">
|
|
598
|
+
|
|
599
|
+
+ (<tt><span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span></tt>) <strong>link_resolver</strong>(ref) {|doc_link| ... }
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
</h3><div class="docstring">
|
|
606
|
+
<div class="discussion">
|
|
607
|
+
<p>Build a <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> instance
|
|
608
|
+
The <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> will help to build URL specific to an application, based
|
|
609
|
+
on a generic prismic.io's <span class='object_link'><a href="Prismic/Fragments/DocumentLink.html" title="Prismic::Fragments::DocumentLink (class)">Document link</a></span>.</p>
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
</div>
|
|
613
|
+
</div>
|
|
614
|
+
<div class="tags">
|
|
615
|
+
<p class="tag_title">Parameters:</p>
|
|
616
|
+
<ul class="param">
|
|
617
|
+
|
|
618
|
+
<li>
|
|
619
|
+
|
|
620
|
+
<span class='name'>ref</span>
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
<span class='type'>(<tt><span class='object_link'><a href="Prismic/Ref.html" title="Prismic::Ref (class)">Ref</a></span></tt>)</span>
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
—
|
|
628
|
+
<div class='inline'><p>The ref to use</p>
|
|
629
|
+
</div>
|
|
630
|
+
|
|
631
|
+
</li>
|
|
632
|
+
|
|
633
|
+
</ul>
|
|
634
|
+
|
|
635
|
+
<p class="tag_title">Yield Parameters:</p>
|
|
636
|
+
<ul class="yieldparam">
|
|
637
|
+
|
|
638
|
+
<li>
|
|
639
|
+
|
|
640
|
+
<span class='name'>doc_link</span>
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
<span class='type'>(<tt><span class='object_link'><a href="Prismic/Fragments/DocumentLink.html" title="Prismic::Fragments::DocumentLink (class)">Fragments::DocumentLink</a></span></tt>)</span>
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
—
|
|
648
|
+
<div class='inline'><p>A DocumentLink instance</p>
|
|
649
|
+
</div>
|
|
650
|
+
|
|
651
|
+
</li>
|
|
652
|
+
|
|
653
|
+
</ul>
|
|
654
|
+
<p class="tag_title">Yield Returns:</p>
|
|
655
|
+
<ul class="yieldreturn">
|
|
656
|
+
|
|
657
|
+
<li>
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
—
|
|
665
|
+
<div class='inline'><p>The application specific URL of the given document</p>
|
|
666
|
+
</div>
|
|
667
|
+
|
|
668
|
+
</li>
|
|
669
|
+
|
|
670
|
+
</ul>
|
|
671
|
+
<p class="tag_title">Returns:</p>
|
|
672
|
+
<ul class="return">
|
|
673
|
+
|
|
674
|
+
<li>
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
<span class='type'>(<tt><span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span></tt>)</span>
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
—
|
|
682
|
+
<div class='inline'><p>the <span class='object_link'><a href="Prismic/LinkResolver.html" title="Prismic::LinkResolver (class)">LinkResolver</a></span> instance</p>
|
|
683
|
+
</div>
|
|
684
|
+
|
|
685
|
+
</li>
|
|
686
|
+
|
|
687
|
+
</ul>
|
|
688
|
+
|
|
689
|
+
</div><table class="source_code">
|
|
690
|
+
<tr>
|
|
691
|
+
<td>
|
|
692
|
+
<pre class="lines">
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
617
|
|
696
|
+
618
|
|
697
|
+
619</pre>
|
|
698
|
+
</td>
|
|
699
|
+
<td>
|
|
700
|
+
<pre class="code"><span class="info file"># File 'lib/prismic.rb', line 617</span>
|
|
701
|
+
|
|
702
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_link_resolver'>link_resolver</span><span class='lparen'>(</span><span class='id identifier rubyid_ref'>ref</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
|
|
703
|
+
<span class='const'>LinkResolver</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_ref'>ref</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_blk'>blk</span><span class='rparen'>)</span>
|
|
704
|
+
<span class='kw'>end</span></pre>
|
|
705
|
+
</td>
|
|
706
|
+
</tr>
|
|
707
|
+
</table>
|
|
708
|
+
</div>
|
|
709
|
+
|
|
710
|
+
<div class="method_details ">
|
|
711
|
+
<h3 class="signature " id="oauth_check_token-class_method">
|
|
712
|
+
|
|
713
|
+
+ (<tt>String</tt>) <strong>oauth_check_token</strong>(url, oauth_opts, api_opts = nil)
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
</h3><div class="docstring">
|
|
720
|
+
<div class="discussion">
|
|
721
|
+
<p>Check a token and return an access_token</p>
|
|
722
|
+
|
|
723
|
+
<p>This method allows to check the token received when the user has been
|
|
724
|
+
redirected from the OAuth2 server. It returns an access_token that can
|
|
725
|
+
be used to authenticate the user on the API.</p>
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
</div>
|
|
729
|
+
</div>
|
|
730
|
+
<div class="tags">
|
|
731
|
+
<p class="tag_title">Parameters:</p>
|
|
732
|
+
<ul class="param">
|
|
733
|
+
|
|
734
|
+
<li>
|
|
735
|
+
|
|
736
|
+
<span class='name'>url</span>
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
—
|
|
744
|
+
<div class='inline'><p>The URL of the prismic.io repository</p>
|
|
745
|
+
</div>
|
|
746
|
+
|
|
747
|
+
</li>
|
|
748
|
+
|
|
749
|
+
<li>
|
|
750
|
+
|
|
751
|
+
<span class='name'>oauth_opts</span>
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
—
|
|
759
|
+
<div class='inline'><p>The OAuth2 options</p>
|
|
760
|
+
</div>
|
|
761
|
+
|
|
762
|
+
</li>
|
|
763
|
+
|
|
764
|
+
<li>
|
|
765
|
+
|
|
766
|
+
<span class='name'>api_opts</span>
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
—
|
|
776
|
+
<div class='inline'><p>The API options (the same than accepted by the
|
|
777
|
+
<span class='object_link'><a href="#api-class_method" title="Prismic.api (method)">api</a></span> method)</p>
|
|
778
|
+
</div>
|
|
779
|
+
|
|
780
|
+
</li>
|
|
781
|
+
|
|
782
|
+
</ul>
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
<p class="tag_title">Options Hash (<tt>oauth_opts</tt>):</p>
|
|
790
|
+
<ul class="option">
|
|
791
|
+
|
|
792
|
+
<li>
|
|
793
|
+
<span class="name">:client_id</span>
|
|
794
|
+
<span class="type">(<tt>String</tt>)</span>
|
|
795
|
+
<span class="default">
|
|
796
|
+
|
|
797
|
+
</span>
|
|
798
|
+
|
|
799
|
+
— <div class='inline'><p>The Application's client ID</p>
|
|
800
|
+
</div>
|
|
801
|
+
|
|
802
|
+
</li>
|
|
803
|
+
|
|
804
|
+
<li>
|
|
805
|
+
<span class="name">:redirect_uri</span>
|
|
806
|
+
<span class="type">(<tt>String</tt>)</span>
|
|
807
|
+
<span class="default">
|
|
808
|
+
|
|
809
|
+
</span>
|
|
810
|
+
|
|
811
|
+
— <div class='inline'><p>The Application's secret</p>
|
|
812
|
+
</div>
|
|
813
|
+
|
|
814
|
+
</li>
|
|
815
|
+
|
|
816
|
+
</ul>
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
<p class="tag_title">Returns:</p>
|
|
822
|
+
<ul class="return">
|
|
823
|
+
|
|
824
|
+
<li>
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
—
|
|
832
|
+
<div class='inline'><p>the access_token</p>
|
|
833
|
+
</div>
|
|
834
|
+
|
|
835
|
+
</li>
|
|
836
|
+
|
|
837
|
+
</ul>
|
|
838
|
+
<p class="tag_title">Raises:</p>
|
|
839
|
+
<ul class="raise">
|
|
840
|
+
|
|
841
|
+
<li>
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
<span class='type'></span>
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
<div class='inline'><p>PrismicWSConnectionError</p>
|
|
850
|
+
</div>
|
|
851
|
+
|
|
852
|
+
</li>
|
|
853
|
+
|
|
854
|
+
</ul>
|
|
855
|
+
|
|
856
|
+
</div><table class="source_code">
|
|
857
|
+
<tr>
|
|
858
|
+
<td>
|
|
859
|
+
<pre class="lines">
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
115
|
|
863
|
+
116
|
|
864
|
+
117
|
|
865
|
+
118
|
|
866
|
+
119</pre>
|
|
867
|
+
</td>
|
|
868
|
+
<td>
|
|
869
|
+
<pre class="code"><span class="info file"># File 'lib/prismic.rb', line 115</span>
|
|
870
|
+
|
|
871
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_oauth_check_token'>oauth_check_token</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
|
872
|
+
<span class='id identifier rubyid_api_opts'>api_opts</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
873
|
+
<span class='id identifier rubyid_api_opts'>api_opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>access_token:</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
874
|
+
<span class='const'>API</span><span class='period'>.</span><span class='id identifier rubyid_oauth_check_token'>oauth_check_token</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rparen'>)</span>
|
|
875
|
+
<span class='kw'>end</span></pre>
|
|
876
|
+
</td>
|
|
877
|
+
</tr>
|
|
878
|
+
</table>
|
|
879
|
+
</div>
|
|
880
|
+
|
|
881
|
+
<div class="method_details ">
|
|
882
|
+
<h3 class="signature " id="oauth_initiate_url-class_method">
|
|
883
|
+
|
|
884
|
+
+ (<tt>String</tt>) <strong>oauth_initiate_url</strong>(url, oauth_opts, api_opts = nil)
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
</h3><div class="docstring">
|
|
891
|
+
<div class="discussion">
|
|
892
|
+
<p>Build the URL where the user can be redirected to authenticated himself
|
|
893
|
+
using OAuth2.
|
|
894
|
+
@note: The endpoint depends on the repository, so an API call is made to
|
|
895
|
+
fetch it.</p>
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
</div>
|
|
899
|
+
</div>
|
|
900
|
+
<div class="tags">
|
|
901
|
+
<p class="tag_title">Parameters:</p>
|
|
902
|
+
<ul class="param">
|
|
903
|
+
|
|
904
|
+
<li>
|
|
905
|
+
|
|
906
|
+
<span class='name'>url</span>
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
—
|
|
914
|
+
<div class='inline'><p>The URL of the prismic.io repository</p>
|
|
915
|
+
</div>
|
|
916
|
+
|
|
917
|
+
</li>
|
|
918
|
+
|
|
919
|
+
<li>
|
|
920
|
+
|
|
921
|
+
<span class='name'>oauth_opts</span>
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
—
|
|
929
|
+
<div class='inline'><p>The OAuth2 options</p>
|
|
930
|
+
</div>
|
|
931
|
+
|
|
932
|
+
</li>
|
|
933
|
+
|
|
934
|
+
<li>
|
|
935
|
+
|
|
936
|
+
<span class='name'>api_opts</span>
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
<span class='type'>(<tt>Hash</tt>)</span>
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
<em class="default">(defaults to: <tt>nil</tt>)</em>
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
—
|
|
946
|
+
<div class='inline'><p>The API options (the same than accepted by the <span class='object_link'><a href="#api-class_method" title="Prismic.api (method)">api</a></span>
|
|
947
|
+
method)</p>
|
|
948
|
+
</div>
|
|
949
|
+
|
|
950
|
+
</li>
|
|
951
|
+
|
|
952
|
+
</ul>
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
<p class="tag_title">Options Hash (<tt>oauth_opts</tt>):</p>
|
|
960
|
+
<ul class="option">
|
|
961
|
+
|
|
962
|
+
<li>
|
|
963
|
+
<span class="name">:client_id</span>
|
|
964
|
+
<span class="type">(<tt>String</tt>)</span>
|
|
965
|
+
<span class="default">
|
|
966
|
+
|
|
967
|
+
</span>
|
|
968
|
+
|
|
969
|
+
— <div class='inline'><p>The Application's client ID</p>
|
|
970
|
+
</div>
|
|
971
|
+
|
|
972
|
+
</li>
|
|
973
|
+
|
|
974
|
+
<li>
|
|
975
|
+
<span class="name">:redirect_uri</span>
|
|
976
|
+
<span class="type">(<tt>String</tt>)</span>
|
|
977
|
+
<span class="default">
|
|
978
|
+
|
|
979
|
+
</span>
|
|
980
|
+
|
|
981
|
+
— <div class='inline'><p>The Application's secret</p>
|
|
982
|
+
</div>
|
|
983
|
+
|
|
984
|
+
</li>
|
|
985
|
+
|
|
986
|
+
<li>
|
|
987
|
+
<span class="name">:scope</span>
|
|
988
|
+
<span class="type">(<tt>String</tt>)</span>
|
|
989
|
+
<span class="default">
|
|
990
|
+
|
|
991
|
+
</span>
|
|
992
|
+
|
|
993
|
+
— <div class='inline'><p>The desired scope</p>
|
|
994
|
+
</div>
|
|
995
|
+
|
|
996
|
+
</li>
|
|
997
|
+
|
|
998
|
+
</ul>
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
<p class="tag_title">Returns:</p>
|
|
1004
|
+
<ul class="return">
|
|
1005
|
+
|
|
1006
|
+
<li>
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
<span class='type'>(<tt>String</tt>)</span>
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
—
|
|
1014
|
+
<div class='inline'><p>The built URL</p>
|
|
1015
|
+
</div>
|
|
1016
|
+
|
|
1017
|
+
</li>
|
|
1018
|
+
|
|
1019
|
+
</ul>
|
|
1020
|
+
<p class="tag_title">Raises:</p>
|
|
1021
|
+
<ul class="raise">
|
|
1022
|
+
|
|
1023
|
+
<li>
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
<span class='type'></span>
|
|
1027
|
+
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
|
|
1031
|
+
<div class='inline'><p>PrismicWSConnectionError</p>
|
|
1032
|
+
</div>
|
|
1033
|
+
|
|
1034
|
+
</li>
|
|
1035
|
+
|
|
1036
|
+
</ul>
|
|
1037
|
+
|
|
1038
|
+
</div><table class="source_code">
|
|
1039
|
+
<tr>
|
|
1040
|
+
<td>
|
|
1041
|
+
<pre class="lines">
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
92
|
|
1045
|
+
93
|
|
1046
|
+
94
|
|
1047
|
+
95
|
|
1048
|
+
96</pre>
|
|
1049
|
+
</td>
|
|
1050
|
+
<td>
|
|
1051
|
+
<pre class="code"><span class="info file"># File 'lib/prismic.rb', line 92</span>
|
|
1052
|
+
|
|
1053
|
+
<span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_oauth_initiate_url'>oauth_initiate_url</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
|
1054
|
+
<span class='id identifier rubyid_api_opts'>api_opts</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
1055
|
+
<span class='id identifier rubyid_api_opts'>api_opts</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='label'>access_token:</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>String</span><span class='rparen'>)</span>
|
|
1056
|
+
<span class='const'>API</span><span class='period'>.</span><span class='id identifier rubyid_oauth_initiate_url'>oauth_initiate_url</span><span class='lparen'>(</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_oauth_opts'>oauth_opts</span><span class='comma'>,</span> <span class='id identifier rubyid_api_opts'>api_opts</span><span class='rparen'>)</span>
|
|
1057
|
+
<span class='kw'>end</span></pre>
|
|
1058
|
+
</td>
|
|
1059
|
+
</tr>
|
|
1060
|
+
</table>
|
|
1061
|
+
</div>
|
|
1062
|
+
|
|
1063
|
+
</div>
|
|
1064
|
+
|
|
1065
|
+
</div>
|
|
1066
|
+
|
|
1067
|
+
<div id="footer">
|
|
1068
|
+
Generated on Tue Sep 27 10:47:05 2016 by
|
|
1069
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
1070
|
+
0.8.7.4 (ruby-2.0.0).
|
|
1071
|
+
</div>
|
|
1072
|
+
|
|
1073
|
+
</body>
|
|
1074
|
+
</html>
|