Class: Snmpjr::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response = {}) ⇒ Response

Returns a new instance of Response.



5
6
7
8
9
# File 'lib/snmpjr/response.rb', line 5

def initialize response = {}
  @error = response[:error] || ''
  @value = response[:value] || ''
  @oid = response[:oid] || ''
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



3
4
5
# File 'lib/snmpjr/response.rb', line 3

def error
  @error
end

#oidObject (readonly)

Returns the value of attribute oid.



3
4
5
# File 'lib/snmpjr/response.rb', line 3

def oid
  @oid
end

Instance Method Details

#==(other) ⇒ Object



23
24
25
26
# File 'lib/snmpjr/response.rb', line 23

def ==(other)
  return false unless other.instance_of?(self.class)
  @error == other.error && to_s == other.to_s && @oid == other.oid
end

#error?Boolean

Returns:

  • (Boolean)


11
12
13
14
15
16
17
# File 'lib/snmpjr/response.rb', line 11

def error?
  if @error.empty?
    false
  else
    true
  end
end

#to_sObject



19
20
21
# File 'lib/snmpjr/response.rb', line 19

def to_s
  @value
end