Class: Netscaler::ServiceGroup::ServerInfo

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_response, index) ⇒ ServerInfo

Returns a new instance of ServerInfo.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/netscaler/servicegroup/response.rb', line 52

def initialize(raw_response, index)
  @name = raw_response[:servername][:item]
  @ip_address = raw_response[:ipaddress][:item]
  @state = raw_response[:svcstate][:item]
  @port = raw_response[:port][: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 (readonly)

Returns the value of attribute ip_address.



50
51
52
# File 'lib/netscaler/servicegroup/response.rb', line 50

def ip_address
  @ip_address
end

#nameObject (readonly)

Returns the value of attribute name.



50
51
52
# File 'lib/netscaler/servicegroup/response.rb', line 50

def name
  @name
end

#stateObject (readonly)

Returns the value of attribute state.



50
51
52
# File 'lib/netscaler/servicegroup/response.rb', line 50

def state
  @state
end

Instance Method Details

#portObject



67
68
69
# File 'lib/netscaler/servicegroup/response.rb', line 67

def port
  @port.to_i
end

#to_hashObject



71
72
73
74
75
76
77
# File 'lib/netscaler/servicegroup/response.rb', line 71

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