link_preview 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -103,6 +103,7 @@ describe LinkPreview do
103
103
  version: '1.0',
104
104
  provider_name: %(ogp.me),
105
105
  provider_url: 'http://ogp.me',
106
+ url: url,
106
107
  title: %(Open Graph protocol),
107
108
  description: %(The Open Graph protocol enables any web page to become a rich object in a social graph.),
108
109
  type: 'link',
@@ -179,7 +180,7 @@ describe LinkPreview do
179
180
  version: '1.0',
180
181
  provider_name: %(YouTube),
181
182
  provider_url: 'https://www.youtube.com/',
182
- url: 'http://youtube.com/watch?v=M3r2XDceM6A',
183
+ url: url,
183
184
  title: %(Amazing Nintendo Facts),
184
185
  description: %(Learn about the history of Nintendo, its gaming systems, and Mario! It's 21 amazing facts about Nintendo you may have never known. Update: As of late 2008, W...),
185
186
  type: 'video',
@@ -402,6 +403,7 @@ describe LinkPreview do
402
403
  version: '1.0',
403
404
  provider_name: %(support.apple.com),
404
405
  provider_url: 'http://support.apple.com',
406
+ url: url,
405
407
  title: %(About the security content of iOS 6.1 Software Update),
406
408
  description: %(This document describes the security content of iOS 6.1.\nFor the protection of our customers, Apple does not disclose, discuss, or confirm security issues until a full investigation has occurred and any necessary patches or releases are available. To learn more about Apple Product Security, see the Apple Product Security website.\nFor information about the Apple Product Security PGP Key, see How to use the Apple Product Security PGP Key.\nWhere possible, CVE IDs are used to reference the vulnerabilities for further information.\nTo learn about other Security Updates, see Apple Security Updates.),
407
409
  type: 'link'
@@ -469,6 +471,7 @@ describe LinkPreview do
469
471
  version: '1.0',
470
472
  provider_name: %(www.golden-gate-park.com),
471
473
  provider_url: 'http://www.golden-gate-park.com',
474
+ url: url,
472
475
  title: %(http://www.golden-gate-park.com/wp-content/uploads/2011/02/Golden_Gate_Park_Logo_Header.png),
473
476
  type: 'link',
474
477
  thumbnail_url: 'http://www.golden-gate-park.com/wp-content/uploads/2011/02/Golden_Gate_Park_Logo_Header.png'
@@ -495,6 +498,7 @@ describe LinkPreview do
495
498
  version: '1.0',
496
499
  provider_name: 'youtube.com',
497
500
  provider_url: 'http://youtube.com',
501
+ url: url,
498
502
  title: 'YouTube',
499
503
  type: 'link'
500
504
  }
@@ -568,6 +572,7 @@ describe LinkPreview do
568
572
  version: '1.0',
569
573
  provider_name: %(MediaSpace Demo Site),
570
574
  provider_url: 'http://media.mediaspace.kaltura.com',
575
+ url: 'http://media.mediaspace.kaltura.com/media/Despicable+Me/0_w2zsofdj',
571
576
  title: %(Despicable Me),
572
577
  description: %(In a happy suburban neighborhood surrounded by white picket fences with flowering rose bushes, sits a black house with a dead lawn. Unbeknownst to the neighbors, hidden beneath this home is a vast secret hideout. Surrounded by a small army of minions, we discover Gru planning the biggest heist in the history of the world. He is going to steal the moon, yes, the moon. Gru delights in all things wicked. Armed with his arsenal of shrink rays, freeze rays, and battle-ready vehicles for land and air, he vanquishes all who stand in his way. Until the day he encounters the immense will of three little orphaned girls who look at him and see something that no one else has ever seen: a potential Dad. The world's greatest villain has just met his greatest challenge: three little girls named Margo, Edith and Agnes.),
573
578
  type: 'video',
@@ -638,6 +643,7 @@ describe LinkPreview do
638
643
  version: '1.0',
639
644
  provider_name: %(Elasticsearch.org),
640
645
  provider_url: 'http://www.elasticsearch.org',
646
+ url: url,
641
647
  title: %(Hadoop | Elasticsearch),
642
648
  description: %(Search your Hadoop Data and Get Real-Time Results Deep API integration makes searching data in Hadoop easy Elasticsearch for Apache Hadoop enables real-time searching against data stored in Apache Hadoop. It provides native integration with Map/Reduce, Hive, Pig, and Cascading, all with no customization. Download Elasticsearch for Apache Hadoop Documentation Great fit for “Big Data” [...]),
643
649
  type: 'link',
@@ -745,6 +751,7 @@ describe LinkPreview do
745
751
  version: '1.0',
746
752
  provider_name: %(Kaltura),
747
753
  provider_url: 'http://player.kaltura.com',
754
+ url: url,
748
755
  title: %(Kaltura Player: Share Plugin example),
749
756
  description: %(Kaltura Player: Share plugin demonstrates the ease of which social share can be configured with the kaltura player toolkit.),
750
757
  type: 'video',
@@ -818,6 +825,7 @@ describe LinkPreview do
818
825
  version: '1.0',
819
826
  provider_name: %(Kaltura),
820
827
  provider_url: 'http://player.kaltura.com',
828
+ url: url,
821
829
  title: %(Kaltura Player: Share Plugin example),
822
830
  description: %(Kaltura Player: Share plugin demonstrates the ease of which social share can be configured with the kaltura player toolkit.),
823
831
  type: 'video',
@@ -896,6 +904,7 @@ describe LinkPreview do
896
904
  version: '1.0',
897
905
  provider_name: %(Kaltura),
898
906
  provider_url: 'http://player.kaltura.com',
907
+ url: url,
899
908
  title: %(Kaltura Player: Share Plugin example),
900
909
  description: %(Kaltura Player: Share plugin demonstrates the ease of which social share can be configured with the kaltura player toolkit.),
901
910
  type: 'video',
@@ -989,4 +998,75 @@ describe LinkPreview do
989
998
  end
990
999
  end
991
1000
  end
1001
+
1002
+ context 'with only with html5 embed response', vcr: { cassette_name: 'thinglink_html5_embed' } do
1003
+ let(:url) { 'https://www.thinglink.com/scene/771673473431896065' }
1004
+
1005
+ it_behaves_like 'link_preview'
1006
+
1007
+ describe '#url' do
1008
+ subject { content.url }
1009
+ it { should == url }
1010
+ end
1011
+
1012
+ describe '#title' do
1013
+ subject { content.title }
1014
+ it { should == %(#AmazonienLive by Gnter Exel) }
1015
+ end
1016
+
1017
+ describe '#description' do
1018
+ subject { content.description }
1019
+ it { should == %(TOUCH this image to discover its story. Image tagging powered by ThingLink) }
1020
+ end
1021
+
1022
+ describe '#site_name' do
1023
+ subject { content.site_name }
1024
+ it { should == 'www.thinglink.com' }
1025
+ end
1026
+
1027
+ describe '#site_url' do
1028
+ subject { content.site_url }
1029
+ it { should == 'https://www.thinglink.com' }
1030
+ end
1031
+
1032
+ describe '#image_url' do
1033
+ subject { content.image_url }
1034
+ it { should == 'https://cdn.thinglink.me/api/image/771673473431896065/1024/10/scaletowidth/0/0/1/1/false/true?wait=true' }
1035
+ end
1036
+
1037
+ describe '#image_data' do
1038
+ subject { content.image_data }
1039
+ it { should be_a(StringIO) }
1040
+ end
1041
+
1042
+ describe '#image_content_type' do
1043
+ subject { content.image_content_type }
1044
+ it { should == 'image/jpeg;charset=ISO-8859-1' }
1045
+ end
1046
+
1047
+ describe '#image_file_name' do
1048
+ subject { content.image_file_name }
1049
+ it { should == 'tmp771673473431896065.jpg' }
1050
+ end
1051
+
1052
+ describe '#as_oembed' do
1053
+ subject(:oembed) { content.as_oembed }
1054
+
1055
+ it 'should convert opengraph to oembed' do
1056
+ should == {
1057
+ version: '1.0',
1058
+ provider_name: %(www.thinglink.com),
1059
+ provider_url: 'https://www.thinglink.com',
1060
+ url: url,
1061
+ title: %(#AmazonienLive by Gnter Exel),
1062
+ description: 'TOUCH this image to discover its story. Image tagging powered by ThingLink',
1063
+ type: 'video',
1064
+ thumbnail_url: 'https://cdn.thinglink.me/api/image/771673473431896065/1024/10/scaletowidth/0/0/1/1/false/true?wait=true',
1065
+ html: content.sources[:opengraph_embed][:html],
1066
+ width: 1024,
1067
+ height: 677
1068
+ }
1069
+ end
1070
+ end
1071
+ end
992
1072
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: link_preview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Andrews
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-18 00:00:00.000000000 Z
11
+ date: 2016-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-oembed
@@ -211,6 +211,7 @@ files:
211
211
  - spec/files/requests/ogp_me.yml
212
212
  - spec/files/requests/sliderocket.yml
213
213
  - spec/files/requests/support_apple_com.yml
214
+ - spec/files/requests/thinglink_html5_embed.yml
214
215
  - spec/files/requests/youtube.yml
215
216
  - spec/files/requests/youtube_404.yml
216
217
  - spec/link_preview/http_crawler_spec.rb
@@ -255,6 +256,7 @@ test_files:
255
256
  - spec/files/requests/ogp_me.yml
256
257
  - spec/files/requests/sliderocket.yml
257
258
  - spec/files/requests/support_apple_com.yml
259
+ - spec/files/requests/thinglink_html5_embed.yml
258
260
  - spec/files/requests/youtube.yml
259
261
  - spec/files/requests/youtube_404.yml
260
262
  - spec/link_preview/http_crawler_spec.rb