Sha256: 8d21f7e5e1cf0d72930acecf7004b01d630691be7d47d68677b76710c7526fd3

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 Bytes

Contents

# 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)
        @code = code
        @url = url
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
triviacrack-0.3.0 lib/triviacrack/errors/request_error.rb