prismic.io 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/docs/Prismic/API/BadPrismicResponseError.html +44 -43
- data/docs/Prismic/API/OAuth.html +99 -98
- data/docs/Prismic/API/PrismicWSAuthError.html +67 -66
- data/docs/Prismic/API/PrismicWSConnectionError.html +51 -50
- data/docs/Prismic/API.html +434 -280
- data/docs/Prismic/BasicNullCache.html +49 -48
- data/docs/Prismic/DefaultHTTPClient.html +85 -79
- data/docs/Prismic/Document.html +279 -83
- data/docs/Prismic/Error.html +52 -51
- data/docs/Prismic/Experiment.html +60 -59
- data/docs/Prismic/Experiments.html +61 -60
- data/docs/Prismic/Field.html +54 -53
- data/docs/Prismic/Form.html +70 -69
- data/docs/Prismic/Fragments/Color.html +60 -59
- data/docs/Prismic/Fragments/Date.html +52 -51
- data/docs/Prismic/Fragments/DocumentLink.html +78 -76
- data/docs/Prismic/Fragments/Embed.html +60 -59
- data/docs/Prismic/Fragments/FileLink.html +58 -57
- data/docs/Prismic/Fragments/Fragment.html +49 -48
- data/docs/Prismic/Fragments/GeoPoint.html +54 -53
- data/docs/Prismic/Fragments/Group.html +65 -63
- data/docs/Prismic/Fragments/GroupDocument.html +57 -55
- data/docs/Prismic/Fragments/Image/View.html +64 -63
- data/docs/Prismic/Fragments/Image/ViewDoesNotExistException.html +44 -43
- data/docs/Prismic/Fragments/Image.html +69 -68
- data/docs/Prismic/Fragments/ImageLink.html +50 -49
- data/docs/Prismic/Fragments/Link.html +53 -52
- data/docs/Prismic/Fragments/Multiple.html +58 -57
- data/docs/Prismic/Fragments/Number.html +54 -53
- data/docs/Prismic/Fragments/Select.html +52 -51
- data/docs/Prismic/Fragments/Separator.html +54 -53
- data/docs/Prismic/Fragments/Slice.html +58 -57
- data/docs/Prismic/Fragments/SliceZone.html +54 -53
- data/docs/Prismic/Fragments/StructuredText/Block/Embed.html +52 -51
- data/docs/Prismic/Fragments/StructuredText/Block/Heading.html +52 -51
- data/docs/Prismic/Fragments/StructuredText/Block/Image.html +66 -65
- data/docs/Prismic/Fragments/StructuredText/Block/ListItem.html +52 -51
- data/docs/Prismic/Fragments/StructuredText/Block/Paragraph.html +47 -46
- data/docs/Prismic/Fragments/StructuredText/Block/Preformatted.html +47 -46
- data/docs/Prismic/Fragments/StructuredText/Block/Text.html +68 -64
- data/docs/Prismic/Fragments/StructuredText/Block.html +47 -46
- data/docs/Prismic/Fragments/StructuredText/BlockGroup.html +54 -53
- data/docs/Prismic/Fragments/StructuredText/Span/Em.html +47 -46
- data/docs/Prismic/Fragments/StructuredText/Span/Hyperlink.html +53 -52
- data/docs/Prismic/Fragments/StructuredText/Span/Label.html +52 -51
- data/docs/Prismic/Fragments/StructuredText/Span/Strong.html +47 -46
- data/docs/Prismic/Fragments/StructuredText/Span.html +52 -51
- data/docs/Prismic/Fragments/StructuredText.html +59 -58
- data/docs/Prismic/Fragments/Text.html +54 -53
- data/docs/Prismic/Fragments/Timestamp.html +52 -51
- data/docs/Prismic/Fragments/WebLink.html +50 -49
- data/docs/Prismic/Fragments.html +39 -39
- data/docs/Prismic/HtmlSerializer.html +57 -56
- data/docs/Prismic/JsonParser.html +145 -143
- data/docs/Prismic/LinkResolver.html +73 -72
- data/docs/Prismic/LruCache.html +70 -69
- data/docs/Prismic/Predicates.html +261 -209
- data/docs/Prismic/Ref.html +86 -85
- data/docs/Prismic/Response.html +75 -73
- data/docs/Prismic/SearchForm/AuthenticationException.html +44 -43
- data/docs/Prismic/SearchForm/AuthorizationException.html +44 -43
- data/docs/Prismic/SearchForm/FormSearchException.html +44 -43
- data/docs/Prismic/SearchForm/NoRefSetException.html +44 -43
- data/docs/Prismic/SearchForm/RefNotFoundException.html +44 -43
- data/docs/Prismic/SearchForm/UnsupportedFormKind.html +44 -43
- data/docs/Prismic/SearchForm.html +97 -96
- data/docs/Prismic/Variation.html +57 -56
- data/docs/Prismic/WithFragments.html +115 -113
- data/docs/Prismic.html +91 -93
- data/docs/_index.html +32 -35
- data/docs/class_list.html +24 -27
- data/docs/css/full_list.css +32 -31
- data/docs/css/style.css +244 -91
- data/docs/file.README.html +39 -74
- data/docs/file_list.html +26 -26
- data/docs/frames.html +7 -16
- data/docs/index.html +39 -74
- data/docs/js/app.js +101 -77
- data/docs/js/full_list.js +170 -132
- data/docs/method_list.html +1995 -1189
- data/docs/top-level-namespace.html +34 -36
- data/lib/prismic/api.rb +10 -1
- data/lib/prismic/fragments/link.rb +3 -2
- data/lib/prismic/json_parsers.rb +14 -0
- data/lib/prismic/version.rb +1 -1
- data/lib/prismic.rb +47 -5
- data/spec/cache_spec.rb +2 -2
- data/spec/fragments_spec.rb +8 -1
- data/spec/json_parsers_spec.rb +13 -1
- data/spec/prismic_spec.rb +14 -7
- data/spec/responses_mocks/document.json +13 -0
- data/spec/simple_search_spec.rb +9 -0
- metadata +2 -2
data/docs/file.README.html
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8
|
9
|
+
— Documentation by YARD 0.9.8
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,9 +15,8 @@
|
|
15
15
|
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
18
|
+
pathId = "README";
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!file.README.html";
|
21
20
|
</script>
|
22
21
|
|
23
22
|
|
@@ -28,40 +27,37 @@
|
|
28
27
|
|
29
28
|
</head>
|
30
29
|
<body>
|
31
|
-
<div
|
32
|
-
<
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
33
38
|
|
34
39
|
<a href="_index.html">Index</a> »
|
35
40
|
<span class="title">File: README</span>
|
36
41
|
|
37
|
-
|
38
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
42
|
</div>
|
40
43
|
|
41
|
-
|
44
|
+
<div id="search">
|
42
45
|
|
43
46
|
<a class="full_list_link" id="class_list_link"
|
44
47
|
href="class_list.html">
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</a>
|
52
|
-
|
53
|
-
<a class="full_list_link" id="file_list_link"
|
54
|
-
href="file_list.html">
|
55
|
-
File List
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
56
54
|
</a>
|
57
55
|
|
58
56
|
</div>
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
<iframe id="search_frame"></iframe>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
63
59
|
|
64
|
-
|
60
|
+
<div id="content"><div id='filecontents'><h2>Ruby development kit for prismic.io</h2>
|
65
61
|
|
66
62
|
<p><a href="http://badge.fury.io/rb/prismic.io"><img src="https://badge.fury.io/rb/prismic.io.png" alt="Gem Version"></a>
|
67
63
|
<a href="https://travis-ci.org/prismicio/ruby-kit"><img src="https://api.travis-ci.org/prismicio/ruby-kit.png" alt="Build Status"></a>
|
@@ -81,66 +77,34 @@
|
|
81
77
|
<pre class="code sh"><code class="sh">gem install prismic.io --pre
|
82
78
|
</code></pre>
|
83
79
|
|
84
|
-
<p>then add in your code
|
85
|
-
|
86
|
-
require
|
87
|
-
</code></
|
80
|
+
<p>then add in your code:</p>
|
81
|
+
|
82
|
+
<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'>prismic</span><span class='tstring_end'>'</span></span>
|
83
|
+
</code></pre>
|
88
84
|
|
89
85
|
<p>To add the gem as a dependency to your project with <a href="http://bundler.io/">Bundler</a>, you can add this line in your Gemfile:</p>
|
90
86
|
|
91
87
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>prismic.io</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>require:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>prismic</span><span class='tstring_end'>'</span></span>
|
92
88
|
</code></pre>
|
93
89
|
|
94
|
-
<h4>Get started
|
95
|
-
|
96
|
-
<p>You can find out <a href="https://developers.prismic.io/documentation/UjBaQsuvzdIHvE4D/getting-started">how to get started with prismic.io</a> on our <a href="https://developers.prismic.io/">prismic.io developer's portal</a>.</p>
|
97
|
-
|
98
|
-
<h4>Get started using the kit</h4>
|
99
|
-
|
100
|
-
<p>Also on our <a href="https://developers.prismic.io/">prismic.io developer's portal</a>, on top of our full documentation, you will:
|
101
|
-
* get a thorough introduction of <a href="https://developers.prismic.io/documentation/UjBe8bGIJ3EKtgBZ/api-documentation#kits-and-helpers">how to use prismic.io kits</a>, including this one.
|
102
|
-
* see <a href="https://developers.prismic.io/technologies/UjBh6MuvzeMJvE4m/ruby">what else is available for Ruby</a>: starter projects, examples, ...</p>
|
103
|
-
|
104
|
-
<h3>Using the kit</h3>
|
105
|
-
|
106
|
-
<h4>Kit's detailed documentation</h4>
|
107
|
-
|
108
|
-
<p>To get a detailed documentation of the Ruby kit's variables and methods, please check out the <a href="http://rubydoc.info/github/prismicio/ruby-kit/master/frames">prismic.io Ruby kit's documentation</a>.</p>
|
109
|
-
|
110
|
-
<h4>Specific Ruby kit syntax</h4>
|
111
|
-
|
112
|
-
<p>Thanks to Ruby's syntax, this kit contains some mild differences and syntastic sugar over <a href="https://developers.prismic.io/documentation/UjBe8bGIJ3EKtgBZ/api-documentation#kits-and-helpers">the "Kits and helpers" section of our API documentation</a> in general (which you should read first). They are listed here:</p>
|
90
|
+
<h4>Get started</h4>
|
113
91
|
|
114
92
|
<ul>
|
115
|
-
<li
|
116
|
-
<li
|
117
|
-
<li
|
118
|
-
<li>You don't need to pass a <code>ctx</code> object in <code>as_html()</code>, you can use the <code>Prismic.link_resolver</code> static method to build a link resolver object that takes the <code>ref</code> into account, like this: <code>@link_resolver = Prismic.link_resolver(@ref) { |doc| ... }</code>. Then you can simply go: <code>fragment.as_html(@link_resolver)</code>. Note: the Rails starter kit provides you with a helper allowing you to pass the ref each time you call the link resolver, like this: <code>fragment.as_html(link_resolver(@ref))</code>.</li>
|
119
|
-
<li>the <code>Response</code> class is fit to work with the <a href="https://github.com/amatsuda/kaminari">Kaminari</a> gem. So if you have a <code>@response</code> object in your controller, you can display a whole pagination for it in your view like this: <code><%= paginate @response %></code> (this works with any Rails 3 or 4 app with the Kaminari gem installed).</li>
|
93
|
+
<li><a href="https://prismic.io/docs">developer documentation</a></li>
|
94
|
+
<li><a href="https://prismic.io/quickstart">quickstart</a></li>
|
95
|
+
<li><a href="http://prismicio.github.io/ruby-kit/">API reference</a></li>
|
120
96
|
</ul>
|
121
97
|
|
122
|
-
<p>
|
123
|
-
|
124
|
-
<ul>
|
125
|
-
<li>A typical API object instantiation looks like this: <code>Prismic.api(url, opts)</code></li>
|
126
|
-
<li>A typical querying looks like this: <code>api.form('everything').query('[[:d = at(document.type, "product")]]').submit(@ref)</code></li>
|
127
|
-
<li>A typical fragment manipulation looks like this: <code>doc['article.image'].get_view('icon').url</code></li>
|
128
|
-
<li>A typical fragment serialization to HTML looks like this: <code>doc['article.body'].as_html(@link_resolver)</code></li>
|
129
|
-
</ul>
|
98
|
+
<p>The quickstart is not available for Ruby yet, but if you understand Javascript you can easily adapt the code.</p>
|
130
99
|
|
131
100
|
<h4>Configuring Alternative API Caches</h4>
|
132
101
|
|
133
|
-
<p>The default cache stores data in-memory, in the server. You may want to use a different cache, for example to share it between several servers (with memcached or similar). A null cache (does no caching) is also available if you need a predictible behavior for testing or VCR. To use it (or any other compliant cache), simply add <code>api_cache
|
134
|
-
to the options passed to <code>Prismic.api</code>.</p>
|
102
|
+
<p>The default cache stores data in-memory, in the server. You may want to use a different cache, for example to share it between several servers (with memcached or similar). A null cache (does no caching) is also available if you need a predictible behavior for testing or VCR. To use it (or any other compliant cache), simply add <code>api_cache: Prismic::BasicNullCache.new</code> to the options passed to <code>Prismic.api</code>.</p>
|
135
103
|
|
136
104
|
<h3>Changelog</h3>
|
137
105
|
|
138
106
|
<p>Need to see what changed, or to upgrade your kit? We keep our changelog on <a href="https://github.com/prismicio/ruby-kit/releases">this repository's "Releases" tab</a>.</p>
|
139
107
|
|
140
|
-
<h3>Contribute to the kit</h3>
|
141
|
-
|
142
|
-
<p>Contribution is open to all developer levels, read our "<a href="https://developers.prismic.io/documentation/UszOeAEAANUlwFpp/contribute-to-the-official-kits">Contribute to the official kits</a>" documentation to learn more.</p>
|
143
|
-
|
144
108
|
<h4>Install the kit locally</h4>
|
145
109
|
|
146
110
|
<p>Of course, you're going to need <a href="https://www.ruby-lang.org/en/downloads/">Ruby installed</a> on your computer, as well as <a href="http://rubygems.org/pages/download">RubyGems</a> and <a href="http://bundler.io/">Bundler</a>.</p>
|
@@ -149,7 +113,7 @@ to the options passed to <code>Prismic.api</code>.</p>
|
|
149
113
|
|
150
114
|
<h4>Test</h4>
|
151
115
|
|
152
|
-
<p>Please write tests for any bugfix or new feature, by placing your tests in the <a href="spec/">spec/</a> folder, following the <a href="http://rspec.info/">RSpec</a> syntax. Launch the tests by running <code>
|
116
|
+
<p>Please write tests for any bugfix or new feature, by placing your tests in the <a href="spec/">spec/</a> folder, following the <a href="http://rspec.info/">RSpec</a> syntax. Launch the tests by running <code>rspec</code></p>
|
153
117
|
|
154
118
|
<p>If you find existing code that is not optimally tested and wish to make it better, we really appreciate it; but you should document it on its own branch and its own pull request.</p>
|
155
119
|
|
@@ -170,11 +134,12 @@ to the options passed to <code>Prismic.api</code>.</p>
|
|
170
134
|
<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>
|
171
135
|
</div></div>
|
172
136
|
|
173
|
-
|
174
|
-
Generated on
|
137
|
+
<div id="footer">
|
138
|
+
Generated on Mon Jan 16 16:05:08 2017 by
|
175
139
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
176
|
-
0.8
|
140
|
+
0.9.8 (ruby-2.3.1).
|
177
141
|
</div>
|
178
142
|
|
143
|
+
</div>
|
179
144
|
</body>
|
180
145
|
</html>
|
data/docs/file_list.html
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
1
|
+
<!DOCTYPE html>
|
3
2
|
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<meta charset="utf-8" />
|
6
6
|
|
7
7
|
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
8
|
|
@@ -19,37 +19,37 @@
|
|
19
19
|
<base id="base_target" target="_parent" />
|
20
20
|
</head>
|
21
21
|
<body>
|
22
|
-
<script type="text/javascript" charset="utf-8">
|
23
|
-
if (window.top.frames.main) {
|
24
|
-
document.getElementById('base_target').target = 'main';
|
25
|
-
document.body.className = 'frames';
|
26
|
-
}
|
27
|
-
</script>
|
28
22
|
<div id="content">
|
29
|
-
<
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
23
|
+
<div class="fixed_header">
|
24
|
+
<h1 id="full_list_header">File List</h1>
|
25
|
+
<div id="full_list_nav">
|
26
|
+
|
27
|
+
<span><a target="_self" href="class_list.html">
|
28
|
+
Classes
|
29
|
+
</a></span>
|
30
|
+
|
31
|
+
<span><a target="_self" href="method_list.html">
|
32
|
+
Methods
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="file_list.html">
|
36
|
+
Files
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">Search: <input type="text" /></div>
|
44
42
|
</div>
|
45
|
-
<div id="search">Search: <input type="text" /></div>
|
46
43
|
|
47
44
|
<ul id="full_list" class="file">
|
48
45
|
|
49
46
|
|
50
|
-
<li
|
47
|
+
<li id="object_README" class="odd">
|
48
|
+
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
+
</li>
|
51
50
|
|
52
51
|
|
52
|
+
|
53
53
|
</ul>
|
54
54
|
</div>
|
55
55
|
</body>
|
data/docs/frames.html
CHANGED
@@ -1,26 +1,17 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
5
3
|
<head>
|
6
|
-
|
7
|
-
<title>Documentation by YARD 0.8
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Documentation by YARD 0.9.8</title>
|
8
6
|
</head>
|
9
7
|
<script type="text/javascript" charset="utf-8">
|
10
|
-
window.onload = function() {
|
11
8
|
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
12
9
|
var name = match ? match[1] : 'index.html';
|
13
10
|
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
14
|
-
|
15
|
-
'<frame name="list" src="class_list.html" />' +
|
16
|
-
'<frame name="main" src="' + escape(name) + '" />' +
|
17
|
-
'</frameset>');
|
18
|
-
}
|
11
|
+
window.top.location = name;
|
19
12
|
</script>
|
20
13
|
<noscript>
|
21
|
-
<
|
22
|
-
|
23
|
-
<frame name="main" src="index.html" />
|
24
|
-
</frameset>
|
14
|
+
<h1>Oops!</h1>
|
15
|
+
<h2>YARD requires JavaScript!</h2>
|
25
16
|
</noscript>
|
26
17
|
</html>
|
data/docs/index.html
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
<!DOCTYPE html
|
2
|
-
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
4
3
|
<head>
|
5
|
-
<meta
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
6
|
<title>
|
7
7
|
File: README
|
8
8
|
|
9
|
-
— Documentation by YARD 0.8
|
9
|
+
— Documentation by YARD 0.9.8
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -15,9 +15,8 @@
|
|
15
15
|
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
-
|
18
|
+
pathId = "README";
|
19
19
|
relpath = '';
|
20
|
-
framesUrl = "frames.html#!file.README.html";
|
21
20
|
</script>
|
22
21
|
|
23
22
|
|
@@ -28,40 +27,37 @@
|
|
28
27
|
|
29
28
|
</head>
|
30
29
|
<body>
|
31
|
-
<div
|
32
|
-
<
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
33
38
|
|
34
39
|
<a href="_index.html">Index</a> »
|
35
40
|
<span class="title">File: README</span>
|
36
41
|
|
37
|
-
|
38
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
39
42
|
</div>
|
40
43
|
|
41
|
-
|
44
|
+
<div id="search">
|
42
45
|
|
43
46
|
<a class="full_list_link" id="class_list_link"
|
44
47
|
href="class_list.html">
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
</a>
|
52
|
-
|
53
|
-
<a class="full_list_link" id="file_list_link"
|
54
|
-
href="file_list.html">
|
55
|
-
File List
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
56
54
|
</a>
|
57
55
|
|
58
56
|
</div>
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
<iframe id="search_frame"></iframe>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
63
59
|
|
64
|
-
|
60
|
+
<div id="content"><div id='filecontents'><h2>Ruby development kit for prismic.io</h2>
|
65
61
|
|
66
62
|
<p><a href="http://badge.fury.io/rb/prismic.io"><img src="https://badge.fury.io/rb/prismic.io.png" alt="Gem Version"></a>
|
67
63
|
<a href="https://travis-ci.org/prismicio/ruby-kit"><img src="https://api.travis-ci.org/prismicio/ruby-kit.png" alt="Build Status"></a>
|
@@ -81,66 +77,34 @@
|
|
81
77
|
<pre class="code sh"><code class="sh">gem install prismic.io --pre
|
82
78
|
</code></pre>
|
83
79
|
|
84
|
-
<p>then add in your code
|
85
|
-
|
86
|
-
require
|
87
|
-
</code></
|
80
|
+
<p>then add in your code:</p>
|
81
|
+
|
82
|
+
<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'>prismic</span><span class='tstring_end'>'</span></span>
|
83
|
+
</code></pre>
|
88
84
|
|
89
85
|
<p>To add the gem as a dependency to your project with <a href="http://bundler.io/">Bundler</a>, you can add this line in your Gemfile:</p>
|
90
86
|
|
91
87
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>prismic.io</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='label'>require:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>prismic</span><span class='tstring_end'>'</span></span>
|
92
88
|
</code></pre>
|
93
89
|
|
94
|
-
<h4>Get started
|
95
|
-
|
96
|
-
<p>You can find out <a href="https://developers.prismic.io/documentation/UjBaQsuvzdIHvE4D/getting-started">how to get started with prismic.io</a> on our <a href="https://developers.prismic.io/">prismic.io developer's portal</a>.</p>
|
97
|
-
|
98
|
-
<h4>Get started using the kit</h4>
|
99
|
-
|
100
|
-
<p>Also on our <a href="https://developers.prismic.io/">prismic.io developer's portal</a>, on top of our full documentation, you will:
|
101
|
-
* get a thorough introduction of <a href="https://developers.prismic.io/documentation/UjBe8bGIJ3EKtgBZ/api-documentation#kits-and-helpers">how to use prismic.io kits</a>, including this one.
|
102
|
-
* see <a href="https://developers.prismic.io/technologies/UjBh6MuvzeMJvE4m/ruby">what else is available for Ruby</a>: starter projects, examples, ...</p>
|
103
|
-
|
104
|
-
<h3>Using the kit</h3>
|
105
|
-
|
106
|
-
<h4>Kit's detailed documentation</h4>
|
107
|
-
|
108
|
-
<p>To get a detailed documentation of the Ruby kit's variables and methods, please check out the <a href="http://rubydoc.info/github/prismicio/ruby-kit/master/frames">prismic.io Ruby kit's documentation</a>.</p>
|
109
|
-
|
110
|
-
<h4>Specific Ruby kit syntax</h4>
|
111
|
-
|
112
|
-
<p>Thanks to Ruby's syntax, this kit contains some mild differences and syntastic sugar over <a href="https://developers.prismic.io/documentation/UjBe8bGIJ3EKtgBZ/api-documentation#kits-and-helpers">the "Kits and helpers" section of our API documentation</a> in general (which you should read first). They are listed here:</p>
|
90
|
+
<h4>Get started</h4>
|
113
91
|
|
114
92
|
<ul>
|
115
|
-
<li
|
116
|
-
<li
|
117
|
-
<li
|
118
|
-
<li>You don't need to pass a <code>ctx</code> object in <code>as_html()</code>, you can use the <code>Prismic.link_resolver</code> static method to build a link resolver object that takes the <code>ref</code> into account, like this: <code>@link_resolver = Prismic.link_resolver(@ref) { |doc| ... }</code>. Then you can simply go: <code>fragment.as_html(@link_resolver)</code>. Note: the Rails starter kit provides you with a helper allowing you to pass the ref each time you call the link resolver, like this: <code>fragment.as_html(link_resolver(@ref))</code>.</li>
|
119
|
-
<li>the <code>Response</code> class is fit to work with the <a href="https://github.com/amatsuda/kaminari">Kaminari</a> gem. So if you have a <code>@response</code> object in your controller, you can display a whole pagination for it in your view like this: <code><%= paginate @response %></code> (this works with any Rails 3 or 4 app with the Kaminari gem installed).</li>
|
93
|
+
<li><a href="https://prismic.io/docs">developer documentation</a></li>
|
94
|
+
<li><a href="https://prismic.io/quickstart">quickstart</a></li>
|
95
|
+
<li><a href="http://prismicio.github.io/ruby-kit/">API reference</a></li>
|
120
96
|
</ul>
|
121
97
|
|
122
|
-
<p>
|
123
|
-
|
124
|
-
<ul>
|
125
|
-
<li>A typical API object instantiation looks like this: <code>Prismic.api(url, opts)</code></li>
|
126
|
-
<li>A typical querying looks like this: <code>api.form('everything').query('[[:d = at(document.type, "product")]]').submit(@ref)</code></li>
|
127
|
-
<li>A typical fragment manipulation looks like this: <code>doc['article.image'].get_view('icon').url</code></li>
|
128
|
-
<li>A typical fragment serialization to HTML looks like this: <code>doc['article.body'].as_html(@link_resolver)</code></li>
|
129
|
-
</ul>
|
98
|
+
<p>The quickstart is not available for Ruby yet, but if you understand Javascript you can easily adapt the code.</p>
|
130
99
|
|
131
100
|
<h4>Configuring Alternative API Caches</h4>
|
132
101
|
|
133
|
-
<p>The default cache stores data in-memory, in the server. You may want to use a different cache, for example to share it between several servers (with memcached or similar). A null cache (does no caching) is also available if you need a predictible behavior for testing or VCR. To use it (or any other compliant cache), simply add <code>api_cache
|
134
|
-
to the options passed to <code>Prismic.api</code>.</p>
|
102
|
+
<p>The default cache stores data in-memory, in the server. You may want to use a different cache, for example to share it between several servers (with memcached or similar). A null cache (does no caching) is also available if you need a predictible behavior for testing or VCR. To use it (or any other compliant cache), simply add <code>api_cache: Prismic::BasicNullCache.new</code> to the options passed to <code>Prismic.api</code>.</p>
|
135
103
|
|
136
104
|
<h3>Changelog</h3>
|
137
105
|
|
138
106
|
<p>Need to see what changed, or to upgrade your kit? We keep our changelog on <a href="https://github.com/prismicio/ruby-kit/releases">this repository's "Releases" tab</a>.</p>
|
139
107
|
|
140
|
-
<h3>Contribute to the kit</h3>
|
141
|
-
|
142
|
-
<p>Contribution is open to all developer levels, read our "<a href="https://developers.prismic.io/documentation/UszOeAEAANUlwFpp/contribute-to-the-official-kits">Contribute to the official kits</a>" documentation to learn more.</p>
|
143
|
-
|
144
108
|
<h4>Install the kit locally</h4>
|
145
109
|
|
146
110
|
<p>Of course, you're going to need <a href="https://www.ruby-lang.org/en/downloads/">Ruby installed</a> on your computer, as well as <a href="http://rubygems.org/pages/download">RubyGems</a> and <a href="http://bundler.io/">Bundler</a>.</p>
|
@@ -149,7 +113,7 @@ to the options passed to <code>Prismic.api</code>.</p>
|
|
149
113
|
|
150
114
|
<h4>Test</h4>
|
151
115
|
|
152
|
-
<p>Please write tests for any bugfix or new feature, by placing your tests in the <a href="spec/">spec/</a> folder, following the <a href="http://rspec.info/">RSpec</a> syntax. Launch the tests by running <code>
|
116
|
+
<p>Please write tests for any bugfix or new feature, by placing your tests in the <a href="spec/">spec/</a> folder, following the <a href="http://rspec.info/">RSpec</a> syntax. Launch the tests by running <code>rspec</code></p>
|
153
117
|
|
154
118
|
<p>If you find existing code that is not optimally tested and wish to make it better, we really appreciate it; but you should document it on its own branch and its own pull request.</p>
|
155
119
|
|
@@ -170,11 +134,12 @@ to the options passed to <code>Prismic.api</code>.</p>
|
|
170
134
|
<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p>
|
171
135
|
</div></div>
|
172
136
|
|
173
|
-
|
174
|
-
Generated on
|
137
|
+
<div id="footer">
|
138
|
+
Generated on Mon Jan 16 16:05:08 2017 by
|
175
139
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
176
|
-
0.8
|
140
|
+
0.9.8 (ruby-2.3.1).
|
177
141
|
</div>
|
178
142
|
|
143
|
+
</div>
|
179
144
|
</body>
|
180
145
|
</html>
|