Class: Netscaler::Server::ServiceInfo
- Inherits:
-
Object
- Object
- Netscaler::Server::ServiceInfo
- Defined in:
- lib/netscaler/server/response.rb
Instance Attribute Summary collapse
-
#ip_address ⇒ Object
readonly
Returns the value of attribute ip_address.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#servicegroup ⇒ Object
readonly
Returns the value of attribute servicegroup.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(raw_response, index) ⇒ ServiceInfo
constructor
A new instance of ServiceInfo.
- #port ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(raw_response, index) ⇒ ServiceInfo
Returns a new instance of ServiceInfo.
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/netscaler/server/response.rb', line 52 def initialize(raw_response, index) @name = raw_response[:servicename][:item] @ip_address = raw_response[:serviceipaddress][:item] @state = raw_response[:svrstate][:item] @port = raw_response[:port][:item] @type = raw_response[:servicetype][:item] if !index.nil? @name = @name[index] @ip_address = @ip_address[index] @state = @state[index] @port = @port[index] @type = @type[index] end @servicegroup = if raw_response[:servicegroupname] && raw_response[:servicegroupname][:item] ServiceGroupInfo.new(raw_response, index) else nil end end |
Instance Attribute Details
#ip_address ⇒ Object (readonly)
Returns the value of attribute ip_address.
50 51 52 |
# File 'lib/netscaler/server/response.rb', line 50 def ip_address @ip_address end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
50 51 52 |
# File 'lib/netscaler/server/response.rb', line 50 def name @name end |
#servicegroup ⇒ Object (readonly)
Returns the value of attribute servicegroup.
50 51 52 |
# File 'lib/netscaler/server/response.rb', line 50 def servicegroup @servicegroup end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
50 51 52 |
# File 'lib/netscaler/server/response.rb', line 50 def state @state end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
50 51 52 |
# File 'lib/netscaler/server/response.rb', line 50 def type @type end |
Instance Method Details
#port ⇒ Object
74 75 76 |
# File 'lib/netscaler/server/response.rb', line 74 def port @port.to_i end |
#to_hash ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/netscaler/server/response.rb', line 78 def to_hash hash = { :name => name, :ip_address => ip_address, :type => type, :state => state, :port => port, } if servicegroup hash[:servicegroup] = servicegroup.to_hash end hash end |