Class: Koala::Facebook::GraphErrorChecker
- Inherits:
-
Object
- Object
- Koala::Facebook::GraphErrorChecker
- Defined in:
- lib/koala/api/graph_error_checker.rb
Overview
This class, given a Koala::HTTPService::Response object, will check for Graph API-specific errors. This returns an error of the appropriate type which can be immediately raised (non-batch) or added to the list of batch results (batch)
Constant Summary collapse
- AUTHENTICATION_ERROR_CODES =
Facebook has a set of standardized error codes, some of which represent problems with the token.
[102, 190, 450, 452, 2500]
- DEBUG_HEADERS =
Facebook can return debug information in the response headers – see developers.facebook.com/docs/graph-api/using-graph-api#bugdebug
%w[x-fb-debug x-fb-rev x-fb-trace-id x-business-use-case-usage x-ad-account-usage x-app-usage]
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#http_status ⇒ Object
readonly
Returns the value of attribute http_status.
Instance Method Summary collapse
- #error_if_appropriate ⇒ Object
-
#initialize(http_status, body, headers) ⇒ GraphErrorChecker
constructor
A new instance of GraphErrorChecker.
Constructor Details
#initialize(http_status, body, headers) ⇒ GraphErrorChecker
Returns a new instance of GraphErrorChecker.
8 9 10 11 12 |
# File 'lib/koala/api/graph_error_checker.rb', line 8 def initialize(http_status, body, headers) @http_status = http_status.to_i @body = body @headers = headers end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
7 8 9 |
# File 'lib/koala/api/graph_error_checker.rb', line 7 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/koala/api/graph_error_checker.rb', line 7 def headers @headers end |
#http_status ⇒ Object (readonly)
Returns the value of attribute http_status.
7 8 9 |
# File 'lib/koala/api/graph_error_checker.rb', line 7 def http_status @http_status end |
Instance Method Details
#error_if_appropriate ⇒ Object
22 23 24 25 26 |
# File 'lib/koala/api/graph_error_checker.rb', line 22 def error_if_appropriate if http_status >= 400 error_class.new(http_status, body, error_info) end end |