Sha256: 0fdf74863855d473ddcd57aca2a5c0d481b0e36e5297a6e5ae599f64e9d3097c

Contents?: true

Size: 811 Bytes

Versions: 5

Compression:

Stored size: 811 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
        @body = body
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
triviacrack-0.6.0 lib/triviacrack/errors/request_error.rb
triviacrack-0.5.1 lib/triviacrack/errors/request_error.rb
triviacrack-0.5.0 lib/triviacrack/errors/request_error.rb
triviacrack-0.4.0 lib/triviacrack/errors/request_error.rb
triviacrack-0.3.2 lib/triviacrack/errors/request_error.rb