oembed_proxy 0.1.4 → 0.2.4

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
- SHA1:
3
- metadata.gz: b60450600751a7c716672960dcc9fe79737e22d9
4
- data.tar.gz: 558ec9041598e1e621d53b8beb6c3fbf5e6733af
2
+ SHA256:
3
+ metadata.gz: 4bef676640a2a836d69f273c78a2dc0417e01a20c8a6fe9fc025a48e403ccfd5
4
+ data.tar.gz: e477f25149723d797a3563543720cbc25dfb0a186e8e2ddf858c26e128b20814
5
5
  SHA512:
6
- metadata.gz: ce83b15ee3968ed0b05039dbfe64268c66a00e54f496248678930eed363f047bace1acde256c8be7e4d4530d5b130bfb249c9486071abe4598b0155d8e188460
7
- data.tar.gz: 86cef85c40bd43e7e210645e05bf3ba853613d9b167411beca6a557b93cf936cd5542ef738a2dd043feda4a36e0b0b8d29b55ae7a4b442ccec052ee2d3df0b8a
6
+ metadata.gz: '09246dbfefa1d3d92db62cecebc5ca25aa5c55b28f90703e83848d40882971ff43d861df0d2ca1e44ed193751764fc8d73ba2cd3f696e21d75709fe8af60e18f'
7
+ data.tar.gz: 7dcfd2de6c3eda158f01bc7f49234be8012dfcab20f593e7a3d10233119d464d0ef5fef3dc9a13c47377819821b6ffa2783303b858f371826f2f70d29156715c
data/.gitignore CHANGED
@@ -11,3 +11,6 @@
11
11
 
12
12
  # rspec failure tracking
13
13
  .rspec_status
14
+
15
+ # gem file
16
+ *.gem
@@ -1,9 +1,9 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.3
2
+ TargetRubyVersion: 2.6
3
3
  Exclude:
4
4
  - 'bin/*'
5
5
 
6
- Metrics/LineLength:
6
+ Layout/LineLength:
7
7
  Enabled: false
8
8
 
9
9
  Metrics/BlockLength:
@@ -1,9 +1,8 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.5
5
- - 2.4
6
- - 2.3
4
+ - 2.7
5
+ - 2.6
7
6
  before_install: gem install bundler
8
7
  script:
9
8
  - 'bin/rspec'
@@ -1,5 +1,34 @@
1
1
  # oEmbed Proxy Changelog
2
2
 
3
+ ## [`0.2.4`] (2020-07-30)
4
+
5
+ [`0.2.4`]: https://github.com/APMG/oembed_proxy/compare/v0.2.3...v0.2.4
6
+
7
+ * Move poll.fm from Embed.ly to First Party.
8
+
9
+ ## [`0.2.3`] (2020-02-03)
10
+
11
+ [`0.2.3`]: https://github.com/APMG/oembed_proxy/compare/v0.2.2...v0.2.3
12
+
13
+ * Move Facebook from Embed.ly to First Party.
14
+
15
+ ## [`0.2.2`] (2020-01-31)
16
+
17
+ [`0.2.2`]: https://github.com/APMG/oembed_proxy/compare/v0.2.0...v0.2.2
18
+
19
+ *Note: The 0.2.1 release had critical bugs and should not be used.*
20
+
21
+ * Add a new Fauxembed for NPR Sidechain embeds.
22
+
23
+ ## [`0.2.0`] (2020-01-16)
24
+
25
+ [`0.2.0`]: https://github.com/APMG/oembed_proxy/compare/v0.1.3...v0.2.0
26
+
27
+ * Add Datawrapper to supported embed.ly embeds
28
+ * Updated Bundler requirement
29
+ * Rubocop upgrade to 0.78
30
+ * Modernizing Ruby versions in build
31
+
3
32
  ## [`0.1.3`] (2018-04-24)
4
33
 
5
34
  [`0.1.3`]: https://github.com/APMG/oembed_proxy/compare/v0.1.2...v0.1.3
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'https://rubygems.org'
5
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
7
  group :development do
8
- gem 'rubocop', '~> 0.54.0'
8
+ gem 'rubocop', '~> 0.78'
9
9
  end
10
10
 
11
11
  group :test do
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.
@@ -10,6 +10,7 @@ require 'oembed_proxy/google_document'
10
10
  require 'oembed_proxy/google_mapsengine'
11
11
  require 'oembed_proxy/google_spreadsheet'
12
12
  require 'oembed_proxy/tableau'
13
+ require 'oembed_proxy/npr'
13
14
 
14
15
  # Gem namespace
15
16
  module OembedProxy
@@ -3,7 +3,7 @@
3
3
  module OembedProxy
4
4
  # Associated Press Interactives Fauxembed
5
5
  class AssociatedPress
6
- AP_REGEX = %r{\Ahttps?:\/\/(?:hosted\.ap\.org\/interactives|interactives\.ap\.org)\/.+}
6
+ AP_REGEX = %r{\Ahttps?:\/\/(?:hosted\.ap\.org\/interactives|interactives\.ap\.org)\/.+}.freeze
7
7
 
