Sha256: b63ada5ce927f4b614bc1aeaab470db5ea8977695abfff43944dd921bbc11f71
Contents?: true
Size: 523 Bytes
Versions: 7
Compression:
Stored size: 523 Bytes
Contents
require 'yaml' module Clickatell # Used to parse HTTP responses returned from Clickatell API calls. class Response 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) 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 end end end
Version data entries
7 entries across 7 versions & 2 rubygems