Class: Geoserver::Publish::FeatureType
- Inherits:
-
Object
- Object
- Geoserver::Publish::FeatureType
- Defined in:
- lib/geoserver/publish/feature_type.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#create(workspace_name:, data_store_name:, feature_type_name:, title:, additional_payload: nil) ⇒ Object
Feature type name must be the same name as the shapefile without the extenstion.
- #delete(workspace_name:, data_store_name:, feature_type_name:) ⇒ Object
- #find(workspace_name:, data_store_name:, feature_type_name:) ⇒ Object
-
#initialize(conn = nil) ⇒ FeatureType
constructor
A new instance of FeatureType.
- #update(workspace_name:, data_store_name:, feature_type_name:, title:, additional_payload: nil) ⇒ Object
Constructor Details
#initialize(conn = nil) ⇒ FeatureType
Returns a new instance of FeatureType.
7 8 9 |
# File 'lib/geoserver/publish/feature_type.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/feature_type.rb', line 5 def connection @connection end |
Instance Method Details
#create(workspace_name:, data_store_name:, feature_type_name:, title:, additional_payload: nil) ⇒ Object
Feature type name must be the same name as the shapefile without the extenstion. E.g. If the file is ‘12345.shp`, then feature_type_name = “12345”.
24 25 26 27 28 |
# File 'lib/geoserver/publish/feature_type.rb', line 24 def create(workspace_name:, data_store_name:, feature_type_name:, title:, additional_payload: nil) path = feature_type_url(workspace_name: workspace_name, data_store_name: data_store_name, feature_type_name: nil) payload = payload_new(feature_type_name: feature_type_name, title: title, payload: additional_payload) connection.post(path: path, payload: payload) end |
#delete(workspace_name:, data_store_name:, feature_type_name:) ⇒ Object
11 12 13 14 |
# File 'lib/geoserver/publish/feature_type.rb', line 11 def delete(workspace_name:, data_store_name:, feature_type_name:) path = feature_type_url(workspace_name: workspace_name, data_store_name: data_store_name, feature_type_name: feature_type_name) connection.delete(path: path) end |
#find(workspace_name:, data_store_name:, feature_type_name:) ⇒ Object
16 17 18 19 20 |
# File 'lib/geoserver/publish/feature_type.rb', line 16 def find(workspace_name:, data_store_name:, feature_type_name:) path = feature_type_url(workspace_name: workspace_name, data_store_name: data_store_name, feature_type_name: feature_type_name) out = connection.get(path: path) JSON.parse(out) if out end |
#update(workspace_name:, data_store_name:, feature_type_name:, title:, additional_payload: nil) ⇒ Object
30 31 32 33 34 |
# File 'lib/geoserver/publish/feature_type.rb', line 30 def update(workspace_name:, data_store_name:, feature_type_name:, title:, additional_payload: nil) path = feature_type_url(workspace_name: workspace_name, data_store_name: data_store_name, feature_type_name: feature_type_name) payload = payload_new(feature_type_name: feature_type_name, title: title, payload: additional_payload) connection.put(path: path, payload: payload, content_type: "application/json") end |