Sha256: 2f4521bb7f0223f973aac1db537fe8aec0dc3a1d29d418c9bfba75f2893d083c

Contents?: true

Size: 813 Bytes

Versions: 8

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

module OembedProxy
  # Associated Press Interactives Fauxembed
  class AssociatedPress
    AP_REGEX = %r{\Ahttps?:\/\/(?:hosted\.ap\.org\/interactives|interactives\.ap\.org)\/.+}.freeze

    def handles_url?(url)
      !AP_REGEX.match(url).nil?
    end

    def get_data(url, _other_params = {})
      return nil unless handles_url? url

      oembed = {}

      oembed['type'] = 'rich'
      oembed['version'] = '1.0'

      oembed['provider_name'] = 'Associated Press'
      oembed['provider_url'] = 'http://www.ap.org/'

      oembed['html'] = '<iframe class="ap-embed" width="100%" height="600" frameborder="0" scrolling="yes" marginheight="0" marginwidth="0" src="' + url + '"></iframe>'
      oembed['width'] = 600
      oembed['height'] = 600

      oembed
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
oembed_proxy-0.3 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.2.6 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.2.5 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.2.4 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.2.3 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.2.2 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.2.1 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.2.0 lib/oembed_proxy/associated_press.rb