Skip to content

Repository files navigation

stackone_client

Summary

Accounting: The documentation for the StackOne API The documentation for the StackOne Unified API - HRIS The documentation for the StackOne Unified API - ATS The documentation for the StackOne Unified API - CRM The documentation for the StackOne Unified API - MARKETING The documentation for the StackOne Unified API - LMS The documentation for the StackOne Unified API - IAM The documentation for the StackOne Unified API - TICKETING The documentation for the StackOne Unified API - DOCUMENTS The documentation for the StackOne Unified API - SCREENING The documentation for the StackOne Unified API - MESSAGING The documentation for the StackOne Unified API - ACCOUNTING

Table of Contents

SDK Installation

The SDK can be installed using RubyGems:

gem install stackone_client

SDK Example Usage

List Employees

require'stackone_client'Models= ::StackOne::Modelss= ::StackOne::StackOne.new(security: Models::Shared::Security.new(password: '',username: ''))req=Models::Operations::HrisListEmployeesRequest.new(prefer: 'heartbeat',expand: 'company,employments,work_location,home_location,groups,skills',fields_: 'id,remote_id,title,first_name,last_name,name,display_name,gender,ethnicity,date_of_birth,birthday,marital_status,avatar_url,avatar,personal_email,personal_phone_number,work_email,work_phone_number,job_id,remote_job_id,job_title,job_description,department_id,remote_department_id,department,cost_centers,company,manager_id,remote_manager_id,hire_date,start_date,tenure,work_anniversary,employment_type,employment_contract_type,employment_status,termination_date,company_name,company_id,remote_company_id,preferred_language,citizenships,home_location,work_location,employments,custom_fields,created_at,updated_at,benefits,employee_number,national_identity_number,national_identity_numbers,bank_details,skills,unified_custom_fields',filter: Models::Operations::HrisListEmployeesQueryParamFilter.new(updated_after: DateTime.iso8601('2020-01-01T00:00:00.000Z')),include: 'avatar_url,avatar,custom_fields,job_description,benefits,bank_details',x_account_id: '<id>')res=s.hris.list_employees(request: req)unlessres.employees_paginated.nil?# handle responseend

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

NameTypeScheme
password
username
httpHTTP Basic

You can set the security parameters through the security optional parameter when initializing the SDK client instance. For example:

require'stackone_client'Models= ::StackOne::Modelss= ::StackOne::StackOne.new(security: Models::Shared::Security.new(password: '',username: ''))res=s.accounts.delete_account(id: '<id>')unlessres.linked_account.nil?# handle responseend

Per-Operation Security Schemes

Some operations in this SDK require the security scheme to be specified at the request level. For example:

require'stackone_client'Models= ::StackOne::Modelss= ::StackOne::StackOne.newres=s.mcp.mcp_delete(security: Models::Operations::StackoneMcpDeleteSecurity.new(),mcp_session_id: '<id>',x_account_id: '<id>')ifres.status_code == 200# handle responseend

Available Resources and Operations

Available methods

Retries

Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.

To change the default retry strategy for a single API call, simply provide a RetryConfig object to the call:

require'stackone_client'Models= ::StackOne::Modelss= ::StackOne::StackOne.new(security: Models::Shared::Security.new(password: '',username: ''))res=s.accounts.delete_account(id: '<id>')unlessres.linked_account.nil?# handle responseend

If you'd like to override the default retry strategy for all operations that support retries, you can use the retry_config optional parameter when initializing the SDK:

require'stackone_client'Models= ::StackOne::Modelss= ::StackOne::StackOne.new(retry_config: Utils::RetryConfig.new(backoff: Utils::BackoffStrategy.new(exponent: 1.1,initial_interval: 1,max_elapsed_time: 100,max_interval: 50),retry_connection_errors: false,strategy: 'backoff'),security: Models::Shared::Security.new(password: '',username: ''))res=s.accounts.delete_account(id: '<id>')unlessres.linked_account.nil?# handle responseend

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error.

By default an API error will raise a Errors::APIError, which has the following properties:

PropertyTypeDescription
messagestringThe error message
status_codeintThe HTTP status code
raw_responseFaraday::ResponseThe raw HTTP response
bodystringThe response content

When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective Errors tables in SDK docs for more details on possible exception types for each operation. For example, the delete_account method throws the following exceptions:

Error TypeStatus CodeContent Type
Models::Errors::BadRequestResponse400application/json
Models::Errors::UnauthorizedResponse401application/json
Models::Errors::ForbiddenResponse403application/json
Models::Errors::NotFoundResponse404application/json
Models::Errors::RequestTimedOutResponse408application/json
Models::Errors::ConflictResponse409application/json
Models::Errors::UnprocessableEntityResponse422application/json
Models::Errors::TooManyRequestsResponse429application/json
Models::Errors::InternalServerErrorResponse500application/json
Models::Errors::NotImplementedResponse501application/json
Models::Errors::BadGatewayResponse502application/json
Errors::APIError4XX, 5XX*/*

Example

require'stackone_client'Models= ::StackOne::Modelss= ::StackOne::StackOne.new(security: Models::Shared::Security.new(password: '',username: ''))beginres=s.accounts.delete_account(id: '<id>')unlessres.linked_account.nil?# handle responseendrescueModels::Errors::BadRequestResponse=>e# handle e.container dataraiseerescueModels::Errors::UnauthorizedResponse=>e# handle e.container dataraiseerescueModels::Errors::ForbiddenResponse=>e# handle e.container dataraiseerescueModels::Errors::NotFoundResponse=>e# handle e.container dataraiseerescueModels::Errors::RequestTimedOutResponse=>e# handle e.container dataraiseerescueModels::Errors::ConflictResponse=>e# handle e.container dataraiseerescueModels::Errors::UnprocessableEntityResponse=>e# handle e.container dataraiseerescueModels::Errors::TooManyRequestsResponse=>e# handle e.container dataraiseerescueModels::Errors::InternalServerErrorResponse=>e# handle e.container dataraiseerescueModels::Errors::NotImplementedResponse=>e# handle e.container dataraiseerescueModels::Errors::BadGatewayResponse=>e# handle e.container dataraiseerescueErrors::APIError=>e# handle default exceptionraiseeend

Server Selection

Override Server URL Per-Client

The default server can be overridden globally by passing a URL to the server_url (String) optional parameter when initializing the SDK client instance. For example:

require'stackone_client'Models= ::StackOne::Modelss= ::StackOne::StackOne.new(server_url: 'https://api.stackone.com',security: Models::Shared::Security.new(password: '',username: ''))res=s.accounts.delete_account(id: '<id>')unlessres.linked_account.nil?# handle responseend

Development

Maturity

This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Feel free to open a PR or a Github issue as a proof of concept and we'll do our best to include it in a future release!

SDK Created by Speakeasy

About

StackOne Client Ruby SDK

Resources

Contributing

Stars

4 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages