Sha256: f2a98d5389eed111ffddd1422d43ab5b702134265011752ae363bc5c46791cc1
Contents?: true
Size: 825 Bytes
Versions: 7
Compression:
Stored size: 825 Bytes
Contents
module Ribose class Error < StandardError def initialize(response = nil) @response = response super end def self.from_response(response) status = response[:status].to_i if klass = case status when 400 then Ribose::BadRequest when 401 then Ribose::Unauthorized when 403 then Ribose::Forbidden when 404 then Ribose::NotFound when 422 then Ribose::UnprocessableEntity when 500..599 then Ribose::ServerError end klass.new(response) end end end class BadRequest < Error; end class Unauthorized < Error; end class Forbidden < Error; end class NotFound < Error; end class UnprocessableEntity < Error; end class ServerError < Error; end end
Version data entries
7 entries across 7 versions & 1 rubygems