netscaler-cli 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/VERSION +1 -1
  2. data/lib/netscaler/server/response.rb +79 -11
  3. metadata +175 -122
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
@@ -17,16 +17,18 @@ module Netscaler::Server
17
17
  end
18
18
 
19
19
  def services
20
- @services ||= if @info[:servicename]
21
- res = @info[:servicename][:item]
22
- if res.is_a?(Array)
23
- res
24
- else
25
- [res]
26
- end
27
- else
28
- []
29
- end
20
+ @parsed_services ||= []
21
+ return @parsed_services if !@parsed_services.empty? || @info[:servicename].nil?
22
+
23
+ if @info[:servicename][:item].is_a?(String)
24
+ @parsed_services << ServiceInfo.new(@info, nil)
25
+ else
26
+ @info[:servicename][:item].each_with_index do |name, i|
27
+ @parsed_services << ServiceInfo.new(@info, i)
28
+ end
29
+ end
30
+
31
+ @parsed_services
30
32
  end
31
33
 
32
34
  def to_hash
@@ -37,10 +39,76 @@ module Netscaler::Server
37
39
  }
38
40
 
39
41
  if !services.empty?
40
- hash[:services] = services
42
+ hash[:services] = services.map {|s| s.to_hash}
41
43
  end
42
44
 
43
45
  hash
44
46
  end
45
47
  end
48
+
49
+ class ServiceInfo
50
+ attr_reader :name, :type, :state, :ip_address, :servicegroup
51
+
52
+ def initialize(raw_response, index)
53
+ @name = raw_response[:servicename][:item]
54
+ @ip_address = raw_response[:serviceipaddress][:item]
55
+ @state = raw_response[:svrstate][:item]
56
+ @port = raw_response[:port][:item]
57
+ @type = raw_response[:servicetype][:item]
58
+
59
+ if !index.nil?
60
+ @name = @name[index]
61
+ @ip_address = @ip_address[index]
62
+ @state = @state[index]
63
+ @port = @port[index]
64
+ @type = @type[index]
65
+ end
66
+
67
+ @servicegroup = if raw_response[:servicegroupname] && raw_response[:servicegroupname][:item]
68
+ ServiceGroupInfo.new(raw_response, index)
69
+ else
70
+ nil
71
+ end
72
+ end
73
+
74
+ def port
75
+ @port.to_i
76
+ end
77
+
78
+ def to_hash
79
+ hash = {
80
+ :name => name,
81
+ :ip_address => ip_address,
82
+ :type => type,
83
+ :state => state,
84
+ :port => port,
85
+ }
86
+
87
+ if servicegroup
88
+ hash[:servicegroup] = servicegroup.to_hash
89
+ end
90
+
91
+ hash
92
+ end
93
+ end
94
+
95
+ class ServiceGroupInfo
96
+ attr_reader :name, :state
97
+
98
+ def initialize(raw_response, index)
99
+ @name = raw_response[:servicegroupname][:item]
100
+ @state = raw_response[:boundservicegroupsvrstate][:item]
101
+
102
+ if !index.nil?
103
+ @servicegroup = @servicegroup[index]
104
+ @servicegroup_state = @servicegroup_state[index]
105
+ end
106
+ end
107
+
108
+ def to_hash
109
+ { :name => name,
110
+ :state => state
111
+ }
112
+ end
113
+ end
46
114
  end
metadata CHANGED
@@ -1,170 +1,217 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: netscaler-cli
3
- version: !ruby/object:Gem::Version
4
- version: 0.5.1
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 5
8
+ - 2
9
+ version: 0.5.2
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Gabe McArthur
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2011-03-18 00:00:00.000000000 -07:00
16
+
17
+ date: 2011-03-18 00:00:00 -07:00
13
18
  default_executable: netscaler
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
16
21
  name: log4r
17
- requirement: &70737090 !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
18
24
  none: false
19
- requirements:
25
+ requirements:
20
26
  - - ~>
21
- - !ruby/object:Gem::Version
22
- version: '1.1'
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 1
30
+ - 1
31
+ version: "1.1"
23
32
  type: :runtime
24
- prerelease: false
25
- version_requirements: *70737090
26
- - !ruby/object:Gem::Dependency
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
27
35
  name: savon
28
- requirement: &70736840 !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
29
38
  none: false
30
- requirements:
39
+ requirements:
31
40
  - - ~>
32
- - !ruby/object:Gem::Version
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ - 7
45
+ - 0
33
46
  version: 0.7.0
34
47
  type: :runtime
