prismic.io 1.4.4 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile.lock +0 -3
- data/lib/prismic/api.rb +2 -2
- data/lib/prismic/version.rb +1 -1
- data/lib/prismic.rb +4 -2
- data/spec/predicates_spec.rb +7 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 638c0bf2d190dd248be27c4de12bef7abf3d93ba
|
4
|
+
data.tar.gz: fc9492e8873f9a99d10b790f1f42fd1417e0c452
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ce934249d13db29217017242d1d03ddd6ad1dc86c96af0608701b12e87be4a1d81bdd91a8f9312e530d1de49378d9486d8efe065c053940ab984c5f2b56521c
|
7
|
+
data.tar.gz: d390a13bb941be5bd819afcce1d1d78cd1a60905f46a7c7e0d376905d8ca25280112ec3973d2425e526143be47055c5515baf6cc4d6dd24d34d6270222e1e648
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/lib/prismic/api.rb
CHANGED
@@ -178,7 +178,7 @@ module Prismic
|
|
178
178
|
res = http_client.get(url, data, 'Accept' => 'application/json')
|
179
179
|
case res.code
|
180
180
|
when '200'
|
181
|
-
res
|
181
|
+
res.body
|
182
182
|
when '401', '403'
|
183
183
|
begin
|
184
184
|
json = JSON.load(res.body)
|
@@ -205,7 +205,7 @@ module Prismic
|
|
205
205
|
cache = opts.has_key?(:cache) ? opts[:cache] : Prismic::DefaultCache
|
206
206
|
|
207
207
|
resp = get(url, access_token, http_client, api_cache)
|
208
|
-
json = JSON.load(resp
|
208
|
+
json = JSON.load(resp)
|
209
209
|
parse_api_response(json, access_token, http_client, cache)
|
210
210
|
end
|
211
211
|
|
data/lib/prismic/version.rb
CHANGED
data/lib/prismic.rb
CHANGED
@@ -52,6 +52,7 @@ module Prismic
|
|
52
52
|
# @param [Hash] opts The options
|
53
53
|
# @option opts [String] :access_token (nil) The access_token
|
54
54
|
# @option opts :http_client (DefaultHTTPClient) The HTTP client to use
|
55
|
+
# @option opts :api_cache (nil) The caching object for the /api endpoint cache (for instance Prismic::Cache) to use
|
55
56
|
# @option opts :cache (nil) The caching object (for instance Prismic::Cache) to use, or false for no caching
|
56
57
|
# @overload api(url, access_token)
|
57
58
|
# Provide the access_token (only)
|
@@ -176,8 +177,9 @@ module Prismic
|
|
176
177
|
end
|
177
178
|
predicates = query.map { |predicate|
|
178
179
|
predicate.map { |q|
|
179
|
-
op = q
|
180
|
-
|
180
|
+
op = q[0]
|
181
|
+
rest = q[1..-1]
|
182
|
+
"[:d = #{op}(#{rest.map { |arg| serialize(arg) }.join(', ')})]"
|
181
183
|
}.join('')
|
182
184
|
}
|
183
185
|
set('q', "[#{predicates * ''}]")
|
data/spec/predicates_spec.rb
CHANGED
@@ -19,6 +19,13 @@ describe 'predicates' do
|
|
19
19
|
form = @api.form('everything').query(Predicates.at('document.id', 'UrjI1gEAALOCeO5i'))
|
20
20
|
form.data['q'].should == ['[[:d = at(document.id, "UrjI1gEAALOCeO5i")]]']
|
21
21
|
end
|
22
|
+
it 'allows to reuse predicates', focus: true do
|
23
|
+
predicate = Predicates.at('document.id', 'UrjI1gEAALOCeO5i')
|
24
|
+
form = @api.form('everything').query(predicate)
|
25
|
+
form.data['q'].should == ['[[:d = at(document.id, "UrjI1gEAALOCeO5i")]]']
|
26
|
+
form2 = @api.form('everything').query(predicate)
|
27
|
+
form2.data['q'].should == ['[[:d = at(document.id, "UrjI1gEAALOCeO5i")]]']
|
28
|
+
end
|
22
29
|
end
|
23
30
|
|
24
31
|
describe 'not predicate' do
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prismic.io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Étienne Vallette d'Osia
|
7
|
+
- "Étienne Vallette d'Osia"
|
8
8
|
- Erwan Loisant
|
9
9
|
- Samy Dindane
|
10
10
|
- Rudy Rigot
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
251
|
version: '0'
|
252
252
|
requirements: []
|
253
253
|
rubyforge_project:
|
254
|
-
rubygems_version: 2.
|
254
|
+
rubygems_version: 2.2.2
|
255
255
|
signing_key:
|
256
256
|
specification_version: 4
|
257
257
|
summary: Prismic.io development kit
|