Class: API::WhatCounts::OneOffMessageResponse

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

Overview

class Response

Instance Attribute Summary

Attributes inherited from Response

#raw_response, #result

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ OneOffMessageResponse

Returns a new instance of OneOffMessageResponse.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/whatcounts/api_response.rb', line 10

def initialize(raw_response)
  if ! (/SUCCESS:/ =~ raw_response).nil?
    # check for success
    self.result = true
  elsif ! (/FAILURE:/ =~ raw_response).nil?
    # check for failure
    self.result = false
  else
    # some other error occurred
    self.result = false
  end
  
  # store the raw response
  self.raw_response = raw_response
end