prismic.io 1.8.0 → 1.8.1

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
  SHA256:
3
- metadata.gz: 1f892385baa9ad4441d83552d88db0f1633aa97288324008e2e22dfd191b95b8
4
- data.tar.gz: 74b6efa38bcb4c81be35a39af3ce6ae40448668babc2d1070724e47efdc09226
3
+ metadata.gz: a195b1324df58d0b91d81b1dbff3e17afc26b122faa7d2722a536260b9e1a5fc
4
+ data.tar.gz: 534ff3e25a57939300ca7477c267708a82083bdfde8ebd588b6911d3689884ad
5
5
  SHA512:
6
- metadata.gz: 74bc269db0e3c96f088196b27f506f9c73109507a857e1e81e7754cddd8721425e98834df7517cd10577e539b496bfad9ff5ead09a39134fd1172c0aecd1cbab
7
- data.tar.gz: 2cb1ad33ac5befb98b6f31d674d2753f83c2992581616b9c8360f230973e44cf14e4e02023e42ff779587f10a6b587ca6f87e00f2408cabe0c9ee44bd41acad4
6
+ metadata.gz: e9b4ea41ae0a9684d4827221974a32421ac8a060ca3c82d9b9c29c5be740b8ef8b458aa3799c71cb37fd7a517ce67a8cec025de42f458f6c96586850f3156946
7
+ data.tar.gz: f370301b34679faa236c6491301ec080e0a079171ff4ef3d398c086bbe27ec442ccd7470cee36445287df9df09fad314936b7a1918225a9e7113128bc56ad01b
data/.travis.yml CHANGED
@@ -1,26 +1,18 @@
1
1
  language: ruby
2
2
  rvm:
3
- #- ruby-head
4
- - 2.6.3
5
- - 2.5.5
6
- - 2.4.6
3
+ - 2.6
4
+ - 2.5
7
5
  - jruby-head
8
- - jruby-9.1.9.0
9
- #- jruby-1.7.26
10
6
 
11
7
  sudo: false
12
8
  cache: bundler
13
9
 
14
- before_install: gem install bundler:1.16.0
10
+ before_install: gem install bundler
15
11
  script: bundle exec rspec spec
16
12
 
17
13
  notifications:
18
14
  email:
19
- - evo@zenexity.com
20
-
21
- addons:
22
- code_climate:
23
- repo_token: f46a7e216896abddbc4877ce065239e8ac9f575af7a120bdaa61a42be70777e9
15
+ - sebastien@prismic.io
24
16
 
25
17
  deploy:
26
18
  provider: rubygems
data/Gemfile CHANGED
@@ -4,7 +4,6 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :test do
7
- gem "codeclimate-test-reporter", require: nil
8
7
  gem 'hashery', '~> 2.1.1'
9
8
  gem "yajl-ruby", require: 'yajl', platforms: [:ruby_19, :ruby_20, :ruby_21]
10
9
  end
data/Gemfile.lock CHANGED
@@ -1,49 +1,38 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prismic.io (1.7.0)
4
+ prismic.io (1.8.1)
5
5
  hashery (~> 2.1.1)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- codeclimate-test-reporter (0.4.1)
11
- simplecov (>= 0.7.1, < 1.0.0)
12
- diff-lcs (1.2.4)
13
- hashery (2.1.1)
14
- mini_portile (0.5.1)
15
- multi_json (1.8.0)
16
- nokogiri (1.6.0)
17
- mini_portile (~> 0.5.0)
18
- nokogiri (1.6.0-java)
19
- mini_portile (~> 0.5.0)
20
- rspec (2.14.1)
21
- rspec-core (~> 2.14.0)
22
- rspec-expectations (~> 2.14.0)
23
- rspec-mocks (~> 2.14.0)
24
- rspec-core (2.14.4)
25
- rspec-expectations (2.14.0)
10
+ diff-lcs (1.4.4)
11
+ hashery (2.1.2)
12
+ mini_portile2 (2.5.0)
13
+ nokogiri (1.11.1)
14
+ mini_portile2 (~> 2.5.0)
15
+ racc (~> 1.4)
16
+ racc (1.5.2)
17
+ rspec (2.99.0)
18
+ rspec-core (~> 2.99.0)
19
+ rspec-expectations (~> 2.99.0)
20
+ rspec-mocks (~> 2.99.0)
21
+ rspec-core (2.99.2)
22
+ rspec-expectations (2.99.2)
26
23
  diff-lcs (>= 1.1.3, < 2.0)
