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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 92010b57fef6774baa33c8bc5ee750ccf9956959
4
- data.tar.gz: 3c86d59c61864927b2d9e4071d8edf1da4ad8984
3
+ metadata.gz: 638c0bf2d190dd248be27c4de12bef7abf3d93ba
4
+ data.tar.gz: fc9492e8873f9a99d10b790f1f42fd1417e0c452
5
5
  SHA512:
6
- metadata.gz: d8ec2e3463462aff127aa0eba4aa799ad22217ca69959914593c9cbb299c1054b89b406d7d57df47d851073b7027155e278828640fb123c8ae96f3cb73542845
7
- data.tar.gz: 37349a7dc21a804b19f0cede0ca3fa12f2d885b4277c0d01cb5ed890d84ec144328b41f181a56f54c431161ed5aed1295c32b1d5bb8f4a3054dd82bd18a67593
6
+ metadata.gz: 0ce934249d13db29217017242d1d03ddd6ad1dc86c96af0608701b12e87be4a1d81bdd91a8f9312e530d1de49378d9486d8efe065c053940ab984c5f2b56521c
7
+ data.tar.gz: d390a13bb941be5bd819afcce1d1d78cd1a60905f46a7c7e0d376905d8ca25280112ec3973d2425e526143be47055c5515baf6cc4d6dd24d34d6270222e1e648
data/.travis.yml CHANGED
@@ -1,5 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.4.1
4
+ - 2.3.4
5
+ - 2.2.7
3
6
  - 2.1.1
4
7
  - 2.1.0
5
8
  - 2.0.0
data/Gemfile.lock CHANGED
@@ -44,6 +44,3 @@ DEPENDENCIES
44
44
  rspec (~> 2.14)
45
45
  simplecov (~> 0.7)
46
46
  yajl-ruby
47
-
48
- BUNDLED WITH
49
- 1.14.6
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.body)
208
+ json = JSON.load(resp)
209
209
  parse_api_response(json, access_token, http_client, cache)
210
210
  end
211
211
 
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Prismic
3
3
 
4
- VERSION = '1.4.4'
4
+ VERSION = '1.4.5'
5
5
 
6
6
  end
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.shift
180
- "[:d = #{op}(#{q.map { |arg| serialize(arg) }.join(', ')})]"
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 * ''}]")
@@ -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
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-04-10 00:00:00.000000000 Z
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.5.1
254
+ rubygems_version: 2.2.2
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: Prismic.io development kit