prismic.io 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,255 @@
|
|
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
|
+
Class: Prismic::BasicNullCache
|
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/BasicNullCache.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 (B)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Prismic.html" title="Prismic (module)">Prismic</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">BasicNullCache</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>Class: Prismic::BasicNullCache
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Prismic::BasicNullCache</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/prismic/cache/lru.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
<p>Available as an api cache for testing purposes (no caching)</p>
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
</div>
|
109
|
+
<div class="tags">
|
110
|
+
|
111
|
+
|
112
|
+
</div>
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<h2>
|
121
|
+
Instance Method Summary
|
122
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
123
|
+
</h2>
|
124
|
+
|
125
|
+
<ul class="summary">
|
126
|
+
|
127
|
+
<li class="public ">
|
128
|
+
<span class="summary_signature">
|
129
|
+
|
130
|
+
<a href="#get-instance_method" title="#get (instance method)">- (Object) <strong>get</strong>(key) </a>
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
</span>
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#set-instance_method" title="#set (instance method)">- (Object) <strong>set</strong>(key, value = nil, expired_in = nil) </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
(also: #get_or_set)
|
157
|
+
|
158
|
+
</span>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
169
|
+
|
170
|
+
</li>
|
171
|
+
|
172
|
+
|
173
|
+
</ul>
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<div id="instance_method_details" class="method_details_list">
|
179
|
+
<h2>Instance Method Details</h2>
|
180
|
+
|
181
|
+
|
182
|
+
<div class="method_details first">
|
183
|
+
<h3 class="signature first" id="get-instance_method">
|
184
|
+
|
185
|
+
- (<tt>Object</tt>) <strong>get</strong>(key)
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
</h3><table class="source_code">
|
192
|
+
<tr>
|
193
|
+
<td>
|
194
|
+
<pre class="lines">
|
195
|
+
|
196
|
+
|
197
|
+
111
|
198
|
+
112</pre>
|
199
|
+
</td>
|
200
|
+
<td>
|
201
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/cache/lru.rb', line 111</span>
|
202
|
+
|
203
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='rparen'>)</span>
|
204
|
+
<span class='kw'>end</span></pre>
|
205
|
+
</td>
|
206
|
+
</tr>
|
207
|
+
</table>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
<div class="method_details ">
|
211
|
+
<h3 class="signature " id="set-instance_method">
|
212
|
+
|
213
|
+
- (<tt>Object</tt>) <strong>set</strong>(key, value = nil, expired_in = nil)
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<span class="aliases">Also known as:
|
218
|
+
<span class="names"><span id='get_or_set-instance_method'>get_or_set</span></span>
|
219
|
+
</span>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</h3><table class="source_code">
|
224
|
+
<tr>
|
225
|
+
<td>
|
226
|
+
<pre class="lines">
|
227
|
+
|
228
|
+
|
229
|
+
114
|
230
|
+
115
|
231
|
+
116</pre>
|
232
|
+
</td>
|
233
|
+
<td>
|
234
|
+
<pre class="code"><span class="info file"># File 'lib/prismic/cache/lru.rb', line 114</span>
|
235
|
+
|
236
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_set'>set</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_expired_in'>expired_in</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
237
|
+
<span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>?</span> <span class='kw'>yield</span> <span class='op'>:</span> <span class='id identifier rubyid_value'>value</span>
|
238
|
+
<span class='kw'>end</span></pre>
|
239
|
+
</td>
|
240
|
+
</tr>
|
241
|
+
</table>
|
242
|
+
</div>
|
243
|
+
|
244
|
+
</div>
|
245
|
+
|
246
|
+
</div>
|
247
|
+
|
248
|
+
<div id="footer">
|
249
|
+
Generated on Tue Sep 27 10:47:06 2016 by
|
250
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
251
|
+
0.8.7.4 (ruby-2.0.0).
|
252
|
+
</div>
|
253
|
+
|
254
|
+
</body>
|
255
|
+
</html>
|
@@ -0,0 +1,350 @@
|
|
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::DefaultHTTPClient
|
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/DefaultHTTPClient.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 (D)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Prismic.html" title="Prismic (module)">Prismic</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">DefaultHTTPClient</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::DefaultHTTPClient
|
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</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
<p>Default HTTP client implementation, using the standard Net::HTTP library.</p>
|
90
|
+
|
91
|
+
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<div class="tags">
|
95
|
+
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<h2>
|
106
|
+
Class Method Summary
|
107
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
108
|
+
</h2>
|
109
|
+
|
110
|
+
<ul class="summary">
|
111
|
+
|
112
|
+
<li class="public ">
|
113
|
+
<span class="summary_signature">
|
114
|
+
|
115
|
+
<a href="#get-class_method" title="get (class method)">+ (Object) <strong>get</strong>(uri, data = {}, headers = {}) </a>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
</span>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<span class="summary_desc"><div class='inline'><p>Performs a GET call and returns the result.</p>
|
130
|
+
</div></span>
|
131
|
+
|
132
|
+
</li>
|
133
|
+
|
134
|
+
|
135
|
+
<li class="public ">
|
136
|
+
<span class="summary_signature">
|
137
|
+
|
138
|
+
<a href="#post-class_method" title="post (class method)">+ (Object) <strong>post</strong>(uri, data = {}, headers = {}) </a>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
</span>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<span class="summary_desc"><div class='inline'><p>Performs a POST call and returns the result.</p>
|
153
|
+
</div></span>
|
154
|
+
|
155
|
+
</li>
|
156
|
+
|
157
|
+
|
158
|
+
<li class="public ">
|
159
|
+
<span class="summary_signature">
|
160
|
+
|
161
|
+
<a href="#url_encode-class_method" title="url_encode (class method)">+ (Object) <strong>url_encode</strong>(data) </a>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
</span>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
176
|
+
|
177
|
+
</li>
|
178
|
+
|
179
|
+
|
180
|
+
</ul>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
<div id="class_method_details" class="method_details_list">
|
186
|
+
<h2>Class Method Details</h2>
|
187
|
+
|
188
|
+
|
189
|
+
<div class="method_details first">
|
190
|
+
<h3 class="signature first" id="get-class_method">
|
191
|
+
|
192
|
+
+ (<tt>Object</tt>) <strong>get</strong>(uri, data = {}, headers = {})
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
|
198
|
+
</h3><div class="docstring">
|
199
|
+
<div class="discussion">
|
200
|
+
<p>Performs a GET call and returns the result</p>
|
201
|
+
|
202
|
+
<p>The result must respond to
|
203
|
+
- code: returns the response's HTTP status code (as number or String)
|
204
|
+
- body: returns the response's body (as String)</p>
|
205
|
+
|
206
|
+
|
207
|
+
</div>
|
208
|
+
</div>
|
209
|
+
<div class="tags">
|
210
|
+
|
211
|
+
|
212
|
+
</div><table class="source_code">
|
213
|
+
<tr>
|
214
|
+
<td>
|
215
|
+
<pre class="lines">
|
216
|
+
|
217
|
+
|
218
|
+
563
|
219
|
+
564
|
220
|
+
565
|
221
|
+
566
|
222
|
+
567
|
223
|
+
568
|
224
|
+
569</pre>
|
225
|
+
</td>
|
226
|
+
<td>
|
227
|
+
<pre class="code"><span class="info file"># File 'lib/prismic.rb', line 563</span>
|
228
|
+
|
229
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
230
|
+
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_uri'>uri</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>
|
231
|
+
<span class='id identifier rubyid_add_query'>add_query</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
232
|
+
<span class='id identifier rubyid_http'>http</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
|
233
|
+
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_use_ssl'>use_ssl</span> <span class='op'>=</span> <span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_scheme'>scheme</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>https</span><span class='regexp_end'>/i</span></span>
|
234
|
+
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_request_uri'>request_uri</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
235
|
+
<span class='kw'>end</span></pre>
|
236
|
+
</td>
|
237
|
+
</tr>
|
238
|
+
</table>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
<div class="method_details ">
|
242
|
+
<h3 class="signature " id="post-class_method">
|
243
|
+
|
244
|
+
+ (<tt>Object</tt>) <strong>post</strong>(uri, data = {}, headers = {})
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
</h3><div class="docstring">
|
251
|
+
<div class="discussion">
|
252
|
+
<p>Performs a POST call and returns the result</p>
|
253
|
+
|
254
|
+
<p>The result must respond to
|
255
|
+
- code: returns the response's HTTP status code (as number or String)
|
256
|
+
- body: returns the response's body (as String)</p>
|
257
|
+
|
258
|
+
|
259
|
+
</div>
|
260
|
+
</div>
|
261
|
+
<div class="tags">
|
262
|
+
|
263
|
+
|
264
|
+
</div><table class="source_code">
|
265
|
+
<tr>
|
266
|
+
<td>
|
267
|
+
<pre class="lines">
|
268
|
+
|
269
|
+
|
270
|
+
576
|
271
|
+
577
|
272
|
+
578
|
273
|
+
579
|
274
|
+
580
|
275
|
+
581
|
276
|
+
582</pre>
|
277
|
+
</td>
|
278
|
+
<td>
|
279
|
+
<pre class="code"><span class="info file"># File 'lib/prismic.rb', line 576</span>
|
280
|
+
|
281
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='op'>=</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
282
|
+
<span class='id identifier rubyid_uri'>uri</span> <span class='op'>=</span> <span class='const'>URI</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='id identifier rubyid_uri'>uri</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>
|
283
|
+
<span class='id identifier rubyid_add_query'>add_query</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
284
|
+
<span class='id identifier rubyid_http'>http</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_host'>host</span><span class='comma'>,</span> <span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_port'>port</span><span class='rparen'>)</span>
|
285
|
+
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_use_ssl'>use_ssl</span> <span class='op'>=</span> <span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_scheme'>scheme</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>https</span><span class='regexp_end'>/i</span></span>
|
286
|
+
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_post'>post</span><span class='lparen'>(</span><span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_uri'>uri</span><span class='period'>.</span><span class='id identifier rubyid_query'>query</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
287
|
+
<span class='kw'>end</span></pre>
|
288
|
+
</td>
|
289
|
+
</tr>
|
290
|
+
</table>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
<div class="method_details ">
|
294
|
+
<h3 class="signature " id="url_encode-class_method">
|
295
|
+
|
296
|
+
+ (<tt>Object</tt>) <strong>url_encode</strong>(data)
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
</h3><table class="source_code">
|
303
|
+
<tr>
|
304
|
+
<td>
|
305
|
+
<pre class="lines">
|
306
|
+
|
307
|
+
|
308
|
+
584
|
309
|
+
585
|
310
|
+
586
|
311
|
+
587
|
312
|
+
588
|
313
|
+
589
|
314
|
+
590
|
315
|
+
591
|
316
|
+
592
|
317
|
+
593
|
318
|
+
594</pre>
|
319
|
+
</td>
|
320
|
+
<td>
|
321
|
+
<pre class="code"><span class="info file"># File 'lib/prismic.rb', line 584</span>
|
322
|
+
|
323
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_url_encode'>url_encode</span><span class='lparen'>(</span><span class='id identifier rubyid_data'>data</span><span class='rparen'>)</span>
|
324
|
+
<span class='comment'># Can't use URI.encode_www_form (doesn't support multi-values in 1.9.2)
|
325
|
+
</span> <span class='id identifier rubyid_encode'>encode</span> <span class='op'>=</span> <span class='tlambda'>-></span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span><span class='tlambeg'>{</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_k'>k</span><span class='embexpr_end'>}</span><span class='tstring_content'>=</span><span class='embexpr_beg'>#{</span><span class='const'>CGI</span><span class='op'>::</span><span class='id identifier rubyid_escape'>escape</span><span class='lparen'>(</span><span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='rbrace'>}</span>
|
326
|
+
<span class='id identifier rubyid_data'>data</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_vs'>vs</span><span class='op'>|</span>
|
327
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_vs'>vs</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span>
|
328
|
+
<span class='id identifier rubyid_vs'>vs</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_encode'>encode</span><span class='period'>.</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>&</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
329
|
+
<span class='kw'>else</span>
|
330
|
+
<span class='id identifier rubyid_encode'>encode</span><span class='period'>.</span><span class='lparen'>(</span><span class='id identifier rubyid_k'>k</span><span class='comma'>,</span> <span class='id identifier rubyid_vs'>vs</span><span class='rparen'>)</span>
|
331
|
+
<span class='kw'>end</span>
|
332
|
+
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>&</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
333
|
+
<span class='kw'>end</span></pre>
|
334
|
+
</td>
|
335
|
+
</tr>
|
336
|
+
</table>
|
337
|
+
</div>
|
338
|
+
|
339
|
+
</div>
|
340
|
+
|
341
|
+
</div>
|
342
|
+
|
343
|
+
<div id="footer">
|
344
|
+
Generated on Tue Sep 27 10:47:05 2016 by
|
345
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
346
|
+
0.8.7.4 (ruby-2.0.0).
|
347
|
+
</div>
|
348
|
+
|
349
|
+
</body>
|
350
|
+
</html>
|