8
8
  def handles_url?(url)
9
9
  !AP_REGEX.match(url).nil?
@@ -3,7 +3,7 @@
3
3
  module OembedProxy
4
4
  # Google Apps Fusiontable Map Fauxembeds
5
5
  class FusiontableMap
6
- FUSIONTABLE_REGEX = %r{\Ahttps://www\.google\.com/fusiontables.+}
6
+ FUSIONTABLE_REGEX = %r{\Ahttps://www\.google\.com/fusiontables.+}.freeze
7
7
 
8
8
  def handles_url?(url)
9
9
  !(url =~ FUSIONTABLE_REGEX).nil?
@@ -3,7 +3,7 @@
3
3
  module OembedProxy
4
4
  # Google Docs Fauxembed
5
5
  class GoogleDocument
6
- GOOGLE_DOCUMENT_REGEX = %r{\Ahttps://docs\.google\.com/document.+}
6
+ GOOGLE_DOCUMENT_REGEX = %r{\Ahttps://docs\.google\.com/document.+}.freeze
7
7
 
8
8
  def handles_url?(url)
9
9
  !(url =~ GOOGLE_DOCUMENT_REGEX).nil?
@@ -3,7 +3,7 @@
3
3
  module OembedProxy
4
4
  # Google Spreadsheet Fauxembed
5
5
  class GoogleSpreadsheet
6
- GOOGLE_SPREADSHEET_REGEX = %r{\Ahttps://docs\.google\.com/spreadsheet.+}
6
+ GOOGLE_SPREADSHEET_REGEX = %r{\Ahttps://docs\.google\.com/spreadsheet.+}.freeze
7
7
 
8
8
  def handles_url?(url)
9
9
  !(url =~ GOOGLE_SPREADSHEET_REGEX).nil?
@@ -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
@@ -7,7 +7,7 @@ module OembedProxy
7
7
  class Tableau
8
8
  using InactiveSupport
9
9
 
10
- TABLEAU_REGEX = %r{\Ahttps://public\.tableau\.com/(?:profile/[^/]+/vizhome|views)/([^?]+)}
10
+ TABLEAU_REGEX = %r{\Ahttps://public\.tableau\.com/(?:profile/[^/]+/vizhome|views)/([^?]+)}.freeze
11
11
 
12
12
  def handles_url?(url)
13
13
  !TABLEAU_REGEX.match(url).nil?
@@ -26,7 +26,7 @@ module OembedProxy
26
26
  'provider_url' => 'https://tableau.com/',
27
27
  'width' => 500,
28
28
  'height' => 500,
29
- 'html' => <<~HTML
29
+ 'html' => <<~HTML,
30
30
  <div id="#{div_id}"></div>
31
31
  <script type="text/javascript" src="https://public.tableau.com/javascripts/api/tableau-2.min.js"></script>
32
32
  <script type="text/javascript">
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OembedProxy
4
- VERSION = '0.1.4'
4
+ VERSION = '0.2.4'
5
5
  end
@@ -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
@@ -647,3 +639,5 @@
647
639
  #\Ahttp://bcove.me/.*#i
648
640
  #\Ahttps://play\.radiopublic\.com/.*#i
649
641
  #\Ahttps://www.qzzr.com/c/quiz/.*#i
642
+ #\Ahttp://datawrapper.dwcdn.net/.*#i
643
+ #\Ahttps://datawrapper.dwcdn.net/.*#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"]
@@ -1,4 +1,3 @@
1
-
2
1
  # frozen_string_literal: true
3
2
 
4
3
  lib = File.expand_path('lib', __dir__)
@@ -8,8 +7,7 @@ require 'oembed_proxy/version'
8
7
  Gem::Specification.new do |spec|
9
8
  spec.name = 'oembed_proxy'
10
9
  spec.version = OembedProxy::VERSION
11
- spec.authors = ['William Johnston']
12
- spec.email = ['wjohnston@mpr.org']
10
+ spec.authors = ['APM Digital Products Group']
13
11
 
14
12
  spec.summary = 'Simple library to manage first party, embedly, and custom oembeds'
15
13
  # spec.description = %q{TODO: Write a longer description or delete this line.}
@@ -23,7 +21,7 @@ Gem::Specification.new do |spec|
23
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
22
  spec.require_paths = ['lib']
25
23
 
26
- spec.add_development_dependency 'bundler', '~> 1.16'
27
- spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'bundler', '~> 2.0'
25
+ spec.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
28
26
  spec.add_development_dependency 'rspec', '~> 3.0'
29
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.1.4
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
- - William Johnston
8
- autorequire:
7
+ - APM Digital Products Group
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-21 00:00:00.000000000 Z
11
+ date: 2020-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
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: '10.0'
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
@@ -108,9 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
114
  - !ruby/object:Gem::Version
109
115
  version: '0'
110
116
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.6.13
113
- signing_key:
117
+ rubygems_version: 3.0.3
118
+ signing_key:
114
119
  specification_version: 4
115
120
  summary: Simple library to manage first party, embedly, and custom oembeds
116
121
  test_files: []