Skip to content

kombohq/ruby-sdk

Repository files navigation

kombo

Developer-friendly & type-safe Ruby SDK for the Kombo Unified API.


Note

The Kombo Ruby SDK is currently in beta. The core API structure, methods, and input/output objects are considered stable. We may still make minor adjustments, but all changes will be clearly documented in the changelog. We do not foresee any blockers for production use.

Table of Contents

SDK Installation

The SDK can be installed using RubyGems:

gem install kombo

SDK Example Usage

require 'kombo'

Models = ::Kombo::Models
s = ::Kombo::Kombo.new(
  security: Models::Shared::Security.new(
    api_key: '<YOUR_BEARER_TOKEN_HERE>',
  ),
)

res = s.general.check_api_key()

unless res.get_check_api_key_positive_response.nil?
  # handle response
end

Specifying an integration ID

The majority of Kombo API endpoints are for interacting with a single "integration" (i.e., a single connection to one of your customers' systems). For these endpoints, specify the integration_id when initializing the SDK:

require 'kombo'

Models = ::Kombo::Models
s = ::Kombo::Kombo.new(
  integration_id: 'workday:HWUTwvyx2wLoSUHphiWVrp28',
  security: Models::Shared::Security.new(
    api_key: '<YOUR_BEARER_TOKEN_HERE>',
  ),
)

res = s.hris.get_employees()

unless res.get_employees_positive_response.nil?
  # handle response
end

Region Selection

The Kombo platform is available in two regions: Europe and United States.

By default, the SDK uses the EU region. If you use the US region (hosted at api.us.kombo.dev), set the server option when initializing the SDK:

Example

require 'kombo'

Models = ::Kombo::Models
s = ::Kombo::Kombo.new(
  server: :us,
  security: Models::Shared::Security.new(
    api_key: '<YOUR_BEARER_TOKEN_HERE>',
  ),
)

Available Resources and Operations

Available methods

Pagination

Some of the endpoints in this SDK support pagination. You make your SDK calls as usual, but the returned response object also supports iteration so you can consume all pages in a loop.

Here's an example using get_integration_fields:

require 'kombo'

Models = ::Kombo::Models
s = ::Kombo::Kombo.new(
  security: Models::Shared::Security.new(
    api_key: '<YOUR_BEARER_TOKEN_HERE>',
  ),
)

result = s.general.get_integration_fields(integration_id: '<id>')

result.each do |page|
  puts page
end

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:

Property Type Description
message string The error message
status_code int The HTTP status code
raw_response Faraday::Response The raw HTTP response
body string The 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 check_api_key method throws the following exceptions:

Error Type Status Code Content Type
Models::Errors::KomboGeneralError default application/json
Errors::APIError 4XX, 5XX */*

Example

require 'kombo'

Models = ::Kombo::Models
s = ::Kombo::Kombo.new(
      security: Models::Shared::Security.new(
        api_key: '<YOUR_BEARER_TOKEN_HERE>',
      ),
    )

begin
    res = s.general.check_api_key()

    unless res.get_check_api_key_positive_response.nil?
      # handle response
    end
rescue Models::Errors::KomboGeneralError => e
  # handle e.container data
  raise e
rescue Errors::APIError => e
  # handle default exception
  raise e
end

Custom HTTP Client

The Ruby SDK uses Faraday for HTTP. You can pass a custom connection when initializing the client if you need to customize behavior.

Debugging

You can enable debug logging by configuring your logger and passing it to the SDK client when supported. Be careful not to log secrets (e.g. API keys) in production.

Requirements

This SDK supports Ruby 3.0 and above.

Development

Contributions

While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.

SDK Created by Speakeasy

About

⚡ Official Ruby SDK for the Kombo Unified API

Topics

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages