onebox 1.6.7 → 1.6.8

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: 22237e827c83b06b67a2135ae66f75690da5f87b
4
- data.tar.gz: 0697141bd0aa6f4197cd68de1fcb74c8c4407fb7
3
+ metadata.gz: a12d23bfa68fd516d78c674b2ad5918197b562aa
4
+ data.tar.gz: d7da2b8da8e5155e30ae469470e8054603314b5d
5
5
  SHA512:
6
- metadata.gz: e1b2de7ce31a701e60a1ab238d406484a16a3660039530ac21054e8561a4bc1dcdb313ee37b66fb580c8709b4e058806c70b3a84e00f01dcc8a88a4c253ee94c
7
- data.tar.gz: b3622e546b4c1e68578416c66ff7105e0ed4496aee3258837a70f61c34ea275a9f4b9a8af8ae0eb03ab9740260f67a885f1b8df9aeb96f66e5f0267a78501cc4
6
+ metadata.gz: f6600bba536e0e346696272c3cabfed3f946a0a7596e8400b25c76d727a31efea9209bc88fb8b08d4933467085d7a267f3b6e963afc91a48dbe77a2f8f938f39
7
+ data.tar.gz: 5eeb57535bdd8d624b417458890d4f5a5efa8b74d624b0519d001bfff85f9038d81d32920bc7a0f4782810697b0887ce4db344ffaf90b6406aa77efa3ff93218
@@ -20,6 +20,8 @@ module Onebox
20
20
 
21
21
  # Some oembed providers (like meetup.com) don't provide links to themselves
22
22
  add_oembed_provider(/www\.meetup\.com\//, 'http://api.meetup.com/oembed')
23
+ # In order to support Private Videos
24
+ add_oembed_provider(/vimeo\.com\//, 'https://vimeo.com/api/oembed.json')
23
25
 
24
26
  def always_https?
25
27
  WhitelistedGenericOnebox.host_matches(uri, WhitelistedGenericOnebox.https_hosts) || super
@@ -50,19 +52,23 @@ module Onebox
50
52
  end
51
53
 
52
54
  def get_oembed
53
- application_json = html_doc.at("//link[@type='application/json+oembed']/@href")
54
- oembed_url = application_json.value if application_json
55
+ oembed_url = nil
55
56
 
56
- text_json = html_doc.at("//link[@type='text/json+oembed']/@href")
57
- oembed_url ||= text_json.value if text_json
57
+ StandardEmbed.oembed_providers.each do |regexp, endpoint|
58
+ if url =~ regexp
59
+ oembed_url = "#{endpoint}?url=#{url}"
60
+ break
61
+ end
62
+ end
58
63
 
59
64
  if Onebox::Helpers.blank?(oembed_url)
60
- StandardEmbed.oembed_providers.each do |regexp, endpoint|
61
- if url[regexp]
62
- oembed_url = "#{endpoint}?url=#{url}"
63
- break
64
- end
65
- end
65
+ application_json = html_doc.at("//link[@type='application/json+oembed']/@href")
66
+ oembed_url = application_json.value if application_json
67
+ end
68
+
69
+ if Onebox::Helpers.blank?(oembed_url)
70
+ text_json = html_doc.at("//link[@type='text/json+oembed']/@href")
71
+ oembed_url ||= text_json.value if text_json
66
72
  end
67
73
 
68
74
  return {} if Onebox::Helpers.blank?(oembed_url)
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.6.7"
2
+ VERSION = "1.6.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.7
4
+ version: 1.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-12-19 00:00:00.000000000 Z
13
+ date: 2016-12-21 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: multi_json
@@ -528,4 +528,3 @@ test_files:
528
528
  - spec/lib/onebox_spec.rb
529
529
  - spec/spec_helper.rb
530
530
  - spec/support/html_spec_helper.rb
531
- has_rdoc: