Sha256: 97d8c8be86a9d866d90bb140f9d72a6b64500a245f70fa79e2e47694d5249d38

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true
module Geoblacklight
  class ItemViewer
    def initialize(references)
      @references = references
    end

    def viewer_protocol
      return 'map' if viewer_preference.nil?
      viewer_preference.keys.first.to_s
    end

    def viewer_endpoint
      return '' if viewer_preference.nil?
      viewer_preference.values.first.to_s
    end

    def wms
      @references.wms
    end

    def iiif
      @references.iiif
    end

    def tiled_map_layer
      @references.tiled_map_layer
    end

    def dynamic_map_layer
      @references.dynamic_map_layer
    end

    def feature_layer
      @references.feature_layer
    end

    def image_map_layer
      @references.image_map_layer
    end

    def index_map
      @references.index_map
    end

    def oembed
      @references.oembed
    end

    def tms
      @references.tms
    end

    def xyz
      @references.xyz
    end

    def tilejson
      @references.tilejson
    end

    def wmts
      @references.wmts
    end

    def viewer_preference
      [oembed, index_map, tilejson, xyz, wmts, tms, wms, iiif, tiled_map_layer, dynamic_map_layer,
       image_map_layer, feature_layer].compact.map(&:to_hash).first
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
geoblacklight-3.8.1 lib/geoblacklight/item_viewer.rb
geoblacklight-3.8.0 lib/geoblacklight/item_viewer.rb
geoblacklight-4.0.0 lib/geoblacklight/item_viewer.rb
geoblacklight-4.0.0.pre.rc3 lib/geoblacklight/item_viewer.rb
geoblacklight-3.7.0 lib/geoblacklight/item_viewer.rb
geoblacklight-4.0.0.pre.rc2 lib/geoblacklight/item_viewer.rb
geoblacklight-4.0.0.pre.rc1 lib/geoblacklight/item_viewer.rb
geoblacklight-3.6.0 lib/geoblacklight/item_viewer.rb