Class: QboApi

Inherits:
Object
  • Object
show all
Extended by:
Configuration
Includes:
ApiMethods, Attachment, Connection, Entity, Supporting, Util
Defined in:
lib/qbo_api/error.rb,
lib/qbo_api.rb,
lib/qbo_api/util.rb,
lib/qbo_api/entity.rb,
lib/qbo_api/version.rb,
lib/qbo_api/attachment.rb,
lib/qbo_api/connection.rb,
lib/qbo_api/supporting.rb,
lib/qbo_api/api_methods.rb,
lib/qbo_api/configuration.rb

Overview

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. 503 Service Unavailable The service is temporarily unavailable. Custom error class for rescuing from all QuickBooks Online errors

Defined Under Namespace

Modules: ApiMethods, Attachment, Configuration, Connection, Entity, Supporting, Util Classes: BadRequest, Error, Forbidden, InternalServerError, NotFound, NotImplementedError, ServiceUnavailable, TooManyRequests, Unauthorized

Constant Summary collapse

REQUEST_TOKEN_URL =
'https://oauth.intuit.com/oauth/v1/get_request_token'
ACCESS_TOKEN_URL =
'https://oauth.intuit.com/oauth/v1/get_access_token'
APP_CENTER_BASE =
'https://appcenter.intuit.com'
APP_CENTER_URL =
APP_CENTER_BASE + '/Connect/Begin?oauth_token='
V3_ENDPOINT_BASE_URL =
'https://sandbox-quickbooks.api.intuit.com/v3/company/'
PAYMENTS_API_BASE_URL =
'https://sandbox.api.intuit.com/quickbooks/v4/payments'
APP_CONNECTION_URL =
APP_CENTER_BASE + '/api/v1/connection'
LOG_TAG =
"[QuickBooks]"
VERSION =
"1.8.0"

Instance Attribute Summary collapse

Attributes included from Util

#minor_version

Instance Method Summary collapse

Methods included from Configuration

log, log=, logger, logger=, minor_version, minor_version=, production, production=, request_id, request_id=

Methods included from ApiMethods

#all, #create, #deactivate, #delete, #get, #get_by_query_filter, #query, #update

Methods included from Attachment

#attachment_connection, #upload_attachment

Methods included from Util

#add_minor_version_to, #add_params_to_path, #add_request_id_to, #cdc_time, #esc, #finalize_path, #uuid

Methods included from Entity

#entity_path, #extract_entity_from_query, #is_name_list_entity?, #is_transaction_entity?, #name_list_entities, #singular, #snake_to_camel, #supporting_entities, #transaction_entities

Methods included from Supporting

#batch, #cdc, #reports

Methods included from Connection

#authorized_json_connection, #authorized_multipart_connection, #build_connection, #disconnect, #parse_response_body, #raw_request, #reconnect, #request, #response

Constructor Details

#initialize(token: nil, token_secret: nil, access_token: nil, realm_id:, consumer_key: nil, consumer_secret: nil, endpoint: :accounting) ⇒ QboApi

Returns a new instance of QboApi.



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/qbo_api.rb', line 36

def initialize(token: nil, token_secret: nil, access_token: nil, realm_id:,
               consumer_key: nil, consumer_secret: nil, endpoint: :accounting)
  @consumer_key = consumer_key || (defined?(CONSUMER_KEY) ? CONSUMER_KEY : nil)
  @consumer_secret = consumer_secret || (defined?(CONSUMER_SECRET) ? CONSUMER_SECRET : nil)
  @token = token
  @token_secret = token_secret
  @access_token = access_token
  @realm_id = realm_id
  @endpoint = endpoint
  @endpoint_url = get_endpoint
end

Instance Attribute Details

#realm_idObject (readonly)

Returns the value of attribute realm_id.



25
26
27
# File 'lib/qbo_api.rb', line 25

def realm_id
  @realm_id
end

Instance Method Details

#connection(url: @endpoint_url) ⇒ Object



48
49
50
# File 'lib/qbo_api.rb', line 48

def connection(url: @endpoint_url)
  @connection ||= authorized_json_connection(url)
end