Class: Tabscanner::Credits
- Inherits:
-
Object
- Object
- Tabscanner::Credits
- Extended by:
- HttpClient
- Defined in:
- lib/tabscanner/credits.rb
Overview
Handles credit balance retrieval from the Tabscanner API
This class manages HTTP requests to check the remaining API credits for the authenticated account.
Class Method Summary collapse
-
.get_credits ⇒ Integer
Get remaining API credits for the authenticated account.
Methods included from HttpClient
build_connection, build_raw_response_data, handle_response_with_common_errors, log_request_response, parse_error_message
Class Method Details
.get_credits ⇒ Integer
Get remaining API credits for the authenticated account
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tabscanner/credits.rb', line 22 def self.get_credits config = Tabscanner.config config.validate! # Build the connection conn = build_connection(config, additional_headers: { 'Accept' => 'application/json' }) # Make the GET request to credit endpoint response = conn.get('/api/credit') # Debug logging for request/response log_request_response('GET', '/api/credit', response, config) if config.debug? handle_response_with_common_errors(response) do |resp| parse_credits_response(resp) end end |