Sha256: 07ce8197392b66c209adf3800d479c85d61068da4e42a643c511d2db1266d6d7

Contents?: true

Size: 806 Bytes

Versions: 5

Compression:

Stored size: 806 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)\/.+}

    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

5 entries across 5 versions & 1 rubygems

Version Path
oembed_proxy-0.1.4 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.1.3 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.1.2 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.1.1 lib/oembed_proxy/associated_press.rb
oembed_proxy-0.1.0 lib/oembed_proxy/associated_press.rb