Class: TunnelBroker::APIResponse
- Inherits:
-
Object
- Object
- TunnelBroker::APIResponse
- 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
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #changed? ⇒ Boolean
-
#initialize(response) ⇒ APIResponse
constructor
A new instance of APIResponse.
- #success? ⇒ Boolean
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
#response ⇒ Object (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
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
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 |