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,112 @@
|
|
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
|
+
Top Level Namespace
|
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#!top-level-namespace.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</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Top Level Namespace</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>Top Level Namespace
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
</dl>
|
82
|
+
<div class="clear"></div>
|
83
|
+
|
84
|
+
<h2>Defined Under Namespace</h2>
|
85
|
+
<p class="children">
|
86
|
+
|
87
|
+
|
88
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Prismic.html" title="Prismic (module)">Prismic</a></span>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
</p>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
</div>
|
104
|
+
|
105
|
+
<div id="footer">
|
106
|
+
Generated on Tue Sep 27 10:47:05 2016 by
|
107
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
108
|
+
0.8.7.4 (ruby-2.0.0).
|
109
|
+
</div>
|
110
|
+
|
111
|
+
</body>
|
112
|
+
</html>
|
data/lib/prismic.rb
CHANGED
@@ -450,16 +450,32 @@ module Prismic
|
|
450
450
|
attr_accessor :tags
|
451
451
|
# @return [Array<String>]
|
452
452
|
attr_accessor :slugs
|
453
|
+
# @return Time
|
454
|
+
attr_accessor :first_publication_date
|
455
|
+
# @return Time
|
456
|
+
attr_accessor :last_publication_date
|
453
457
|
# @return [Array<Fragment>]
|
454
458
|
attr_accessor :fragments
|
455
459
|
|
456
|
-
def initialize(
|
460
|
+
def initialize(
|
461
|
+
id,
|
462
|
+
uid,
|
463
|
+
type,
|
464
|
+
href,
|
465
|
+
tags,
|
466
|
+
slugs,
|
467
|
+
first_publication_date,
|
468
|
+
last_publication_date,
|
469
|
+
fragments
|
470
|
+
)
|
457
471
|
@id = id
|
458
472
|
@uid = uid
|
459
473
|
@type = type
|
460
474
|
@href = href
|
461
475
|
@tags = tags
|
462
476
|
@slugs = slugs
|
477
|
+
@first_publication_date = first_publication_date
|
478
|
+
@last_publication_date = last_publication_date
|
463
479
|
@fragments = fragments
|
464
480
|
end
|
465
481
|
|
data/lib/prismic/api.rb
CHANGED
@@ -85,42 +85,54 @@ module Prismic
|
|
85
85
|
|
86
86
|
# Perform a query on this API. Use the master reference is no ref is specified in data.
|
87
87
|
# @param q [String] the query to perform
|
88
|
-
# @param
|
89
|
-
def query(q,
|
90
|
-
ref =
|
91
|
-
form('everything',
|
88
|
+
# @param opts [Hash] query options (page, pageSize, ref, etc.)
|
89
|
+
def query(q, opts={})
|
90
|
+
ref = opts['ref'] || opts[:ref] || self.master.ref
|
91
|
+
form('everything', opts).query(q).submit(ref)
|
92
92
|
end
|
93
93
|
|
94
94
|
# Retrieve all documents (paginated)
|
95
|
-
# @param
|
96
|
-
def all(
|
97
|
-
ref =
|
98
|
-
form('everything',
|
95
|
+
# @param opts [Hash] query options (page, pageSize, ref, etc.)
|
96
|
+
def all(opts={})
|
97
|
+
ref = opts['ref'] || opts[:ref] || self.master.ref
|
98
|
+
form('everything', opts).submit(ref)
|
99
99
|
end
|
100
100
|
|
101
101
|
# Retrieve one document by its id
|
102
|
-
# @param
|
103
|
-
# @param
|
102
|
+
# @param id [String] the id to search
|
103
|
+
# @param opts [Hash] query options (page, pageSize, ref, etc.)
|
104
104
|
# @return the document, or nil if not found
|
105
|
-
def
|
106
|
-
query(Prismic::Predicates::at('document.id', id),
|
105
|
+
def get_by_id(id, opts={})
|
106
|
+
query(Prismic::Predicates::at('document.id', id), opts)[0]
|
107
107
|
end
|
108
|
+
alias :getByID :get_by_id
|
108
109
|
|
109
110
|
# Retrieve one document by its uid
|
110
|
-
# @param
|
111
|
-
# @param
|
111
|
+
# @param uid [String] the uid to search
|
112
|
+
# @param opts [Hash] query options (ref, etc.)
|
112
113
|
# @return the document, or nil if not found
|
113
|
-
def
|
114
|
-
query(Prismic::Predicates::at('my.'+typ+'.uid', uid),
|
114
|
+
def get_by_uid(typ, uid, opts={})
|
115
|
+
query(Prismic::Predicates::at('my.'+typ+'.uid', uid), opts)[0]
|
115
116
|
end
|
117
|
+
alias :getByUID :get_by_uid
|
116
118
|
|
117
119
|
# Retrieve multiple documents by their ids
|
120
|
+
# @param ids [String] the ids to fetch
|
121
|
+
# @param opts [Hash] query options (page, pageSize, ref, etc.)
|
122
|
+
# @return the document, or nil if not found
|
123
|
+
def get_by_ids(ids, opts={})
|
124
|
+
query(Prismic::Predicates::in('document.id', ids), opts)
|
125
|
+
end
|
126
|
+
alias :getByIDs :get_by_ids
|
127
|
+
|
128
|
+
# Retrieve one single typed document by its type
|
118
129
|
# @param q [String] the query to perform
|
119
|
-
# @param
|
130
|
+
# @param opts [Hash] query options (ref, etc.)
|
120
131
|
# @return the document, or nil if not found
|
121
|
-
def
|
122
|
-
query(Prismic::Predicates::
|
132
|
+
def get_single(typ, opts={})
|
133
|
+
query(Prismic::Predicates::at('document.type', typ), opts)[0]
|
123
134
|
end
|
135
|
+
alias :getSingle :get_single
|
124
136
|
|
125
137
|
# Return the URL to display a given preview
|
126
138
|
# @param token [String] as received from Prismic server to identify the content to preview
|
data/lib/prismic/json_parsers.rb
CHANGED
@@ -245,6 +245,8 @@ module Prismic
|
|
245
245
|
json['href'],
|
246
246
|
json['tags'],
|
247
247
|
json['slugs'].map { |slug| URI.unescape(slug) },
|
248
|
+
json['first_publication_date'] && Time.parse(json['first_publication_date']),
|
249
|
+
json['last_publication_date'] && Time.parse(json['last_publication_date']),
|
248
250
|
fragments)
|
249
251
|
end
|
250
252
|
|
data/lib/prismic/version.rb
CHANGED
data/spec/cache_spec.rb
CHANGED
@@ -5,9 +5,9 @@ describe "Cache's" do
|
|
5
5
|
|
6
6
|
describe 'on/off switch' do
|
7
7
|
before do
|
8
|
-
@api = Prismic.api("https://
|
8
|
+
@api = Prismic.api("https://micro.prismic.io/api", cache: Prismic::LruCache.new(3))
|
9
9
|
@cache = @api.cache
|
10
|
-
@master_ref = @api.
|
10
|
+
@master_ref = @api.master
|
11
11
|
end
|
12
12
|
|
13
13
|
it "is properly on" do
|
@@ -16,14 +16,14 @@ describe "Cache's" do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "is properly off" do
|
19
|
-
api = Prismic.api("https://
|
19
|
+
api = Prismic.api("https://micro.prismic.io/api", cache: nil)
|
20
20
|
api.has_cache?.should == false
|
21
21
|
end
|
22
22
|
|
23
23
|
describe 'storage and retrieval' do
|
24
24
|
it 'stores properly' do
|
25
25
|
@cache.intern.size.should == 0
|
26
|
-
@api.form('
|
26
|
+
@api.form('arguments').submit(@master_ref)
|
27
27
|
@cache.intern.size.should == 1
|
28
28
|
end
|
29
29
|
|
@@ -59,14 +59,14 @@ describe "Cache's" do
|
|
59
59
|
|
60
60
|
describe 'caching on a real repository' do
|
61
61
|
before do
|
62
|
-
@api = Prismic.api("https://
|
62
|
+
@api = Prismic.api("https://micro.prismic.io/api", access_token: 'MC5VcXBHWHdFQUFONDZrbWp4.77-9cDx6C3lgJu-_vXZafO-_vXPvv73vv73vv70777-9Ju-_ve-_vSLvv73vv73vv73vv70O77-977-9Me-_vQ')
|
63
63
|
@cache = @api.cache
|
64
64
|
@master_ref = @api.master_ref
|
65
|
-
@other_ref = @api.refs['
|
65
|
+
@other_ref = @api.refs['adding jason']
|
66
66
|
end
|
67
67
|
it 'works on different refs' do
|
68
|
-
@api.form('everything').submit(@master_ref).total_results_size.should ==
|
69
|
-
@api.form('everything').submit(@other_ref).total_results_size.should ==
|
68
|
+
@api.form('everything').submit(@master_ref).total_results_size.should == 20
|
69
|
+
@api.form('everything').submit(@other_ref).total_results_size.should == 21
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
@@ -74,12 +74,12 @@ describe "Cache's" do
|
|
74
74
|
describe 'configurable api cache' do
|
75
75
|
let(:api_cache) { Prismic::BasicNullCache.new }
|
76
76
|
it 'uses api_cache if provided' do
|
77
|
-
expect(api_cache).to receive(:get_or_set).with("https://
|
78
|
-
Prismic.api("https://
|
77
|
+
expect(api_cache).to receive(:get_or_set).with("https://micro.prismic.io/api", nil, 5).and_call_original.once
|
78
|
+
Prismic.api("https://micro.prismic.io/api", api_cache: api_cache)
|
79
79
|
end
|
80
80
|
it 'uses default cache if not provided' do
|
81
|
-
expect(Prismic::DefaultCache).to receive(:get_or_set).with("https://
|
82
|
-
Prismic.api("https://
|
81
|
+
expect(Prismic::DefaultCache).to receive(:get_or_set).with("https://micro.prismic.io/api", nil, 5).and_call_original.once
|
82
|
+
Prismic.api("https://micro.prismic.io/api")
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
data/spec/json_parsers_spec.rb
CHANGED
@@ -169,7 +169,7 @@ json
|
|
169
169
|
|
170
170
|
it "correctly parses Image objects" do
|
171
171
|
image = Prismic::JsonParser.image_parser(@json)
|
172
|
-
image.
|
172
|
+
image.url.should == "url1"
|
173
173
|
image.main.width.should == 500
|
174
174
|
image.main.height.should == 500
|
175
175
|
image.main.alt.should == "Alternative"
|
@@ -363,6 +363,11 @@ describe 'document_parser' do
|
|
363
363
|
@document.slugs.should == ['vanilla-macaron', '南大沢']
|
364
364
|
end
|
365
365
|
|
366
|
+
it "correctly parses the document's publication dates" do
|
367
|
+
@document.first_publication_date.should == Time.at(1476845881)
|
368
|
+
@document.last_publication_date.should == Time.at(1476846111)
|
369
|
+
end
|
370
|
+
|
366
371
|
it "correctly parses the document's fragments" do
|
367
372
|
@document.fragments.size.should == 14
|
368
373
|
@document.fragments['name'].should be_a Prismic::Fragments::StructuredText
|
@@ -377,7 +382,7 @@ describe 'response_parser' do
|
|
377
382
|
"results_size": 20,
|
378
383
|
"total_results_size": 40,
|
379
384
|
"total_pages": 2,
|
380
|
-
"next_page": "https://
|
385
|
+
"next_page": "https://micro.prismic.io/api/documents/search?ref=UkL0hcuvzYUANCrm&page=2&pageSize=20",
|
381
386
|
"prev_page": null,
|
382
387
|
"results":[]}')
|
383
388
|
@documents = Prismic::JsonParser.response_parser(@json)
|
@@ -387,7 +392,7 @@ describe 'response_parser' do
|
|
387
392
|
@documents.results_size.should == 20
|
388
393
|
@documents.total_results_size.should == 40
|
389
394
|
@documents.total_pages.should == 2
|
390
|
-
@documents.next_page.should == "https://
|
395
|
+
@documents.next_page.should == "https://micro.prismic.io/api/documents/search?ref=UkL0hcuvzYUANCrm&page=2&pageSize=20"
|
391
396
|
@documents.prev_page.should == nil
|
392
397
|
end
|
393
398
|
|
@@ -459,7 +464,7 @@ describe 'structured_text_label_parser' do
|
|
459
464
|
link_resolver = Prismic.link_resolver("master"){|doc_link| "http://localhost/#{doc_link.id}" }
|
460
465
|
@structured_text.as_html(link_resolver).should ==
|
461
466
|
"<h1>Tips to dress a pastry</h1>\n\n" +
|
462
|
-
"<p class=\"block-img\"><img src=\"https://prismic-io.s3.amazonaws.com/
|
467
|
+
"<p class=\"block-img\"><img src=\"https://prismic-io.s3.amazonaws.com/micro-vcerzcwaaohojzo/381f3a78dfe952b229fb49ceaa9926f7009ae20a.jpg\" alt=\"\" width=\"640\" height=\"666\" /></p>\n\n" +
|
463
468
|
"<p>Our Pastry Dressers (yes, it is <a href=\"http://localhost/UlfoxUnM0wkXYXbh\">a full-time job</a> in <em>Les Bonnes Choses</em>!) have it somewhat different from our other pastry artists: while the others keep their main focus on the taste, smell, and potentially touch of your pastries, the Pastry Dressers are mainly focused on their looks.</p>\n\n" +
|
464
469
|
"<p>It sometimes makes them feem like they're doing a job that is reasonably different from plain old pastry, and to make the most of your pastry dressings, perhaps so should you!</p>\n\n" +
|
465
470
|
"<h2>Step by step</h2>\n\n" +
|
@@ -471,7 +476,7 @@ describe 'structured_text_label_parser' do
|
|
471
476
|
"<h3>Pastry Dresser, or hairdresser?</h3>\n\n" +
|
472
477
|
"<p>The top of the pastry is a priority zone for finalization. This is where your "last touch" goes, and it's tremendously important, as it gives the pastry most of its character. You will have to play with the details, to keep the top of your piece on the... top of your priorities!</p>\n\n<h2>Before starting</h2>\n\n<p>" +
|
473
478
|
"Finishing by the beginning: what did we have to consider, before running towards the aforementioned steps?</p>\n\n" +
|
474
|
-
"<p class=\"block-img\"><img src=\"https://prismic-io.s3.amazonaws.com/
|
479
|
+
"<p class=\"block-img\"><img src=\"https://prismic-io.s3.amazonaws.com/micro-vcerzcwaaohojzo/502ebb427b5eb45693800816fc778316c04935f5.jpg\" alt=\"\" width=\"640\" height=\"427\" /></p>\n\n" +
|
475
480
|
"<h3>Pastry Dresser, or illustrator?</h3>\n\n" +
|
476
481
|
"<p>We didn't mention color, but it's a very important component of the piece. Just like an illustrator will pick colors that add to the shape in a matching way to keep a perfect meaning, the colors must be perfect to be consistent with the taste of the piece (do not use green-colored sugar for a strawberry-flavored pastry, if you don't want to gross people out!)</p>\n\n" +
|
477
482
|
"<h3>Pastry Dresser, or designer?</h3>\n\n<p>And even before the illustration and colors, you really need to take the time to think about your destination, to make sure it's nothing short of perfect. This may imply taking the time to sit down for a few minutes with a paper and a pen. The first skill of an imaginative Pastry Dresser is a drawing skill, just like a fashion stylist.</p>"
|
data/spec/oauth_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe 'OAuth' do
|
|
19
19
|
|
20
20
|
describe "Public API" do
|
21
21
|
|
22
|
-
PUBLIC_URL = "https://
|
22
|
+
PUBLIC_URL = "https://micro.prismic.io/api"
|
23
23
|
|
24
24
|
it "should accept unauthenticated requests" do
|
25
25
|
expect {
|
@@ -32,7 +32,7 @@ describe 'OAuth' do
|
|
32
32
|
it "should returns the URL" do
|
33
33
|
url = Prismic::API.oauth_initiate_url(PUBLIC_URL, OAUTH_INITIATE_OPTS)
|
34
34
|
expected_url = [
|
35
|
-
"https://
|
35
|
+
"https://micro.prismic.io/auth?client_id=client_id",
|
36
36
|
"redirect_uri=http%3A%2F%2Fmyapp.com%2Fcallback",
|
37
37
|
"scope=master%2Breleases",
|
38
38
|
].join("&")
|
@@ -42,7 +42,7 @@ describe 'OAuth' do
|
|
42
42
|
it "should returns the URL (with access_token)" do
|
43
43
|
url = Prismic.oauth_initiate_url(PUBLIC_URL, OAUTH_INITIATE_OPTS, "token")
|
44
44
|
expected_url = [
|
45
|
-
"https://
|
45
|
+
"https://micro.prismic.io/auth?client_id=client_id",
|
46
46
|
"redirect_uri=http%3A%2F%2Fmyapp.com%2Fcallback",
|
47
47
|
"scope=master%2Breleases",
|
48
48
|
].join("&")
|
data/spec/prismic_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
describe 'Api' do
|
5
5
|
before do
|
6
6
|
json_representation = '{"foo": "bar"}'
|
7
|
-
@oauth_initiate_url = 'https://
|
7
|
+
@oauth_initiate_url = 'https://micro.prismic.io/auth'
|
8
8
|
@api = Prismic::API.new(json_representation, nil, Prismic::DefaultHTTPClient, false){|api|
|
9
9
|
api.bookmarks = {}
|
10
10
|
api.tags = {}
|
@@ -24,7 +24,7 @@ describe 'Api' do
|
|
24
24
|
'form3' => Prismic::Form.new(@api, 'form3', {}, nil, nil, nil, nil),
|
25
25
|
'form4' => Prismic::Form.new(@api, 'form4', {}, nil, nil, nil, nil),
|
26
26
|
}
|
27
|
-
api.oauth = Prismic::API::OAuth.new(@oauth_initiate_url, 'https://
|
27
|
+
api.oauth = Prismic::API::OAuth.new(@oauth_initiate_url, 'https://micro.prismic.io/auth/token', Prismic::DefaultHTTPClient)
|
28
28
|
}
|
29
29
|
end
|
30
30
|
|
@@ -202,7 +202,7 @@ describe 'Api' do
|
|
202
202
|
end
|
203
203
|
|
204
204
|
it "creates the right form's action" do
|
205
|
-
@parsed.forms['pies'].action.should == 'http://
|
205
|
+
@parsed.forms['pies'].action.should == 'http://micro.prismic.io/api/documents/search'
|
206
206
|
end
|
207
207
|
|
208
208
|
it 'creates forms with the right fields' do
|
@@ -249,7 +249,7 @@ describe 'Api' do
|
|
249
249
|
@scope = 'none'
|
250
250
|
end
|
251
251
|
def oauth_initiate_url
|
252
|
-
Prismic.oauth_initiate_url('https://
|
252
|
+
Prismic.oauth_initiate_url('https://micro.prismic.io/api', {
|
253
253
|
client_id: @client_id,
|
254
254
|
redirect_uri: @redirect_uri,
|
255
255
|
scope: @scope
|
@@ -259,7 +259,7 @@ describe 'Api' do
|
|
259
259
|
CGI.escape(@redirect_uri)
|
260
260
|
end
|
261
261
|
it 'build a valid url' do
|
262
|
-
oauth_initiate_url.should == "https://
|
262
|
+
oauth_initiate_url.should == "https://micro.prismic.io/auth?client_id=#@client_id&redirect_uri=#{redirect_uri_encoded}&scope=#@scope"
|
263
263
|
end
|
264
264
|
end
|
265
265
|
|
@@ -268,7 +268,7 @@ end
|
|
268
268
|
describe 'LinkResolver' do
|
269
269
|
before do
|
270
270
|
@doc_link = Prismic::Fragments::DocumentLink.new('id', nil, 'blog-post', ['tag1', 'tag2'], 'my-slug', {}, false)
|
271
|
-
@document = Prismic::Document.new('id', nil, 'blog-post', nil, ['tag1', 'tag2'], ['my-slug', 'my-other-slug'], nil)
|
271
|
+
@document = Prismic::Document.new('id', nil, 'blog-post', nil, ['tag1', 'tag2'], ['my-slug', 'my-other-slug'], nil, nil, nil)
|
272
272
|
|
273
273
|
@link_resolver = Prismic::LinkResolver.new(nil) do |doc|
|
274
274
|
'/'+doc.type+'/'+doc.id+'/'+doc.slug
|
@@ -290,7 +290,7 @@ describe 'Document' do
|
|
290
290
|
'field1' => Prismic::Fragments::DocumentLink.new(nil, nil, nil, nil, nil, {}, nil),
|
291
291
|
'field2' => Prismic::Fragments::WebLink.new('weburl')
|
292
292
|
}
|
293
|
-
@document = Prismic::Document.new(nil, nil, nil, nil, nil, ['my-slug'], fragments)
|
293
|
+
@document = Prismic::Document.new(nil, nil, nil, nil, nil, ['my-slug'], nil, nil, fragments)
|
294
294
|
@link_resolver = Prismic::LinkResolver.new('master'){|doc_link|
|
295
295
|
"http://host/#{doc_link.id}"
|
296
296
|
}
|