Class: Geoserver::Publish::Workspace
- Inherits:
-
Object
- Object
- Geoserver::Publish::Workspace
- Defined in:
- lib/geoserver/publish/workspace.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #create(workspace_name:) ⇒ Object
- #delete(workspace_name:) ⇒ Object
- #find(workspace_name:) ⇒ Object
-
#initialize(conn = nil) ⇒ Workspace
constructor
A new instance of Workspace.
Constructor Details
#initialize(conn = nil) ⇒ Workspace
Returns a new instance of Workspace.
7 8 9 |
# File 'lib/geoserver/publish/workspace.rb', line 7 def initialize(conn = nil) @connection = conn || Geoserver::Publish::Connection.new end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
5 6 7 |
# File 'lib/geoserver/publish/workspace.rb', line 5 def connection @connection end |
Instance Method Details
#create(workspace_name:) ⇒ Object
22 23 24 25 |
# File 'lib/geoserver/publish/workspace.rb', line 22 def create(workspace_name:) path = workspace_url(workspace_name: nil) connection.post(path: path, payload: payload_new(workspace_name: workspace_name)) end |
#delete(workspace_name:) ⇒ Object
11 12 13 14 |
# File 'lib/geoserver/publish/workspace.rb', line 11 def delete(workspace_name:) path = workspace_url(workspace_name: workspace_name) connection.delete(path: path) end |
#find(workspace_name:) ⇒ Object
16 17 18 19 20 |
# File 'lib/geoserver/publish/workspace.rb', line 16 def find(workspace_name:) path = workspace_url(workspace_name: workspace_name) out = connection.get(path: path) JSON.parse(out) if out end |