prismic.io 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af0cbe24e42c28896b268e59fdf8f0b197f04549
4
- data.tar.gz: da04358f02966fd3a2b6149f8a39445d03a8070c
3
+ metadata.gz: a6a021f220785431e8cddf55b8bb38d58ca1edd7
4
+ data.tar.gz: 7f490a0edd635e5396ded856e919a29a171b9295
5
5
  SHA512:
6
- metadata.gz: 6acd277f5532003856c9ac1a574d48b12a5af167123686353287ca2999afbec78a0bc6e2dc3ea988705b1514875049456de8eea360b77c24a735773228427622
7
- data.tar.gz: a89fc85d61a78e888c1609a8a6ac55cb5c02151bd84956a7f7a007dd8721cc1b58e7dbac65e304e07c7bb2d82ef47ba9bbacdf0d5450ce04ad6cb21c1811b95a
6
+ metadata.gz: 6bcdfac0f87faebe60aa22cc4e876b9349c3c7932b1528c47f41d09d725abc614614058cf4d1c6782a27b701d52fedd795d9f6a0d4cf5d928948fcf13b632001
7
+ data.tar.gz: c8926281e90555d6dff1135f5f7ffa6edcf5b98491c97b4e9f7563d9eabf623d10a0e3341055287d512e1ebda820f309a240b4d16dceade47ca8de738b195a3e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prismic.io (1.5.0)
4
+ prismic.io (1.6.0)
5
5
  hashery (~> 2.1.1)
6
6
 
7
7
  GEM
@@ -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.16.0
@@ -372,13 +372,29 @@ module Prismic
372
372
  end
373
373
 
374
374
  class Embed < Block
375
- attr_accessor :label
375
+ attr_accessor :embed, :label
376
376
 
377
377
  def initialize(embed, label)
378
378
  @embed = embed
379
379
  @label = label
380
380
  end
381
381
 
382
+ def embed_type
383
+ @embed.embed_type
384
+ end
385
+
386
+ def provider
387
+ @embed.provider
388
+ end
389
+
390
+ def url
391
+ @embed.url
392
+ end
393
+
394
+ def html
395
+ @embed.html
396
+ end
397
+
382
398
  def as_html(link_resolver, html_serializer = nil)
383
399
  custom = nil
384
400
  unless html_serializer.nil?
@@ -98,14 +98,7 @@ module Prismic
98
98
  end
99
99
 
100
100
  def embed_parser(json)
101
- oembed = json['value']['oembed']
102
- Prismic::Fragments::Embed.new(
103
- oembed['type'],
104
- oembed['provider_name'],
105
- oembed['provider_url'],
106
- oembed['html'],
107
- oembed
108
- )
101
+ embed_object_parser(json['value']['oembed'])
109
102
  end
110
103
 
111
104
  def geo_point_parser(json)
@@ -179,17 +172,13 @@ module Prismic
179
172
  )
180
173
  when 'image'
181
174
  Prismic::Fragments::StructuredText::Block::Image.new(
182
- view_parser(block),
183
- block['label']
175
+ view_parser(block),
176
+ block['label']
184
177
  )
185
178
  when 'embed'
186
- boembed = block['oembed']
187
- Prismic::Fragments::Embed.new(
188
- boembed['type'],
189
- boembed['provider_name'],
190
- boembed['provider_url'],
191
- boembed['html'],
192
- boembed
179
+ Prismic::Fragments::StructuredText::Block::Embed.new(
180
+ embed_object_parser(block['oembed']),
181
+ block['label']
193
182
  )
194
183
  else
195
184
  puts "Unknown bloc type: #{block['type']}"
@@ -339,6 +328,16 @@ module Prismic
339
328
  file_link_parser(json)
340
329
  end
341
330
  end
331
+
332
+ def embed_object_parser(json)
333
+ Prismic::Fragments::Embed.new(
334
+ json['type'],
335
+ json['provider_name'],
336
+ json['provider_url'],
337
+ json['html'],
338
+ json
339
+ )
340
+ end
342
341
  end
343
342
  end
344
343
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: utf-8
2
2
  module Prismic
3
3
 
4
- VERSION = '1.6.0'
4
+ VERSION = '1.6.1'
5
5
 
6
6
  end
@@ -11,7 +11,7 @@ describe 'micro' do
11
11
  describe 'embed block in structured text fragments' do
12
12
  it 'is of the right Embed object, and serializes well' do
13
13
  fragment = @api.form('everything').query(%w(at document.id UrjI1gEAALOCeO5i)).submit(@master_ref)[0]['article.body']
14
- fragment.blocks[4].is_a?(Prismic::Fragments::Embed).should == true
14
+ fragment.blocks[4].is_a?(Prismic::Fragments::StructuredText::Block::Embed).should == true
15
15
  fragment.as_html(@link_resolver).gsub(/[\n\r]+/, '').gsub(/ +/, ' ').gsub(/&#39;/, "'").should == %(<h2>The meta-micro mailing-list</h2><p>This is where you go to give feedback, and discuss the future of micro. <a href="https://groups.google.com/forum/?hl=en#!forum/micro-meta-framework">Subscribe to the list now</a>!</p><h2>The micro GitHub repository</h2><p>This is where you get truly active, by forking the project's source code, and making it better. Please always feel free to send us pull requests.</p><div data-oembed="" data-oembed-type="link" data-oembed-provider="object"><div data-type="object"><a href="https://github.com/rudyrigot/meta-micro"><h1>rudyrigot/meta-micro</h1><img src="https://avatars2.githubusercontent.com/u/552279?s=400"><p>The meta-micro-framework you simply need</p></a></div></div><h2>Report bugs on micro</h2><p>If you think micro isn't working properly in one of its features, <a href="https://github.com/rudyrigot/meta-micro/issues">open a new issue in the micro GitHub repository</a>.</p><h2>Ask for help</h2><p>Feel free to ask a new question <a href="http://stackoverflow.com/questions/tagged/meta-micro">on StackOverflow</a>.</p>)
16
16
  end
17
17
  end
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.6.0
4
+ version: 1.6.1
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-11-16 00:00:00.000000000 Z
14
+ date: 2017-11-28 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -252,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
252
  version: '0'
253
253
  requirements: []
254
254
  rubyforge_project:
255
- rubygems_version: 2.2.2
255
+ rubygems_version: 2.6.12
256
256
  signing_key:
257
257
  specification_version: 4
258
258
  summary: Prismic.io development kit