Skip to content

Commit 33b7847

Browse files
committed
Removing DNS Support needing better input parameter management.
Fixing SOLIDserverError NameError.
1 parent d3b20a6 commit 33b7847

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

SOLIDserver.gemspec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
44

55
Gem::Specification.new do |spec|
66
spec.name = "SOLIDserver"
7-
spec.version = "0.0.9"
7+
spec.version = "0.0.10"
88
spec.date = "2016-09-09"
99
spec.authors = ["Alexis Savin"]
1010
spec.email = ["[email protected]"]
@@ -20,4 +20,7 @@ Gem::Specification.new do |spec|
2020

2121
spec.add_runtime_dependency 'rest-client', '~> 2.0', '>= 2.0.0'
2222
spec.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.3'
23+
24+
spec.add_development_dependency "bundler", "~> 1.3"
25+
spec.add_development_dependency "rspec"
2326
end

lib/SOLIDserver.rb

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def capitalize
1414
end
1515
end
1616

17-
class Error < StandardError
17+
class SOLIDserverError < StandardError
1818
end
1919

2020
class SOLIDserver
@@ -47,6 +47,10 @@ def initialize(host, username, password, port=443, sslcheck=false, timeout=8)
4747
@password = Base64.strict_encode64(password)
4848

4949
# Map the new naming convention against the old one
50+
#FIXME# Filtering json hash content can be done this way
51+
#h1 = {:a => 1, :b => 2, :c => 3, :d => 4}
52+
#h1.slice(:a, :b) # return {:a=>1, :b=>2}, but h1 is not changed
53+
#h2 = h1.slice!(:a, :b) # h1 = {:a=>1, :b=>2}, h2 = {:c => 3, :d => 4}
5054
@servicemapper = {
5155
"ip_site_add" => ["ip_site_add", "This service allows to add an IP address Space."],
5256
"ip_site_update" => ["ip_site_add", "This service allows to update an IP address Space."],
@@ -117,23 +121,7 @@ def initialize(host, username, password, port=443, sslcheck=false, timeout=8)
117121
"vlm_vlan_count" => ["vlmvlan_count", "This service returns the number of VLANs matching optional condition(s)."],
118122
"vlm_vlan_list" => ["vlmvlan_list", "This service returns a list of VLANs matching optional condition(s)."],
119123
"vlm_vlan_info" => ["vlmvlan_info", "This service returns information about a specific VLAN."],
120-
"vlm_vlan_delete" => ["vlm_vlan_delete", "This service allows to delete a specific VLAN."],
121-
"dns_server_count" => ["dns_server_count", "This service returns the number of DNS Servers matching optional condition(s)."],
122-
"dns_server_list" => ["dns_server_list", "This service returns a list of DNS Servers matching optional condition(s)."],
123-
"dns_server_info" => ["dns_server_info", "This service returns information about a specific DNS Server."],
124-
"dns_view_count" => ["dns_view_count", "This service returns the number of DNS Views matching optional condition(s)."],
125-
"dns_view_list" => ["dns_view_list", "This service returns a list of DNS Views matching optional condition(s)."],
126-
"dns_view_info" => ["dns_view_info", "This service returns information about a specific DNS View."],
127-
"dns_zone_add" => ["dns_zone_add", "This service allows to add a DNS Zone."],
128-
"dns_zone_count" => ["dns_zone_count", "This service returns the number of DNS Zones matching optional condition(s)."],
129-
"dns_zone_list" => ["dns_zone_list", "This service returns a list of DNS Zones matching optional condition(s)."],
130-
"dns_zone_info" => ["dns_zone_info", "This service returns information about a specific DNS Zone."],
131-
"dns_zone_delete" => ["dns_zone_delete", "This service allows to delete a specific DNS Zone."],
132-
"dns_rr_add" => ["dns_rr_add", "This service allows to add a DNS Resource Record."],
133-
"dns_rr_count" => ["dns_rr_count", "This service returns the number of DNS Resource Records matching optional condition(s)."],
134-
"dns_rr_list" => ["dns_rr_list", "This service returns a list of DNS Resource Records matching optional condition(s)."],
135-
"dns_rr_info" => ["dns_rr_info", "This service returns information about a specific DNS Resource Record."],
136-
"dns_rr_delete" => ["dns_rr_delete", "This service allows to delete a specific DNS Resource Record."]
124+
"vlm_vlan_delete" => ["vlm_vlan_delete", "This service allows to delete a specific VLAN."]
137125
}
138126
end
139127

@@ -147,7 +135,7 @@ def doc()
147135
buffer += "This GEM wraps the following SOLIDserver API calls, allowing you to interract with SOLIDserver DDI solution.\n"
148136

149137
begin
150-
@servicemapper.each do |service_name, service_mapped|
138+
@servicemapper.each do |service_name, service_mapped, parameters_mapper|
151139
buffer += "\n### Method - #{service_name}\n"
152140
rest_answer = RestClient::Request.execute(
153141
url: sprintf("%s/%s", @resturl, service_mapped[0]),
@@ -228,7 +216,7 @@ def doc()
228216

229217
return(buffer)
230218
rescue RestClient::ExceptionWithResponse => rest_error
231-
raise SOLIDserver::Error.new("SOLIDserver REST call error : #{rest_error.response}")
219+
raise SOLIDserverError.new("SOLIDserver REST call error : - TEST")
232220
end
233221
end
234222

@@ -268,7 +256,7 @@ def call(rest_method, rest_service, args={})
268256

269257
return(rest_answer)
270258
rescue RestClient::ExceptionWithResponse => rest_error
271-
raise SOLIDserver::Error.new("SOLIDserver REST call error : #{rest_error.response}")
259+
raise SOLIDserverError.new("SOLIDserver REST call error : #{rest_error.message}")
272260
end
273261
end
274262

0 commit comments

Comments
 (0)