oembed_proxy 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: b687b1aea468ca341b4f37089e7da5aad1b574f75310367d34c7370fd27489b4
4
- data.tar.gz: 2fe9fa0767c3d78a01103e7d70da42f464191b0e14eeb0a0f297c40149c96d5f
3
+ metadata.gz: 82a43df03a51da4690d5afdfca411f45d466a129c524d2bdbf669efa39800a3c
4
+ data.tar.gz: 2bb0f79c2535a1e1bba1789446df519ad1a9ee03babdc692dc4118d3cd6c16e2
5
5
  SHA512:
6
- metadata.gz: edb22346ed8c006aa9a16d5d299443b3bdc52e00a1984184bfd3c73bc76f0b1beae9d029ad8b103da93ed2aeac204fb8472ed909fc4dcb04301c0a3a72ae1612
7
- data.tar.gz: 61bde6dbebcb7e63db71ad35c270bcbbb6319a7b97b9044e3b1cdeb3fd26802fb9757fc6098b571915f820f1d25875a7899db0e33a8e36c899d752b8cd13bb52
6
+ metadata.gz: e66dfae3a409b0befdb1be2f130a86d8fd77e37f386bf22b1e503efed528206872a97afadba30fd126e1c7daaa1a3bb07af8cd6d455b8ef26df55ed150ed8c74
7
+ data.tar.gz: '0123193339dd7e80f19ef3374a9f4f8cf4a1d6b2507da1bbbe62aa7c45d66edf3211a1e31c46c7ac64b61b03eef9912891f5e2801ae8652062e141ce86d9f648'
data/.gitignore CHANGED
@@ -11,3 +11,6 @@
11
11
 
12
12
  # rspec failure tracking
13
13
  .rspec_status
14
+
15
+ # gem file
16
+ *.gem
@@ -3,7 +3,7 @@ AllCops:
3
3
  Exclude:
4
4
  - 'bin/*'
5
5
 
6
- Metrics/LineLength:
6
+ Layout/LineLength:
7
7
  Enabled: false
8
8
 
9
9
  Metrics/BlockLength:
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.
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OembedProxy
4
- VERSION = '0.2.0'
4
+ VERSION = '0.2.1'
5
5
  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.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Johnston
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-17 00:00:00.000000000 Z
11
+ date: 2020-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -82,6 +82,7 @@ files:
82
82
  - lib/oembed_proxy/google_spreadsheet.rb
83
83
  - lib/oembed_proxy/handler.rb
84
84
  - lib/oembed_proxy/inactive_support.rb
85
+ - lib/oembed_proxy/npr.rb
85
86
  - lib/oembed_proxy/oembed_exception.rb
86
87
  - lib/oembed_proxy/tableau.rb
87
88
  - lib/oembed_proxy/utility.rb