Class: LiveEnsure::SessionStatusResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/live_ensure/session_status_response.rb

Instance Method Summary collapse

Methods inherited from Response

#initialize

Constructor Details

This class inherits a constructor from LiveEnsure::Response

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/live_ensure/session_status_response.rb', line 32

def failed?
  @hash['message'] == 'FAILED'
end

#parse_otherObject



21
22
23
24
25
26
# File 'lib/live_ensure/session_status_response.rb', line 21

def parse_other
  @response_lines.each do |line|
    key, val = line.split(':').map(&:strip)
    @hash[key] = val
  end
end

#parse_responseObject



10
11
12
13
14
# File 'lib/live_ensure/session_status_response.rb', line 10

def parse_response
  @response_lines = @response.split("\n")
  parse_token
  parse_other
end

#parse_tokenObject



16
17
18
19
# File 'lib/live_ensure/session_status_response.rb', line 16

def parse_token
  split_line = @response_lines.shift.split(':')
  @hash['token'] = split_line[1]
end

#undetermined?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/live_ensure/session_status_response.rb', line 36

def undetermined?
  @hash['message'] == 'SESSION_UNDETERMINED'
end

#valid?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/live_ensure/session_status_response.rb', line 28

def valid?
  @hash['message'] == 'SUCCESS'
end