oembed_proxy 0.2.0 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +32 -0
- data/README.md +7 -0
- data/lib/oembed_proxy.rb +1 -0
- data/lib/oembed_proxy/npr.rb +32 -0
- data/lib/oembed_proxy/version.rb +1 -1
- data/lib/providers/embedly_patterns.def +0 -8
- data/lib/providers/first_party.yml +15 -0
- data/oembed_proxy.gemspec +2 -3
- metadata +16 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63a465716cc2126538c5af5070e4cbc3b2bbae9ae0d5fbb5356e6755d8b900b8
|
4
|
+
data.tar.gz: 9400774dd8bbf9b86ebdb6d2a614252654b797d3fa13598da4a605876fa87ec5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 100fe909ed6583855dd26cceef3930569332793fdd00f9afd789e3cbd0a8ae451949724bc844d23e70848f8c9ff526631be1d4ef72edb52b5ce1551a2380ca3b
|
7
|
+
data.tar.gz: c7cb4ac5db8ca61535b685442340b03c61ac5eb80752e0979db68265cd8eb1ac5175709e6fa1fd2f5c6f66156fc43707c74fd43a8b42437d719da697fbad287d
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,37 @@
|
|
1
1
|
# oEmbed Proxy Changelog
|
2
2
|
|
3
|
+
## [`0.2.5`] (2020-07-30)
|
4
|
+
|
5
|
+
[`0.2.5`]: https://github.com/APMG/oembed_proxy/compare/v0.2.4...v0.2.5
|
6
|
+
|
7
|
+
This release contains no code changes.
|
8
|
+
The gem published for 0.2.4 contained files missing read-permissions
|
9
|
+
for "group" and "other", which could prevent loading of those files
|
10
|
+
in environments where gems are installed by a user who is not the
|
11
|
+
effective user at gem load time.
|
12
|
+
|
13
|
+
* Fix file permissions on `lib/oembed_proxy/*.rb` for published gem.
|
14
|
+
|
15
|
+
## [`0.2.4`] (2020-07-30)
|
16
|
+
|
17
|
+
[`0.2.4`]: https://github.com/APMG/oembed_proxy/compare/v0.2.3...v0.2.4
|
18
|
+
|
19
|
+
* Move poll.fm from Embed.ly to First Party.
|
20
|
+
|
21
|
+
## [`0.2.3`] (2020-02-03)
|
22
|
+
|
23
|
+
[`0.2.3`]: https://github.com/APMG/oembed_proxy/compare/v0.2.2...v0.2.3
|
24
|
+
|
25
|
+
* Move Facebook from Embed.ly to First Party.
|
26
|
+
|
27
|
+
## [`0.2.2`] (2020-01-31)
|
28
|
+
|
29
|
+
[`0.2.2`]: https://github.com/APMG/oembed_proxy/compare/v0.2.0...v0.2.2
|
30
|
+
|
31
|
+
*Note: The 0.2.1 release had critical bugs and should not be used.*
|
32
|
+
|
33
|
+
* Add a new Fauxembed for NPR Sidechain embeds.
|
34
|
+
|
3
35
|
## [`0.2.0`] (2020-01-16)
|
4
36
|
|
5
37
|
[`0.2.0`]: https://github.com/APMG/oembed_proxy/compare/v0.1.3...v0.2.0
|
data/README.md
CHANGED
@@ -95,6 +95,13 @@ Once providers have been registered, calling `#handles_url?` and `#get_data` on
|
|
95
95
|
|
96
96
|
You are able to easily implement additional providers by creating an object which implements the `#handles_url?(url)` and `#get_data(url, other_params)` methods. Take a look at the existing provider classes for examples.
|
97
97
|
|
98
|
+
### Note on the NPR
|
99
|
+
|
100
|
+
The NPR embed is what we call a fauxembed. NPR does not implement the oembed
|
101
|
+
specification so we fake it by wrapping the embed url in a side-chain
|
102
|
+
element. Then you must load the NPR Sidechain library on your site. See
|
103
|
+
[Sidechain](https://github.com/nprapps/sidechain).
|
104
|
+
|
98
105
|
## Development
|
99
106
|
|
100
107
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. Before sending a pull request, you will want to run `bin/rubocop` to lint your work.
|
data/lib/oembed_proxy.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'oembed_proxy/inactive_support'
|
4
|
+
|
5
|
+
module OembedProxy
|
6
|
+
# NPR Fauxembed
|
7
|
+
class Npr
|
8
|
+
using InactiveSupport
|
9
|
+
NPR_REGEX = %r{\Ahttps:\/\/(?:[a-z0-9-]+\.)+npr\.org\/.+}.freeze
|
10
|
+
|
11
|
+
def handles_url?(url)
|
12
|
+
!NPR_REGEX.match(url).nil?
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_data(url, _other_params = {}) # rubocop:disable Metrics/MethodLength
|
16
|
+
return nil unless handles_url? url
|
17
|
+
|
18
|
+
escaped_url = url.gsub('"', '"')
|
19
|
+
{
|
20
|
+
'type' => 'rich',
|
21
|
+
'version' => '1.0',
|
22
|
+
'provider_name' => 'NPR',
|
23
|
+
'provider_url' => 'https://www.npr.org/',
|
24
|
+
'html' => <<~HTML,
|
25
|
+
<div class='sidechain-wrapper'>
|
26
|
+
<side-chain src="#{escaped_url}"></side-chain>
|
27
|
+
</div>
|
28
|
+
HTML
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/oembed_proxy/version.rb
CHANGED
@@ -283,7 +283,6 @@
|
|
283
283
|
#\Ahttps?://(.+\.)?polldaddy\.com/poll/.*#i
|
284
284
|
#\Ahttps?://polldaddy\.com/poll/.*#i
|
285
285
|
#\Ahttps?://(.+\.)?polldaddy\.com/.*#i
|
286
|
-
#\Ahttp://poll\.fm/.*#i
|
287
286
|
#\Ahttp://answers\.polldaddy\.com/poll/.*#i
|
288
287
|
#\Ahttp://www\.5min\.com/Video/.*#i
|
289
288
|
#\Ahttp://www\.howcast\.com/videos/.*#i
|
@@ -600,13 +599,6 @@
|
|
600
599
|
#\Ahttp://boston\.com/video.*#i
|
601
600
|
#\Ahttp://www\.boston\.com/.*video.*#i
|
602
601
|
#\Ahttp://boston\.com/.*video.*#i
|
603
|
-
#\Ahttp://www\.facebook\.com/photo\.php.*#i
|
604
|
-
#\Ahttp://www\.facebook\.com/video/video\.php.*#i
|
605
|
-
#\Ahttp://www\.facebook\.com/v/.*#i
|
606
|
-
#\Ahttps://www\.facebook\.com/photo\.php.*#i
|
607
|
-
#\Ahttps://www\.facebook\.com/video/video\.php.*#i
|
608
|
-
#\Ahttps://www\.facebook\.com/v/.*#i
|
609
|
-
#\Ahttps://www\.facebook\.com/video.php\?v=.*#i
|
610
602
|
#\Ahttp://cnbc\.com/id/.*\?.*video.*#i
|
611
603
|
#\Ahttp://www\.cnbc\.com/id/.*\?.*video.*#i
|
612
604
|
#\Ahttp://cnbc\.com/id/.*/play/1/video/.*#i
|
@@ -58,6 +58,10 @@ polldaddy:
|
|
58
58
|
endpoint: "https://polldaddy.com/oembed/"
|
59
59
|
pattern_list: ["#\\Ahttps?://(?:[^.]+\\.)?polldaddy\\.com/.+#i"]
|
60
60
|
|
61
|
+
crowdsignal:
|
62
|
+
endpoint: "https://api.crowdsignal.com/oembed"
|
63
|
+
pattern_list: ["#\\Ahttps?://poll.fm/.+#i"]
|
64
|
+
|
61
65
|
funnyordie:
|
62
66
|
endpoint: "http://www.funnyordie.com/oembed"
|
63
67
|
pattern_list: ["#\\Ahttps?://(?:www\\.)?funnyordie\\.com/videos/.+#i"]
|
@@ -89,3 +93,14 @@ audio-api:
|
|
89
93
|
documentcloud:
|
90
94
|
endpoint: "https://www.documentcloud.org/api/oembed.json"
|
91
95
|
pattern_list: ["#\\Ahttps?://www\\.documentcloud\\.org/documents?/.+#i"]
|
96
|
+
|
97
|
+
|
98
|
+
# Facebook oEmbed documentation: https://developers.facebook.com/docs/plugins/oembed-endpoints/
|
99
|
+
|
100
|
+
facebook-video:
|
101
|
+
endpoint: "https://www.facebook.com/plugins/video/oembed.json"
|
102
|
+
pattern_list: ["#https://www\\.facebook\\.com/.+/videos/.+/#i", "#https://www\\.facebook\\.com/.+/videos/.+/#i", "#https://www\\.facebook\\.com/video\\.php\\?id=.+#i", "#https://www\\.facebook\\.com/video\\.php\\?v=.+#i"]
|
103
|
+
|
104
|
+
facebook-post:
|
105
|
+
endpoint: "https://www.facebook.com/plugins/post/oembed.json"
|
106
|
+
pattern_list: ["#https://www\\.facebook\\.com/.+/posts/.+#i", "#https://www\\.facebook\\.com/.+/posts/.+#i", "#https://www\\.facebook\\.com/.+/activity/.+#i", "#https://www\\.facebook\\.com/photo\\.php\\?fbid=.+#i", "#https://www\\.facebook\\.com/photos/.+#i", "#https://www\\.facebook\\.com/permalink\\.php\\?story_fbid=.+#i", "#https://www\\.facebook\\.com/media/set\\?set=.+#i", "#https://www\\.facebook\\.com/questions/.+#i", "#https://www\\.facebook\\.com/notes/.+/.+/.+#i"]
|
data/oembed_proxy.gemspec
CHANGED
@@ -7,8 +7,7 @@ require 'oembed_proxy/version'
|
|
7
7
|
Gem::Specification.new do |spec|
|
8
8
|
spec.name = 'oembed_proxy'
|
9
9
|
spec.version = OembedProxy::VERSION
|
10
|
-
spec.authors = ['
|
11
|
-
spec.email = ['wjohnston@mpr.org']
|
10
|
+
spec.authors = ['APM Digital Products Group']
|
12
11
|
|
13
12
|
spec.summary = 'Simple library to manage first party, embedly, and custom oembeds'
|
14
13
|
# spec.description = %q{TODO: Write a longer description or delete this line.}
|
@@ -23,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
23
22
|
spec.require_paths = ['lib']
|
24
23
|
|
25
24
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
26
|
-
spec.add_development_dependency 'rake', '~>
|
25
|
+
spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
|
27
26
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
28
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oembed_proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- APM Digital Products Group
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,20 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.3'
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 12.3.3
|
34
37
|
type: :development
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
37
40
|
requirements:
|
38
41
|
- - "~>"
|
39
42
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
43
|
+
version: '12.3'
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 12.3.3
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rspec
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,9 +58,8 @@ dependencies:
|
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '3.0'
|
55
|
-
description:
|
61
|
+
description:
|
56
62
|
email:
|
57
|
-
- wjohnston@mpr.org
|
58
63
|
executables: []
|
59
64
|
extensions: []
|
60
65
|
extra_rdoc_files: []
|
@@ -82,6 +87,7 @@ files:
|
|
82
87
|
- lib/oembed_proxy/google_spreadsheet.rb
|
83
88
|
- lib/oembed_proxy/handler.rb
|
84
89
|
- lib/oembed_proxy/inactive_support.rb
|
90
|
+
- lib/oembed_proxy/npr.rb
|
85
91
|
- lib/oembed_proxy/oembed_exception.rb
|
86
92
|
- lib/oembed_proxy/tableau.rb
|
87
93
|
- lib/oembed_proxy/utility.rb
|
@@ -93,7 +99,7 @@ homepage: https://github.com/APMG/oembed_proxy
|
|
93
99
|
licenses:
|
94
100
|
- MIT
|
95
101
|
metadata: {}
|
96
|
-
post_install_message:
|
102
|
+
post_install_message:
|
97
103
|
rdoc_options: []
|
98
104
|
require_paths:
|
99
105
|
- lib
|
@@ -109,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
115
|
version: '0'
|
110
116
|
requirements: []
|
111
117
|
rubygems_version: 3.0.3
|
112
|
-
signing_key:
|
118
|
+
signing_key:
|
113
119
|
specification_version: 4
|
114
120
|
summary: Simple library to manage first party, embedly, and custom oembeds
|
115
121
|
test_files: []
|