Class: Couchbase::PingResult::ServiceInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/couchbase/diagnostics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|self| ... } ⇒ ServiceInfo

Returns a new instance of ServiceInfo.

Yield Parameters:



126
127
128
129
# File 'lib/couchbase/diagnostics.rb', line 126

def initialize
  @error = nil
  yield self if block_given?
end

Instance Attribute Details

#errorString?



114
115
116
# File 'lib/couchbase/diagnostics.rb', line 114

def error
  @error
end

#idString



102
103
104
# File 'lib/couchbase/diagnostics.rb', line 102

def id
  @id
end

#latencyInteger



117
118
119
# File 'lib/couchbase/diagnostics.rb', line 117

def latency
  @latency
end

#localString



123
124
125
# File 'lib/couchbase/diagnostics.rb', line 123

def local
  @local
end

#remoteString



120
121
122
# File 'lib/couchbase/diagnostics.rb', line 120

def remote
  @remote
end

#stateSymbol

Possible states are:

:ok

endpoint is healthy

:timeout

endpoint didn’t respond in time

:error

request to endpoint has failed, see #error for additional details



111
112
113
# File 'lib/couchbase/diagnostics.rb', line 111

def state
  @state
end

Instance Method Details

#to_json(*args) ⇒ Object



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/couchbase/diagnostics.rb', line 131

def to_json(*args)
  data = {
    id: @id,
    state: @state,
    remote: @remote,
    local: @local,
    latency: @latency,
  }
  data[:error] = @error if @error
  data.to_json(*args)
end