Class: Geoserver::Publish::Geowebcache

Inherits:
Object
  • Object
show all
Defined in:
lib/geoserver/publish/geowebcache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conn = nil) ⇒ Geowebcache

Returns a new instance of Geowebcache.



8
9
10
# File 'lib/geoserver/publish/geowebcache.rb', line 8

def initialize(conn = nil)
  @connection = conn || Geoserver::Publish::Connection.new
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



6
7
8
# File 'lib/geoserver/publish/geowebcache.rb', line 6

def connection
  @connection
end

Instance Method Details

#masstruncate(layer_name:, request_type: "truncateLayer") ⇒ Object

This will masstruncate all caches for a given layer. Note: that this implementation differs from the GWC Rest documentation which seems to be wrong. See: github.com/GeoWebCache/geowebcache/issues/785



16
17
18
19
20
21
22
23
# File 'lib/geoserver/publish/geowebcache.rb', line 16

def masstruncate(layer_name:, request_type: "truncateLayer")
  payload = "<#{request_type}><layerName>#{layer_name}</layerName></#{request_type}>"
  connection.post(
    path: "masstruncate",
    payload: payload,
    content_type: "text/xml"
  )
end