prismic.io 1.0.0.rc8 → 1.0.0.rc9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prismic/api.rb +1 -1
- data/lib/prismic/cache/basic.rb +1 -1
- data/lib/prismic/json_parsers.rb +1 -1
- data/lib/prismic/version.rb +1 -1
- data/lib/prismic.rb +3 -2
- data/spec/cache_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efe6723ef7f29deff32c702fed5695aba28e93f6
|
4
|
+
data.tar.gz: a2a470960e7065d31ea4f416d07a738bdf3d467f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c234357c7f80ee100af6471632a5b8defa792ab7dd3def6db15442a0b3a115b0a8c38864f87e37ce755c7516f99e114db0fccb91ed2d1e592b70a7ea8ef655
|
7
|
+
data.tar.gz: 0b4d361e0a79ea6d86795133b16499e6e8c8a844e40be2f681be66269b2ee4c5518971e054bb7c820d029d5bfc0613211ca5db40538f7ebe350ab381398db9a4
|
data/lib/prismic/api.rb
CHANGED
@@ -92,7 +92,7 @@ module Prismic
|
|
92
92
|
data = {}
|
93
93
|
data["access_token"] = access_token if access_token
|
94
94
|
cache_key = url + (access_token ? ("#" + access_token) : "")
|
95
|
-
api_cache.get_or_set(cache_key,
|
95
|
+
api_cache.get_or_set(cache_key, nil, 5) {
|
96
96
|
res = http_client.get(url, data, 'Accept' => 'application/json')
|
97
97
|
case res.code
|
98
98
|
when '200'
|
data/lib/prismic/cache/basic.rb
CHANGED
data/lib/prismic/json_parsers.rb
CHANGED
@@ -202,7 +202,7 @@ module Prismic
|
|
202
202
|
linked_documents = json['linked_documents']
|
203
203
|
if linked_documents
|
204
204
|
linked_documents.map! do |linked_doc|
|
205
|
-
LinkedDocument.new(linked_doc['id'], linked_doc['type'], linked_doc['tags'])
|
205
|
+
LinkedDocument.new(linked_doc['id'], linked_doc['slug'], linked_doc['type'], linked_doc['tags'])
|
206
206
|
end
|
207
207
|
else
|
208
208
|
linked_documents = []
|
data/lib/prismic/version.rb
CHANGED
data/lib/prismic.rb
CHANGED
@@ -352,10 +352,11 @@ module Prismic
|
|
352
352
|
end
|
353
353
|
|
354
354
|
class LinkedDocument
|
355
|
-
attr_accessor :id, :type, :tags
|
355
|
+
attr_accessor :id, :slug, :type, :tags
|
356
356
|
|
357
|
-
def initialize(id, type, tags)
|
357
|
+
def initialize(id, slug, type, tags)
|
358
358
|
@id = id
|
359
|
+
@slug = slug
|
359
360
|
@type = type
|
360
361
|
@tags = tags
|
361
362
|
end
|
data/spec/cache_spec.rb
CHANGED
@@ -100,6 +100,14 @@ describe "Basic Cache's" do
|
|
100
100
|
cache.get('key').should == nil
|
101
101
|
end
|
102
102
|
|
103
|
+
it 'set with expiration and a block' do
|
104
|
+
cache = Prismic::BasicCache.new
|
105
|
+
cache.get_or_set('key', nil, 2){ 'value' }
|
106
|
+
cache.get_or_set('key', nil, 2){ 'othervalue' }.should == 'value'
|
107
|
+
sleep(3)
|
108
|
+
cache.get_or_set('key', nil, 2){ 'othervalue' }.should == 'othervalue'
|
109
|
+
end
|
110
|
+
|
103
111
|
it 'set & test value' do
|
104
112
|
cache = Prismic::BasicCache.new
|
105
113
|
cache.set('key', 'value')
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prismic.io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Étienne Vallette d'Osia"
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-06-
|
12
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|