Sha256: 97770b3dccfe6ad7984258761a912815f53524545c4c010e02da7801394a6d1e

Contents?: true

Size: 859 Bytes

Versions: 2

Compression:

Stored size: 859 Bytes

Contents

# frozen_string_literal: true

# Public: This error is raised when a web request to the Trivia Crack API is
# unsuccessful.
module TriviaCrack
  module Errors
    class RequestError < StandardError
      # Public: The HTTP status code returned by the Trivia Crack server.
      attr_reader :code

      # Public: The URL that was requested.
      attr_reader :url

      # Public: The response body that was returned by the Trivia Crack server.
      attr_reader :body

      # Public: Initializes a RequestError.
      #
      # code - The HTTP status code returned by the Trivia Crack server.
      # url - The URL that was requested.
      # body - The response body that was returned by the Trivia Crack server.
      def initialize(code, url, body)
        super()
        @code = code
        @url = url
        @body = body
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
triviacrack-0.8.0 lib/triviacrack/errors/request_error.rb
triviacrack-0.7.0 lib/triviacrack/errors/request_error.rb