Sha256: 5f16051b7049cbc29da6c96f615a448c40f9593fd3e87fdfc39a7f1613957e19
Contents?: true
Size: 1.03 KB
Versions: 5
Compression:
Stored size: 1.03 KB
Contents
module Tiktalik class Error < RuntimeError class BadRequest < Tiktalik::Error def status; 400; end end class Unauthorized < Tiktalik::Error def status; 401; end end class PaymentRequired < Tiktalik::Error def status; 402; end end class Forbidden < Tiktalik::Error def status; 403; end end class NotFound < Tiktalik::Error def status; 404; end end class NotAllowed < Tiktalik::Error def status; 405; end end class Conflict < Tiktalik::Error def status; 409; end end class ServerError < Tiktalik::Error def status; 500; end end class UnknownStatus < Tiktalik::Error def status; 500; end end STATUSES = { 400 => BadRequest, 401 => Unauthorized, 402 => PaymentRequired, 403 => Forbidden, 404 => NotFound, 405 => NotAllowed, 409 => Conflict, 500 => ServerError } def self.find_by_status(status) STATUSES[status.to_i] || UnknownStatus end end end
Version data entries
5 entries across 5 versions & 2 rubygems