lib/clickatell/response.rb in clickatell-0.5.0 vs lib/clickatell/response.rb in clickatell-0.6.0
- old
+ new
@@ -8,9 +8,11 @@
class << self
PARSE_REGEX = /[A-Za-z0-9]+:.*?(?:(?=[A-Za-z0-9]+:)|$)/
# Returns the HTTP response body data as a hash.
def parse(http_response)
+ return { 'OK' => 'session_id' } if API.test_mode
+
if http_response.body.scan(/ERR/).any?
raise Clickatell::API::Error.parse(http_response.body)
end
YAML.load(http_response.body.scan(PARSE_REGEX).join("\n"))
end
\ No newline at end of file