27
- rspec-mocks (2.14.2)
28
- simplecov (0.7.1)
29
- multi_json (~> 1.0)
30
- simplecov-html (~> 0.7.1)
31
- simplecov-html (0.7.1)
32
- yajl-ruby (1.3.1)
24
+ rspec-mocks (2.99.4)
25
+ yajl-ruby (1.4.1)
33
26
 
34
27
  PLATFORMS
35
- java
36
28
  ruby
37
29
 
38
30
  DEPENDENCIES
39
- bundler (~> 1.3)
40
- codeclimate-test-reporter
41
31
  hashery (~> 2.1.1)
42
32
  nokogiri (~> 1.6)
43
33
  prismic.io!
44
34
  rspec (~> 2.14)
45
- simplecov (~> 0.7)
46
35
  yajl-ruby
47
36
 
48
37
  BUNDLED WITH
49
- 1.17.2
38
+ 2.1.4
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/prismic.io.png)](http://badge.fury.io/rb/prismic.io)
4
4
  [![Build Status](https://api.travis-ci.org/prismicio/ruby-kit.png)](https://travis-ci.org/prismicio/ruby-kit)
5
- [![Code Climate](https://codeclimate.com/github/prismicio/ruby-kit/badges/gpa.svg)](https://codeclimate.com/github/prismicio/ruby-kit)
6
- [![Test Coverage](https://codeclimate.com/github/prismicio/ruby-kit/badges/coverage.svg)](https://codeclimate.com/github/prismicio/ruby-kit)
7
5
 
8
6
  ### Getting Started
9
7
 
data/lib/prismic/api.rb CHANGED
@@ -135,6 +135,19 @@ module Prismic
135
135
  end
136
136
  alias :getByIDs :get_by_ids
137
137
 
138
+ # Retrieve multiple documents by their uids
139
+ # @param typ [String] the document type's name
140
+ # @param uids [String] the uids to search
141
+ # @param opts [Hash] query options (ref, etc.)
142
+
143
+ def get_by_uids(typ, uids, opts = {})
144
+ unless opts.key?("lang")
145
+ opts["lang"] = '*'
146
+ end
147
+ query(Prismic::Predicates::in('my.'+typ+'.uid', uids), opts)
148
+ end
149
+ alias :getByUIDs :get_by_uids
150
+
138
151
  # Retrieve one single typed document by its type
139
152
  # @param typ [String] the document type's name
140
153
  # @param opts [Hash] query options (ref, etc.)
@@ -38,6 +38,10 @@ module Prismic
38
38
  @target = target
39
39
  end
40
40
 
41
+ def as_text
42
+ @url
43
+ end
44
+
41
45
  # Returns the URL of the link
42
46
  #
43
47
  # @note The link_resolver parameter is accepted but it is not used by
@@ -1,6 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'uri'
3
+ require 'cgi'
4
+ require 'time'
4
5
 
5
6
  module Prismic
6
7
  module JsonParser
@@ -57,7 +58,7 @@ module Prismic
57
58
  doc['uid'],
58
59
  type,
59
60
  doc['tags'],
60
- URI.unescape(doc['slug']),
61
+ CGI.unescape(doc['slug']),
61
62
  doc['lang'],
62
63
  fragments,
63
64
  json['value']['isBroken'],
@@ -278,7 +279,7 @@ module Prismic
278
279
  json['type'],
279
280
  json['href'],
280
281
  json['tags'],
281
- json['slugs'].map { |slug| URI.unescape(slug) },
282
+ json['slugs'].map { |slug| CGI.unescape(slug) },
282
283
  json['first_publication_date'] && Time.parse(json['first_publication_date']),
283
284
  json['last_publication_date'] && Time.parse(json['last_publication_date']),
284
285
  json['lang'],
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Prismic
3
3
 
4
- VERSION = '1.8.0'
4
+ VERSION = '1.8.1'
5
5
 
6
6
  end
data/prismic.gemspec CHANGED
@@ -18,9 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency 'bundler', '~> 1.3'
22
21
  spec.add_development_dependency 'rspec', '~> 2.14'
23
22
  spec.add_development_dependency 'nokogiri', '~> 1.6'
24
- spec.add_development_dependency 'simplecov', '~> 0.7'
25
23
  spec.add_runtime_dependency 'hashery', '~> 2.1.1'
26
24
  end
data/spec/cache_spec.rb CHANGED
@@ -41,7 +41,7 @@ describe "Cache's" do
41
41
  @cache['fake_key3'] = 3
42
42
  end
43
43
  it 'contains some keys' do
44
- @cache.include?('fake_key1').should be_true
44
+ @cache.include?('fake_key1').should be true
45
45
  end
46
46
  it 'contains all keys' do
47
47
  @cache.intern.size.should == 3
@@ -52,8 +52,8 @@ describe "Cache's" do
52
52
  it 'keeps readed keys alive' do
53
53
  @cache['fake_key1']
54
54
  @cache['fake_key4'] = 4
55
- @cache.include?('fake_key1').should be_true
56
- @cache.include?('fake_key2').should be_false
55
+ @cache.include?('fake_key1').should be true
56
+ @cache.include?('fake_key2').should be false
57
57
  end
58
58
  end
59
59
 
@@ -19,7 +19,7 @@ describe 'WebLink' do
19
19
  end
20
20
 
21
21
  it "returns a HTML element with an href attribute" do
22
- Nokogiri::XML(@web_link.as_html).child.has_attribute?('href').should be_true
22
+ Nokogiri::XML(@web_link.as_html).child.has_attribute?('href').should be true
23
23
  end
24
24
 
25
25
  it "returns a HTML element with an href attribute pointing to the url" do
@@ -31,7 +31,7 @@ describe 'WebLink' do
31
31
  end
32
32
 
33
33
  it "returns an <a> HTML element with a target attribute" do
34
- Nokogiri::XML(@target_blank.as_html).child.has_attribute?('target').should be_true
34
+ Nokogiri::XML(@target_blank.as_html).child.has_attribute?('target').should be true
35
35
  end
36
36
 
37
37
  it "returns an <a> HTML element with an target blank attribute" do
@@ -40,8 +40,8 @@ describe 'WebLink' do
40
40
  end
41
41
 
42
42
  describe 'as_text' do
43
- it 'raises an NotImplementedError' do
44
- expect { @web_link.as_text }.to raise_error NotImplementedError
43
+ it 'returns the url' do
44
+ @web_link.as_text.should == 'my_url'
45
45
  end
46
46
  end
47
47
 
@@ -88,7 +88,7 @@ describe 'ImageLink' do
88
88
  end
89
89
 
90
90
  it "returns a HTML element with an href attribute" do
91
- Nokogiri::XML(@image_link.as_html).child.has_attribute?('href').should be_true
91
+ Nokogiri::XML(@image_link.as_html).child.has_attribute?('href').should be true
92
92
  end
93
93
 
94
94
  it "returns a HTML element with an href attribute pointing to the url" do
@@ -369,11 +369,11 @@ describe 'Color' do
369
369
 
370
370
  describe 'self.valid?' do
371
371
  it "returns true if the color is valid" do
372
- Prismic::Fragments::Color.valid?(@hex_value).should be_true
372
+ Prismic::Fragments::Color.valid?(@hex_value).should be true
373
373
  end
374
374
 
375
375
  it "returns false if the color is not valid" do
376
- Prismic::Fragments::Color.valid?("I'm a murloc").should be_false
376
+ Prismic::Fragments::Color.valid?("I'm a murloc").should be false
377
377
  end
378
378
  end
379
379
  end
@@ -395,7 +395,7 @@ describe 'Embed' do
395
395
  end
396
396
 
397
397
  it "returns an element with a data-oembed attribute" do
398
- Nokogiri::XML(@embed.as_html).child.has_attribute?('data-oembed').should be_true
398
+ Nokogiri::XML(@embed.as_html).child.has_attribute?('data-oembed').should be true
399
399
  end
400
400
 
401
401
  it "returns an element with a data-oembed attribute containing the url" do
@@ -403,7 +403,7 @@ describe 'Embed' do
403
403
  end
404
404
 
405
405
  it "returns an element with a data-oembed-type attribute" do
406
- Nokogiri::XML(@embed.as_html).child.has_attribute?('data-oembed-type').should be_true
406
+ Nokogiri::XML(@embed.as_html).child.has_attribute?('data-oembed-type').should be true
407
407
  end
408
408
 
409
409
  it "returns an element with a data-oembed-type attribute containing the type in lowercase" do
@@ -411,7 +411,7 @@ describe 'Embed' do
411
411
  end
412
412
 
413
413
  it "returns an element with a data-oembed-provider attribute" do
414
- Nokogiri::XML(@embed.as_html).child.has_attribute?('data-oembed-provider').should be_true
414
+ Nokogiri::XML(@embed.as_html).child.has_attribute?('data-oembed-provider').should be true
415
415
  end
416
416
 
417
417
  it "returns an element with a data-oembed-provider attribute containing the provider in lowercase" do
data/spec/prismic_spec.rb CHANGED
@@ -118,7 +118,7 @@ describe 'Api' do
118
118
 
119
119
  describe 'master' do
120
120
  it 'returns a master Ref' do
121
- @api.master.master?.should be_true
121
+ @api.master.master?.should be true
122
122
  end
123
123
  end
124
124
 
@@ -219,11 +219,11 @@ describe 'Api' do
219
219
  end
220
220
 
221
221
  it "create fields (other than 'q') as non repeatable" do
222
- @parsed.forms['pies'].fields['ref'].repeatable.should be_false
222
+ @parsed.forms['pies'].fields['ref'].repeatable.should be false
223
223
  end
224
224
 
225
225
  it "create 'q' fields as repeatable" do
226
- @parsed.forms['pies'].fields['q'].repeatable.should be_true
226
+ @parsed.forms['pies'].fields['q'].repeatable.should be true
227
227
  end
228
228
 
229
229
  end
@@ -341,7 +341,7 @@ describe 'Document' do
341
341
  end
342
342
 
343
343
  it "returns a HTML element with a 'data-field' attribute" do
344
- Nokogiri::XML(@document.as_html(@link_resolver)).child.has_attribute?('data-field').should be_true
344
+ Nokogiri::XML(@document.as_html(@link_resolver)).child.has_attribute?('data-field').should be true
345
345
  end
346
346
 
347
347
  it "returns a HTML element with a 'data-field' attribute containing the name of the field" do
@@ -53,6 +53,15 @@ describe Prismic::API do
53
53
  end
54
54
  end
55
55
 
56
+ describe '#get_by_uids' do
57
+ it 'returns the right documents' do
58
+ docs = @api.get_by_uids('all', ['all1', 'all2'])
59
+ docs.size.should == 2
60
+ docs[0].id.should == 'WHyJqyYAAHgyXbcj'
61
+ docs[1].id.should == 'WH2PaioAALYBEgug'
62
+ end
63
+ end
64
+
56
65
  describe '#get_single' do
57
66
  it 'returns the singleton document of a type' do
58
67
  # 'single' is the type name
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,4 @@
1
1
  # encoding: utf-8
2
- require 'codeclimate-test-reporter'
3
- CodeClimate::TestReporter.start
4
-
5
2
  require 'nokogiri'
6
3
  begin
7
4
  require 'yajl/json_gem'
@@ -9,15 +6,12 @@ rescue LoadError
9
6
  # ok not a big deal
10
7
  require 'json'
11
8
  end
12
- require 'simplecov'
13
9
 
14
10
  RSpec.configure do |c|
15
11
  # Stop after the first failure
16
12
  # c.fail_fast = true
17
13
  end
18
14
 
19
- SimpleCov.start
20
-
21
15
  $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
22
16
 
23
17
  require 'prismic'
metadata CHANGED
@@ -1,32 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prismic.io
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.0
4
+ version: 1.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Étienne Vallette d'Osia
8
8
  - Erwan Loisant
9
9
  - Samy Dindane
10
10
  - Rudy Rigot
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-07-06 00:00:00.000000000 Z
14
+ date: 2021-04-09 00:00:00.000000000 Z
15
15
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: bundler
18
- requirement: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - "~>"
21
- - !ruby/object:Gem::Version
22
- version: '1.3'
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: '1.3'
30
16
  - !ruby/object:Gem::Dependency
31
17
  name: rspec
32
18
  requirement: !ruby/object:Gem::Requirement
@@ -55,20 +41,6 @@ dependencies:
55
41
  - - "~>"
56
42
  - !ruby/object:Gem::Version
57
43
  version: '1.6'
58
- - !ruby/object:Gem::Dependency
59
- name: simplecov
60
- requirement: !ruby/object:Gem::Requirement
61
- requirements:
62
- - - "~>"
63
- - !ruby/object:Gem::Version
64
- version: '0.7'
65
- type: :development
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- requirements:
69
- - - "~>"
70
- - !ruby/object:Gem::Version
71
- version: '0.7'
72
44
  - !ruby/object:Gem::Dependency
73
45
  name: hashery
74
46
  requirement: !ruby/object:Gem::Requirement
@@ -238,7 +210,7 @@ homepage: http://prismic.io
238
210
  licenses:
239
211
  - Apache-2
240
212
  metadata: {}
241
- post_install_message:
213
+ post_install_message:
242
214
  rdoc_options: []
243
215
  require_paths:
244
216
  - lib
@@ -254,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
226
  version: '0'
255
227
  requirements: []
256
228
  rubygems_version: 3.1.2
257
- signing_key:
229
+ signing_key:
258
230
  specification_version: 4
259
231
  summary: Prismic.io development kit
260
232
  test_files: