Class: GeoConcerns::Delivery::Geoserver

Inherits:
Object
  • Object
show all
Defined in:
app/services/geo_concerns/delivery/geoserver.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_set, file_path) ⇒ Geoserver

Returns a new instance of Geoserver.



11
12
13
14
15
16
17
# File 'app/services/geo_concerns/delivery/geoserver.rb', line 11

def initialize(file_set, file_path)
  @file_set = file_set
  @file_path = file_path
  @config = fetch_config
  @workspace_name = @config.delete(:workspace)
  validate!
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



9
10
11
# File 'app/services/geo_concerns/delivery/geoserver.rb', line 9

def config
  @config
end

#file_pathObject (readonly)

Returns the value of attribute file_path.



9
10
11
# File 'app/services/geo_concerns/delivery/geoserver.rb', line 9

def file_path
  @file_path
end

#file_setObject (readonly)

Returns the value of attribute file_set.



9
10
11
# File 'app/services/geo_concerns/delivery/geoserver.rb', line 9

def file_set
  @file_set
end

#workspace_nameObject (readonly)

Returns the value of attribute workspace_name.



9
10
11
# File 'app/services/geo_concerns/delivery/geoserver.rb', line 9

def workspace_name
  @workspace_name
end

Instance Method Details

#catalogObject



19
20
21
# File 'app/services/geo_concerns/delivery/geoserver.rb', line 19

def catalog
  @catalog ||= RGeoServer.catalog(config)
end

#publishObject



23
24
25
26
27
28
29
30
31
32
# File 'app/services/geo_concerns/delivery/geoserver.rb', line 23

def publish
  case type
  when :vector
    publish_vector
  when :raster
    publish_raster
  end
rescue StandardError => e
  Rails.logger.error("GeoServer delivery job failed with: #{e}")
end