class QboApi
200 OK The request succeeded. However, the response body may contain a <Fault> element, indicating an error. 400 Bad request Generally, the request cannot be fulfilled due to bad syntax. In some cases, this response code is returned for a request with bad authorization data. 401 Unauthorized
Authentication or authorization has failed. 403 Forbidden
The resource is forbidden. 404 Not Found The resource is not found. 429 Too Many Requests API Throttling/ Rate limiting 500 Internal Server Error
An error occurred on the server while processing the request. Resubmit request once; if it persists, contact developer support. 502 Bad Gateway The server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request. 503 Service Unavailable The service is temporarily unavailable. 504 Gateway Timeout
Custom error class for rescuing from all QuickBooks Online errors
@private
Constants
- LOG_TAG
- PAYMENTS_API_BASE_URL
- V3_ENDPOINT_BASE_URL
- VERSION
Attributes
Public Class Methods
# File lib/qbo_api.rb, line 32 def initialize(attributes = {}) raise ArgumentError, "missing keyword: access_token" unless attributes.key?(:access_token) raise ArgumentError, "missing keyword: realm_id" unless attributes.key?(:realm_id) attributes = default_attributes.merge!(attributes) attributes.each do |attribute, value| public_send("#{attribute}=", value) end @endpoint_url = get_endpoint end
Public Instance Methods
# File lib/qbo_api.rb, line 48 def connection(url: endpoint_url) @connection ||= authorized_json_connection(url) end
# File lib/qbo_api.rb, line 42 def default_attributes { endpoint: :accounting } end
# File lib/qbo_api.rb, line 52 def endpoint_url @endpoint_url.dup end
Private Instance Methods
# File lib/qbo_api.rb, line 58 def get_endpoint prod = self.class.production { accounting: prod ? V3_ENDPOINT_BASE_URL.sub("sandbox-", '') : V3_ENDPOINT_BASE_URL, payments: prod ? PAYMENTS_API_BASE_URL.sub("sandbox.", '') : PAYMENTS_API_BASE_URL }.fetch(endpoint) do raise KeyError, "Invalid endpoint: #{endpoint.inspect}" end end