Class: RGeoServer::Namespace
Overview
A namespace is a uniquely identifiable grouping of feature types. A namespaces is identified by a prefix and a uri.
Constant Summary
collapse
- OBJ_ATTRIBUTES =
{:enabled => 'enabled', :catalog => 'catalog', :name => 'prefix', :uri => 'uri' }
- OBJ_DEFAULT_ATTRIBUTES =
{:enabled => 'true', :catalog => nil, :name => nil }
- @@route =
"namespaces"
- @@resource_name =
"namespace"
Instance Attribute Summary
Attributes inherited from ResourceInfo
#catalog
Class Method Summary
collapse
Instance Method Summary
collapse
#clear, #create_method, #delete, list, #new?, #profile, #profile=, #profile_xml_to_ng, #refresh, #save, #to_s, update_attribute_accessors, #update_method, #update_params
Constructor Details
#initialize(catalog, options) ⇒ Namespace
Returns a new instance of Namespace.
43
44
45
46
47
48
49
50
|
# File 'lib/rgeoserver/namespace.rb', line 43
def initialize catalog, options
super(catalog)
_run_initialize_callbacks do
@name = options[:name].strip
@uri = options[:uri] if options[:uri]
end
@route = route
end
|
Class Method Details
.member_xpath ⇒ Object
23
24
25
|
# File 'lib/rgeoserver/namespace.rb', line 23
def self.member_xpath
"//#{resource_name}"
end
|
.resource_name ⇒ Object
15
16
17
|
# File 'lib/rgeoserver/namespace.rb', line 15
def self.resource_name
@@resource_name
end
|
.root_xpath ⇒ Object
19
20
21
|
# File 'lib/rgeoserver/namespace.rb', line 19
def self.root_xpath
"//#{@@route}/#{@@resource_name}"
end
|
Instance Method Details
#message ⇒ Object
31
32
33
34
35
36
37
38
39
|
# File 'lib/rgeoserver/namespace.rb', line 31
def message
builder = Nokogiri::XML::Builder.new do |xml|
xml.namespace {
xml.prefix @name
xml.uri @uri
}
end
return builder.doc.to_xml
end
|
#profile_xml_to_hash(profile_xml) ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/rgeoserver/namespace.rb', line 52
def profile_xml_to_hash profile_xml
doc = profile_xml_to_ng profile_xml
h = {
'name' => doc.at_xpath('//namespace/prefix/text()').to_s,
'uri' => doc.at_xpath('//namespace/uri/text()').to_s
}.freeze
h
end
|
#route ⇒ Object
27
28
29
|
# File 'lib/rgeoserver/namespace.rb', line 27
def route
@@route
end
|