Class: Gusto::Employees::AsyncPaymentMethodClient
- Inherits:
-
Object
- Object
- Gusto::Employees::AsyncPaymentMethodClient
- Defined in:
- lib/fern_gusto/employees/payment_method/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create_bank_account(employee_id:, name:, routing_number:, account_number:, account_type:, request_options: nil) ⇒ Object
).
-
#delete_bank_account(employee_id:, bank_account_uuid:, request_options: nil) ⇒ Object
api.employees.payment_method.delete_bank_account(employee_id: “employee_id”, bank_account_uuid: “bank_account_uuid”).
-
#get(employee_id:, request_options: nil) ⇒ Object
api.employees.payment_method.get(employee_id: “employee_id”).
- #initialize(request_client:) ⇒ Gusto::Employees::AsyncPaymentMethodClient constructor
-
#update(employee_id:, version:, type:, split_by: nil, splits: nil, request_options: nil) ⇒ Object
).
-
#update_bank_account(employee_id:, bank_account_uuid:, name:, routing_number:, account_number:, account_type:, request_options: nil) ⇒ Object
).
Constructor Details
#initialize(request_client:) ⇒ Gusto::Employees::AsyncPaymentMethodClient
253 254 255 |
# File 'lib/fern_gusto/employees/payment_method/client.rb', line 253 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ Gusto::AsyncRequestClient (readonly)
248 249 250 |
# File 'lib/fern_gusto/employees/payment_method/client.rb', line 248 def request_client @request_client end |
Instance Method Details
#create_bank_account(employee_id:, name:, routing_number:, account_number:, account_type:, request_options: nil) ⇒ Object
)
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/fern_gusto/employees/payment_method/client.rb', line 281 def create_bank_account(employee_id:, name:, routing_number:, account_number:, account_type:, request_options: nil) Async do response = @request_client.conn.post do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), name: name, routing_number: routing_number, account_number: account_number, account_type: account_type }.compact req.url "#{@request_client.get_url(request_options: )}/v1/employees/#{employee_id}/bank_accounts" end Gusto::EmployeePaymentMethod::EmployeeBankAccount.from_json(json_object: response.body) end end |
#delete_bank_account(employee_id:, bank_account_uuid:, request_options: nil) ⇒ Object
api.employees.payment_method.delete_bank_account(employee_id: “employee_id”, bank_account_uuid: “bank_account_uuid”)
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/fern_gusto/employees/payment_method/client.rb', line 365 def delete_bank_account(employee_id:, bank_account_uuid:, request_options: nil) Async do response = @request_client.conn.delete do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/v1/employees/#{employee_id}/bank_accounts/#{bank_account_uuid}" end end end |
#get(employee_id:, request_options: nil) ⇒ Object
api.employees.payment_method.get(employee_id: “employee_id”)
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 |
# File 'lib/fern_gusto/employees/payment_method/client.rb', line 403 def get(employee_id:, request_options: nil) Async do response = @request_client.conn.get do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/v1/employees/#{employee_id}/payment_method" end Gusto::EmployeePaymentMethod::EmployeePaymentMethodInfo.from_json(json_object: response.body) end end |
#update(employee_id:, version:, type:, split_by: nil, splits: nil, request_options: nil) ⇒ Object
)
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
# File 'lib/fern_gusto/employees/payment_method/client.rb', line 460 def update(employee_id:, version:, type:, split_by: nil, splits: nil, request_options: nil) Async do response = @request_client.conn.put do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), version: version, type: type, split_by: split_by, splits: splits }.compact req.url "#{@request_client.get_url(request_options: )}/v1/employees/#{employee_id}/payment_method" end Gusto::EmployeePaymentMethod::EmployeePaymentMethodInfo.from_json(json_object: response.body) end end |
#update_bank_account(employee_id:, bank_account_uuid:, name:, routing_number:, account_number:, account_type:, request_options: nil) ⇒ Object
)
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
# File 'lib/fern_gusto/employees/payment_method/client.rb', line 328 def update_bank_account(employee_id:, bank_account_uuid:, name:, routing_number:, account_number:, account_type:, request_options: nil) Async do response = @request_client.conn.put do | req | unless &.timeout_in_seconds.nil? req..timeout = .timeout_in_seconds end unless &.token.nil? req.headers["Authorization"] = .token end unless &.gusto_api_version.nil? req.headers["X-Gusto-API-Version"] = .gusto_api_version end req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), name: name, routing_number: routing_number, account_number: account_number, account_type: account_type }.compact req.url "#{@request_client.get_url(request_options: )}/v1/employees/#{employee_id}/bank_accounts/#{bank_account_uuid}" end Gusto::EmployeePaymentMethod::EmployeeBankAccount.from_json(json_object: response.body) end end |