# frozen_string_literal: true module OembedProxy # Google Maps Engine Fauxembed class GoogleMapsengine MAPSENGINE_REGEXES = [ %r{\Ahttps://mapsengine\.google\.com/map/(?:edit|view)\?mid=(.+)}, %r{\Ahttps://www\.google\.com/maps/d/edit\?mid=(.+)}, ].freeze def handles_url?(url) !get_matching_regex(url).nil? end def get_data(url, _other_params = {}) return nil unless handles_url? url { 'type' => 'rich', 'version' => '1.0', 'provider_name' => 'Google Maps Engine', 'provider_url' => 'https://mapsengine.google.com/', 'html' => "", 'width' => 500, 'height' => 500, } end private def get_matching_regex(str) MAPSENGINE_REGEXES.each do |regex| return regex unless (str =~ regex).nil? end nil end end end