Class: Gusto::AsyncClient
- Inherits:
-
BaseAsyncClient
- Object
- BaseAsyncClient
- Gusto::AsyncClient
- Defined in:
- lib/fern_gusto.rb
Defined Under Namespace
Classes: Options
Instance Attribute Summary
Attributes inherited from BaseAsyncClient
#ach_transactions, #companies, #contractors, #employees, #events, #flows, #generated_documents, #holiday_pay_policies, #invoices, #notifications, #payroll, #recovery_cases, #reports, #time_off_policies, #token, #webhooks, #wire_in_requests
Instance Method Summary collapse
-
#initialize(auth:, environment: Gusto::Environment::DEMO, base_url: nil, max_retries: nil, timeout_in_seconds: nil, gusto_api_version: nil) ⇒ Gusto::AsyncClient
constructor
Instantiate a new asynchronous Gusto API client.
Constructor Details
#initialize(auth:, environment: Gusto::Environment::DEMO, base_url: nil, max_retries: nil, timeout_in_seconds: nil, gusto_api_version: nil) ⇒ Gusto::AsyncClient
Instantiate a new asynchronous Gusto API client
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/fern_gusto.rb', line 209 def initialize(auth:, environment: Gusto::Environment::DEMO, base_url: nil, max_retries: nil, timeout_in_seconds: nil, gusto_api_version: nil) token_supplier = case auth when SystemAccessTokenAuth refresher = SystemAccessTokenRefresher.new( auth.client_id, auth.client_secret ) -> { refresher.get_token } when CompanyAccessTokenAuth refresher = CompanyAccessTokenRefresher.new( auth.client_id, auth.client_secret, auth.redirect_uri, auth.refresh_token ) -> { refresher.get_token } when TokenAuth -> { auth.token } end @async_request_client = Gusto::AsyncRequestClient.new( base_url: base_url, environment: environment, max_retries: max_retries, timeout_in_seconds: timeout_in_seconds, token: token_supplier, gusto_api_version: gusto_api_version ) super( environment: environment, token: token_supplier ) end |