Sha256: 9ce45e68f4d1d924be26d59e0372dcfe573daf848690981488f3548cd5421abf
Contents?: true
Size: 849 Bytes
Versions: 45
Compression:
Stored size: 849 Bytes
Contents
# frozen_string_literal: true module Decidim # This class generates a url to create a static map image for a geocoded resource class StaticMapGenerator def initialize(resource, options = {}) @resource = resource @options = options @options[:zoom] ||= 15 @options[:width] ||= 120 @options[:height] ||= 120 end def data return if @resource.blank? || map_utility.nil? Rails.cache.fetch(@resource.cache_key) do map_utility.image_data( latitude: @resource.latitude, longitude: @resource.longitude, options: @options ) end end private def organization @organization ||= @resource.component.organization end def map_utility @map_utility ||= Decidim::Map.static(organization: organization) end end end
Version data entries
45 entries across 45 versions & 1 rubygems