Class: RunApi::Core::PricingClient

Inherits:
Pricing
  • Object
show all
Defined in:
lib/runapi/core/pricing.rb

Overview

Standalone live Pricing client with optional API authentication.

Constant Summary

Constants inherited from Pricing

RunApi::Core::Pricing::QUOTES_ENDPOINT, RunApi::Core::Pricing::SCHEDULES_ENDPOINT

Instance Method Summary collapse

Methods inherited from Pricing

#list, #quote

Constructor Details

#initialize(api_key: nil, **options) ⇒ PricingClient

Returns a new instance of PricingClient.



85
86
87
88
89
90
91
92
# File 'lib/runapi/core/pricing.rb', line 85

def initialize(api_key: nil, **options)
  client_options = Core::ClientOptions.new(
    api_key: Core::Auth.resolve_optional_api_key(api_key),
    **options
  )
  @owns_http_client = client_options.http_client.nil?
  super(client_options.http_client || Core::HttpClient.new(client_options))
end

Instance Method Details

#closeObject

Closes the SDK-created HTTP client. Injected clients remain caller-owned.



95
96
97
# File 'lib/runapi/core/pricing.rb', line 95

def close
  @http.close if @owns_http_client
end