Class: GeoConcerns::Discovery::DocumentBuilder::DocumentPath

Inherits:
Object
  • Object
show all
Defined in:
app/services/geo_concerns/discovery/document_builder/document_path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(geo_concern) ⇒ DocumentPath

Returns a new instance of DocumentPath.



6
7
8
# File 'app/services/geo_concerns/discovery/document_builder/document_path.rb', line 6

def initialize(geo_concern)
  @geo_concern = geo_concern
end

Instance Attribute Details

#geo_concernObject (readonly)

Returns the value of attribute geo_concern.



5
6
7
# File 'app/services/geo_concerns/discovery/document_builder/document_path.rb', line 5

def geo_concern
  @geo_concern
end

Instance Method Details

#file_downloadString

Returns url for downloading the original file.

Returns:

  • (String)

    original file download url



18
19
20
21
# File 'app/services/geo_concerns/discovery/document_builder/document_path.rb', line 18

def file_download
  return unless file_set
  helper.download_url(file_set, host: host, protocol: protocol)
end

#metadata_download(format) ⇒ String

Returns url for downloading the metadata file.

Parameters:

  • metadata (String)

    file format to download

Returns:

  • (String)

    metadata download url



26
27
28
29
30
31
# File 'app/services/geo_concerns/discovery/document_builder/document_path.rb', line 26

def (format)
  return unless 
  path = helper.download_url(, host: host, protocol: protocol)
  mime_type = .solr_document[:geo_mime_type_ssim].first
  path if MetadataFormatService.label(mime_type) == format
end

#thumbnailString

Returns url for thumbnail image.

Returns:

  • (String)

    thumbnail url



35
36
37
38
# File 'app/services/geo_concerns/discovery/document_builder/document_path.rb', line 35

def thumbnail
  return unless file_download
  "#{file_download}?file=thumbnail"
end

#to_sString

Returns url for geo concern show page.

Returns:

  • (String)

    geo concern show page url



12
13
14
# File 'app/services/geo_concerns/discovery/document_builder/document_path.rb', line 12

def to_s
  helper.polymorphic_url(geo_concern, host: host, protocol: protocol)
end