Class: TunnelBroker::APIResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/tunnelbroker/api_response.rb

Overview

class to give some helpful handling of the TunnelBroker API response

Constant Summary collapse

BADAUTH =
/^(badauth)$/
CHANGE =
/^(good)\s(\d+\.\d+\.\d+\.\d+)$/
NO_CHANGE =
/^(nochg)\s(\d+\.\d+\.\d+\.\d+)$/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ APIResponse

Returns a new instance of APIResponse.



14
15
16
# File 'lib/tunnelbroker/api_response.rb', line 14

def initialize(response)
  parse_response(response.lines.first)
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/tunnelbroker/api_response.rb', line 8

def response
  @response
end

Instance Method Details

#changed?Boolean

Returns:

  • (Boolean)


26
27
28
29
30
31
32
# File 'lib/tunnelbroker/api_response.rb', line 26

def changed?
  if @changed.nil?
    false
  else
    @changed
  end
end

#success?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
# File 'lib/tunnelbroker/api_response.rb', line 18

def success?
  if @success.nil?
    false
  else
    @success
  end
end