35
- prerelease: false
36
- version_requirements: *70736840
37
- - !ruby/object:Gem::Dependency
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
38
50
  name: highline
39
- requirement: &70736600 !ruby/object:Gem::Requirement
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
40
53
  none: false
41
- requirements:
42
- - - ! '>='
43
- - !ruby/object:Gem::Version
44
- version: '1.6'
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ segments:
58
+ - 1
59
+ - 6
60
+ version: "1.6"
45
61
  type: :runtime
46
- prerelease: false
47
- version_requirements: *70736600
48
- - !ruby/object:Gem::Dependency
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
49
64
  name: choosy
50
- requirement: &70736360 !ruby/object:Gem::Requirement
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
51
67
  none: false
52
- requirements:
68
+ requirements:
53
69
  - - ~>
54
- - !ruby/object:Gem::Version
55
- version: '0.2'
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ - 2
74
+ version: "0.2"
56
75
  type: :runtime
57
- prerelease: false
58
- version_requirements: *70736360
59
- - !ruby/object:Gem::Dependency
76
+ version_requirements: *id004
77
+ - !ruby/object:Gem::Dependency
60
78
  name: json_pure
61
- requirement: &70736120 !ruby/object:Gem::Requirement
79
+ prerelease: false
80
+ requirement: &id005 !ruby/object:Gem::Requirement
62
81
  none: false
63
- requirements:
82
+ requirements:
64
83
  - - ~>
65
- - !ruby/object:Gem::Version
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 1
87
+ - 5
88
+ - 1
66
89
  version: 1.5.1
67
90
  type: :runtime
68
- prerelease: false
69
- version_requirements: *70736120
70
- - !ruby/object:Gem::Dependency
91
+ version_requirements: *id005
92
+ - !ruby/object:Gem::Dependency
71
93
  name: rspec
72
- requirement: &70735870 !ruby/object:Gem::Requirement
94
+ prerelease: false
95
+ requirement: &id006 !ruby/object:Gem::Requirement
73
96
  none: false
74
- requirements:
75
- - - ! '>='
76
- - !ruby/object:Gem::Version
77
- version: '0'
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ segments:
101
+ - 0
102
+ version: "0"
78
103
  type: :development
79
- prerelease: false
80
- version_requirements: *70735870
81
- - !ruby/object:Gem::Dependency
104
+ version_requirements: *id006
105
+ - !ruby/object:Gem::Dependency
82
106
  name: autotest
83
- requirement: &70735630 !ruby/object:Gem::Requirement
107
+ prerelease: false
108
+ requirement: &id007 !ruby/object:Gem::Requirement
84
109
  none: false
85
- requirements:
86
- - - ! '>='
87
- - !ruby/object:Gem::Version
88
- version: '0'
110
+ requirements:
111
+ - - ">="
112
+ - !ruby/object:Gem::Version
113
+ segments:
114
+ - 0
115
+ version: "0"
89
116
  type: :development
90
- prerelease: false
91
- version_requirements: *70735630
92
- - !ruby/object:Gem::Dependency
117
+ version_requirements: *id007
118
+ - !ruby/object:Gem::Dependency
93
119
  name: autotest-notification
94
- requirement: &70735350 !ruby/object:Gem::Requirement
120
+ prerelease: false
121
+ requirement: &id008 !ruby/object:Gem::Requirement
95
122
  none: false
96
- requirements:
97
- - - ! '>='
98
- - !ruby/object:Gem::Version
99
- version: '0'
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ segments:
127
+ - 0
128
+ version: "0"
100
129
  type: :development
101
- prerelease: false
102
- version_requirements: *70735350
103
- - !ruby/object:Gem::Dependency
130
+ version_requirements: *id008
131
+ - !ruby/object:Gem::Dependency
104
132
  name: log4r
105
- requirement: &70735080 !ruby/object:Gem::Requirement
133
+ prerelease: false
134
+ requirement: &id009 !ruby/object:Gem::Requirement
106
135
  none: false
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ segments:
140
+ - 1
141
+ - 1
142
+ - 9
110
143
  version: 1.1.9
111
144
  type: :runtime
112
- prerelease: false
113
- version_requirements: *70735080
114
- - !ruby/object:Gem::Dependency
145
+ version_requirements: *id009
146
+ - !ruby/object:Gem::Dependency
115
147
  name: savon
116
- requirement: &70734830 !ruby/object:Gem::Requirement
148
+ prerelease: false
149
+ requirement: &id010 !ruby/object:Gem::Requirement
117
150
  none: false
