@@ -14,7 +14,7 @@ def capitalize
14
14
end
15
15
end
16
16
17
- class Error < StandardError
17
+ class SOLIDserverError < StandardError
18
18
end
19
19
20
20
class SOLIDserver
@@ -47,6 +47,10 @@ def initialize(host, username, password, port=443, sslcheck=false, timeout=8)
47
47
@password = Base64 . strict_encode64 ( password )
48
48
49
49
# 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}
50
54
@servicemapper = {
51
55
"ip_site_add" => [ "ip_site_add" , "This service allows to add an IP address Space." ] ,
52
56
"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)
117
121
"vlm_vlan_count" => [ "vlmvlan_count" , "This service returns the number of VLANs matching optional condition(s)." ] ,
118
122
"vlm_vlan_list" => [ "vlmvlan_list" , "This service returns a list of VLANs matching optional condition(s)." ] ,
119
123
"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." ]
137
125
}
138
126
end
139
127
@@ -147,7 +135,7 @@ def doc()
147
135
buffer += "This GEM wraps the following SOLIDserver API calls, allowing you to interract with SOLIDserver DDI solution.\n "
148
136
149
137
begin
150
- @servicemapper . each do |service_name , service_mapped |
138
+ @servicemapper . each do |service_name , service_mapped , parameters_mapper |
151
139
buffer += "\n ### Method - #{ service_name } \n "
152
140
rest_answer = RestClient ::Request . execute (
153
141
url : sprintf ( "%s/%s" , @resturl , service_mapped [ 0 ] ) ,
@@ -228,7 +216,7 @@ def doc()
228
216
229
217
return ( buffer )
230
218
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 " )
232
220
end
233
221
end
234
222
@@ -268,7 +256,7 @@ def call(rest_method, rest_service, args={})
268
256
269
257
return ( rest_answer )
270
258
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 } " )
272
260
end
273
261
end
274
262
0 commit comments