Sha256: e75eaa8d2cbf3dc1b3452f7bb6ad3b3eba4859b2f95aeb666803b42abeb40b74

Contents?: true

Size: 832 Bytes

Versions: 5

Compression:

Stored size: 832 Bytes

Contents

# frozen_string_literal: true

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

    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

5 entries across 5 versions & 1 rubygems

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