Class: Gusto::Client
- Inherits:
-
BaseClient
- Object
- BaseClient
- Gusto::Client
- Defined in:
- lib/fern_gusto.rb
Defined Under Namespace
Classes: Options
Instance Attribute Summary
Attributes inherited from BaseClient
#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::Client
constructor
Instantiate a new 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::Client
Instantiate a new Gusto API client
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/fern_gusto.rb', line 122 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 @request_client = Gusto::RequestClient.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.call, ) end |