118
- requirements:
119
- - - ! '>='
120
- - !ruby/object:Gem::Version
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ segments:
155
+ - 0
156
+ - 7
157
+ - 9
121
158
  version: 0.7.9
122
159
  type: :runtime
123
- prerelease: false
124
- version_requirements: *70734830
125
- - !ruby/object:Gem::Dependency
160
+ version_requirements: *id010
161
+ - !ruby/object:Gem::Dependency
126
162
  name: highline
127
- requirement: &70734580 !ruby/object:Gem::Requirement
163
+ prerelease: false
164
+ requirement: &id011 !ruby/object:Gem::Requirement
128
165
  none: false
129
- requirements:
130
- - - ! '>='
131
- - !ruby/object:Gem::Version
132
- version: '1.6'
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ segments:
170
+ - 1
171
+ - 6
172
+ version: "1.6"
133
173
  type: :runtime
134
- prerelease: false
135
- version_requirements: *70734580
136
- - !ruby/object:Gem::Dependency
174
+ version_requirements: *id011
175
+ - !ruby/object:Gem::Dependency
137
176
  name: choosy
138
- requirement: &70734340 !ruby/object:Gem::Requirement
177
+ prerelease: false
178
+ requirement: &id012 !ruby/object:Gem::Requirement
139
179
  none: false
140
- requirements:
141
- - - ! '>='
142
- - !ruby/object:Gem::Version
180
+ requirements:
181
+ - - ">="
182
+ - !ruby/object:Gem::Version
183
+ segments:
184
+ - 0
185
+ - 2
186
+ - 4
143
187
  version: 0.2.4
144
188
  type: :runtime
145
- prerelease: false
146
- version_requirements: *70734340
147
- - !ruby/object:Gem::Dependency
189
+ version_requirements: *id012
190
+ - !ruby/object:Gem::Dependency
148
191
  name: rspec
149
- requirement: &70734090 !ruby/object:Gem::Requirement
192
+ prerelease: false
193
+ requirement: &id013 !ruby/object:Gem::Requirement
150
194
  none: false
151
- requirements:
152
- - - ! '>='
153
- - !ruby/object:Gem::Version
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ segments:
199
+ - 2
200
+ - 5
201
+ - 0
154
202
  version: 2.5.0
155
203
  type: :development
156
- prerelease: false
157
- version_requirements: *70734090
158
- description: This gem installs several simple command line utilities locally. It
159
- uses the NSConfig.wsdl SOAP interface for remote access.
160
- email:
204
+ version_requirements: *id013
205
+ description: This gem installs several simple command line utilities locally. It uses the NSConfig.wsdl SOAP interface for remote access.
206
+ email:
161
207
  - madeonamac@gmail.com
162
- executables:
208
+ executables:
163
209
  - netscaler
164
210
  extensions: []
165
- extra_rdoc_files:
211
+
212
+ extra_rdoc_files:
166
213
  - README.markdown
167
- files:
214
+ files:
168
215
  - Gemfile
169
216
  - Gemfile.lock
170
217
  - README.markdown
@@ -196,30 +243,36 @@ files:
196
243
  has_rdoc: true
197
244
  homepage: http://github.com/gabemc/netscaler-cli
198
245
  licenses: []
246
+
199
247
  post_install_message:
200
248
  rdoc_options: []
201
- require_paths:
249
+
250
+ require_paths:
202
251
  - lib
203
- required_ruby_version: !ruby/object:Gem::Requirement
252
+ required_ruby_version: !ruby/object:Gem::Requirement
204
253
  none: false
205
- requirements:
206
- - - ! '>='
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
- required_rubygems_version: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ segments:
258
+ - 0
259
+ version: "0"
260
+ required_rubygems_version: !ruby/object:Gem::Requirement
210
261
  none: false
211
- requirements:
212
- - - ! '>='
213
- - !ruby/object:Gem::Version
214
- version: '0'
262
+ requirements:
263
+ - - ">="
264
+ - !ruby/object:Gem::Version
265
+ segments:
266
+ - 0
267
+ version: "0"
215
268
  requirements: []
269
+
216
270
  rubyforge_project:
217
- rubygems_version: 1.6.1
271
+ rubygems_version: 1.3.7
218
272
  signing_key:
219
273
  specification_version: 3
220
- summary: Simple command line utilities for interacting remotely with a Netscaler load
221
- balancer.
222
- test_files:
274
+ summary: Simple command line utilities for interacting remotely with a Netscaler load balancer.
275
+ test_files:
223
276
  - spec/netscaler/cli_spec.rb
224
277
  - spec/netscaler/config_spec.rb
225
278
  - spec/spec_helpers.rb