Permalink
Browse files

Finish documentation

  • Loading branch information...
1 parent 25e61cd commit ec9c740f02ffa2e803aa215fcc3c09138fd85dcb @kyledrake kyledrake committed Jan 8, 2012
Showing with 43 additions and 3 deletions.
  1. +24 −1 lib/geoloqi/error.rb
  2. +18 −1 lib/geoloqi/response.rb
  3. +1 −1 lib/geoloqi/session.rb
View
@@ -1,6 +1,26 @@
module Geoloqi
+ # Used for Geoloqi API errors (errors originating from the API server itself).
class ApiError < StandardError
- attr_reader :status, :type, :reason
+ # Status code of error
+ # @return [Fixnum]
+ # @example
+ # 404, 500
+ attr_reader :status
+
+ # Type of error
+ # @return [String]
+ # @example
+ # "not_found", "invalid_input"
+ attr_reader :type
+
+ # Human-readable explanation of error.
+ # @return [String]
+ # @example
+ # "The requested resource could not found"
+ attr_reader :reason
+
+ # Instantiate a new ApiError object
+ # @return [ApiError]
def initialize(status, type, reason=nil)
@status = status
@type = type
@@ -12,6 +32,9 @@ def initialize(status, type, reason=nil)
end
end
+ # Used for config errors.
class Error < StandardError; end
+
+ # Used for argument errors.
class ArgumentError < ArgumentError; end
end
View
@@ -1,6 +1,23 @@
module Geoloqi
class Response
- attr_reader :status, :headers, :body
+ # The HTTP status code of the response
+ # @return [Fixnum]
+ attr_reader :status
+
+ # The HTTP Headers of the response
+ # @return [Hash]
+ attr_reader :headers
+
+ # The body of the response
+ # @return [String]
+ attr_reader :body
+
+ # Instantiate a response object.
+ # @param status [Fixnum] The HTTP status code of the response
+ # @param headers [Hash] The HTTP Headers of the response
+ # @param body [String] The body of the response
+ # @example
+ # Geoloqi::Response.new 200, {'Server' => 'geoloqi-platform'}, '{"response":"ok"}'
def initialize(status, headers, body)
@status = status
@headers = headers
View
@@ -72,7 +72,7 @@ def authorize_url(redirect_uri=@config.redirect_uri, opts={})
# Makes a GET request to the Geoloqi API server and returns response.
#
# @param [String] path
- # Path to the resource being requested (example: '/account/profile').
+ # Path to the resource being requested.
#
# @param [String, Hash] query (optional)
# A query string or Hash to be appended to the request.

0 comments on commit ec9c740

Please sign in to comment.