Sha256: ee7d42879ab269757cb41d5cad9495ca32ed483ccab182b7e4c8aeba168b6af2

Contents?: true

Size: 839 Bytes

Versions: 8

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

module OembedProxy
  # Google Apps Fusiontable Map Fauxembeds
  class FusiontableMap
    FUSIONTABLE_REGEX = %r{\Ahttps://www\.google\.com/fusiontables.+}.freeze

    def handles_url?(url)
      !(url =~ FUSIONTABLE_REGEX).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'] = 'Google Apps Fusion Tables'
      oembed['provider_url'] = 'https://www.google.com/drive/apps.html#fusiontables'

      oembed['html'] = '<iframe class="google-map" width="100%" height="500" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="' + url + '"></iframe>'
      oembed['width'] = 500
      oembed['height'] = 500

      oembed
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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