Sha256: 5d8a8e10d11563456c8bb736db00ccee7416e8c59202771d976731fed2bb5817
Contents?: true
Size: 767 Bytes
Versions: 2
Compression:
Stored size: 767 Bytes
Contents
module Ivapi class Error < StandardError # Returns the appropriate Ivapi::Error sublcass based # on status and response message. # # response - The Hash of HTTP response. # # Returns the Ivapi::Error. def self.from_response(response) status = response[:status].to_i klass = case status when 400 then Ivapi::BadRequest when 401 then Ivapi::Unauthorized when 403 then Ivapi::Forbidden end klass.new(response) if klass end end # Raised when iv.lt returns a 400 HTTP status code class BadRequest < Error; end # Raised when iv.lt returns a 401 HTTP status code class Unauthorized < Error; end # Raised when iv.lt returns a 403 HTTP status code class Forbidden < Error; end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ivapi-1.5.0 | lib/ivapi/error.rb |
ivapi-1.4.0 | lib/ivapi/error.rb |