Class: Netscaler::VServer::ServiceInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/netscaler/vserver/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_response, index) ⇒ ServiceInfo

Returns a new instance of ServiceInfo.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/netscaler/vserver/response.rb', line 86

def initialize(raw_response, index)
  @name = raw_response[:servicename][:item]
  @ip_address = raw_response[:svcipaddress][:item]
  @state = raw_response[:svcstate][:item]
  @port = raw_response[:svcport][:item]
  @type = raw_response[:svctype][:item]

  if !index.nil?
    @name = @name[index]
    @ip_address = @ip_address[index]
    @state = @state[index]
    @port = @port[index]
    @type = @type[index]
  end
end

Instance Attribute Details

#ip_addressObject

Returns the value of attribute ip_address.



84
85
86
# File 'lib/netscaler/vserver/response.rb', line 84

def ip_address
  @ip_address
end

#nameObject

Returns the value of attribute name.



84
85
86
# File 'lib/netscaler/vserver/response.rb', line 84

def name
  @name
end

#stateObject

Returns the value of attribute state.



84
85
86
# File 'lib/netscaler/vserver/response.rb', line 84

def state
  @state
end

#typeObject

Returns the value of attribute type.



84
85
86
# File 'lib/netscaler/vserver/response.rb', line 84

def type
  @type
end

Instance Method Details

#portObject



102
103
104
# File 'lib/netscaler/vserver/response.rb', line 102

def port
  @port.to_i
end

#to_hashObject



106
107
108
109
110
111
112
113
# File 'lib/netscaler/vserver/response.rb', line 106

def to_hash
  { :name => name,
    :ip_address => ip_address,
    :state => state,
    :port => port,
    :type => type
  }
end