Sha256: 05ec32ccb928639c447a20c5e0df4c388f1db71473c87dd90dcc88383629873e

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

module RDStation
  class Error < StandardError
    attr_reader :details, :http_status, :headers, :body

    def initialize(details)
      @details = details
      message = details['error_message']
      raise ArgumentError, 'The details hash must contain an error message' unless message

      super(message)
    end

    class BadRequest < Error; end
    class Unauthorized < Error; end
    class Forbidden < Error; end
    class NotFound < Error; end
    class MethodNotAllowed < Error; end
    class NotAcceptable < Error; end
    class Conflict < Error; end
    class UnsupportedMediaType < Error; end
    class UnprocessableEntity < Error; end
    class TooManyRequests < Error; end
    class InternalServerError < Error; end
    class NotImplemented < Error; end
    class BadGateway < Error; end
    class ServiceUnavailable < Error; end
    class ServerError < Error; end
    class UnknownError < Error; end

    # 400 - Bad Request
    class ConflictingField < BadRequest; end
    class InvalidEventType < BadRequest; end

    # 401 - Unauthorized
    class ExpiredAccessToken < Unauthorized; end
    class ExpiredCodeGrant < Unauthorized; end
    class InvalidCredentials < Unauthorized; end
    class InvalidRefreshToken < Unauthorized; end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.9.0 lib/rdstation/error.rb
rdstation-ruby-client-2.8.2 lib/rdstation/error.rb
rdstation-ruby-client-2.8.1 lib/rdstation/error.rb
rdstation-ruby-client-2.8.0 lib/rdstation/error.rb
rdstation-ruby-client-2.7.0 lib/rdstation/error.rb
rdstation-ruby-client-2.6.0 lib/rdstation/error.rb
rdstation-ruby-client-2.5.3 lib/rdstation/error.rb
rdstation-ruby-client-2.5.2 lib/rdstation/error.rb
rdstation-ruby-client-2.5.1 lib/rdstation/error.rb
rdstation-ruby-client-2.5.0 lib/rdstation/error.rb