Class: RunApi::Core::Client
- Inherits:
-
Object
- Object
- RunApi::Core::Client
- Defined in:
- lib/runapi/core/client.rb
Overview
Base class for every RunAPI client. Resolves the API key, builds the shared HTTP client, and exposes the Universal Resources (file upload, account) that are available on any client regardless of which model gem was required.
Provider clients inherit from this and build their model resources from the protected http reader.
Instance Attribute Summary collapse
-
#account ⇒ Account
readonly
Account info and balance operations.
-
#files ⇒ Files
readonly
Temporary file upload operations.
Instance Method Summary collapse
-
#initialize(api_key: nil, **options) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key: nil, **options) ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 22 23 |
# File 'lib/runapi/core/client.rb', line 17 def initialize(api_key: nil, **) @api_key = Core::Auth.resolve_api_key(api_key) = Core::ClientOptions.new(api_key: @api_key, **) @http = .http_client || Core::HttpClient.new() @files = Files.new(@http) @account = Account.new(@http) end |
Instance Attribute Details
#account ⇒ Account (readonly)
Returns Account info and balance operations.
15 16 17 |
# File 'lib/runapi/core/client.rb', line 15 def account @account end |
#files ⇒ Files (readonly)
Returns Temporary file upload operations.
13 14 15 |
# File 'lib/runapi/core/client.rb', line 13 def files @files end |