Sha256: 9044f56e7f3d148d02817f09d6d957bbfe3a2e2450a6e7f0aa51ade8d9e8d41f
Contents?: true
Size: 689 Bytes
Versions: 13
Compression:
Stored size: 689 Bytes
Contents
module Clickatell class API # Clickatell API Error exception. class Error < StandardError attr_reader :code, :message def initialize(code, message) @code, @message = code, message end # Creates a new Error from a Clickatell HTTP response string # e.g.: # # Error.parse("ERR: 001, Authentication error") # # => #<Clickatell::API::Error code='001' message='Authentication error'> def self.parse(error_string) error_details = error_string.split(':').last.strip code, message = error_details.split(',').map { |s| s.strip } self.new(code, message) end end end end
Version data entries
13 entries across 13 versions & 4 rubygems