Sha256: 1512a75d52d6052a5bd96953528438647cce6bc2fbd35b0d00c0ec7d4840b374
Contents?: true
Size: 668 Bytes
Versions: 7
Compression:
Stored size: 668 Bytes
Contents
module TextMagic class API class Error < StandardError attr_reader :code, :message # Creates an instance of TextMagic::API::Error. Error code and message # can be supplied as arguments or as a response hash. # # TextMagic::API::Error.new(code, message) # TextMagic::API::Error.new('error_code' => code, 'error_message' => message) def initialize(*args) if args.first.is_a?(Hash) @code, @message = args.first['error_code'], args.first['error_message'] else @code, @message = args end end def to_s "#{@message} (#{@code})" end end end end
Version data entries
7 entries across 7 versions & 2 rubygems