class OembedProxy::Npr
NPR Fauxembed
Constants
- NPR_REGEX
Public Instance Methods
get_data(url, _other_params = {})
click to toggle source
# File lib/oembed_proxy/npr.rb, line 15 def get_data(url, _other_params = {}) # rubocop:disable Metrics/MethodLength return nil unless handles_url? url escaped_url = url.gsub('"', '"') { 'type' => 'rich', 'version' => '1.0', 'provider_name' => 'NPR', 'provider_url' => 'https://www.npr.org/', 'html' => <<~HTML, <div class='sidechain-wrapper'> <side-chain src="#{escaped_url}"></side-chain> </div> HTML } end
handles_url?(url)
click to toggle source
# File lib/oembed_proxy/npr.rb, line 11 def handles_url?(url) !NPR_REGEX.match(url).nil? end