Skip to content

unified-to/unified-ruby-sdk

Repository files navigation

Summary

Unified.to API: One API to Rule Them All

Table of Contents

SDK Installation

The SDK can be installed using RubyGems:

gem install specific_install
gem specific_install https://github.com/unified-to/unified-ruby-sdk 

SDK Example Usage

Example

require 'unified_ruby_sdk'

Models = ::UnifiedRubySDK::Models
s = ::UnifiedRubySDK::UnifiedTo.new(
      security: Models::Shared::Security.new(
        jwt: '<YOUR_API_KEY_HERE>',
      ),
    )

res = s.accounting.create_accounting_account(accounting_account: Models::Shared::AccountingAccount.new(), connection_id: '<id>')

unless res.accounting_account.nil?
  # handle response
end

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme
jwt apiKey API key

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

require 'unified_ruby_sdk'

Models = ::UnifiedRubySDK::Models
s = ::UnifiedRubySDK::UnifiedTo.new(
      security: Models::Shared::Security.new(
        jwt: '<YOUR_API_KEY_HERE>',
      ),
    )

res = s.accounting.create_accounting_account(accounting_account: Models::Shared::AccountingAccount.new(), connection_id: '<id>')

unless res.accounting_account.nil?
  # handle response
end

Available Resources and Operations

Available methods

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 create_accounting_account method throws the following exceptions:

Error Type Status Code Content Type
Errors::APIError 4XX, 5XX */*

Example

require 'unified_ruby_sdk'

Models = ::UnifiedRubySDK::Models
s = ::UnifiedRubySDK::UnifiedTo.new(
      security: Models::Shared::Security.new(
        jwt: '<YOUR_API_KEY_HERE>',
      ),
    )

begin
    res = s.accounting.create_accounting_account(accounting_account: Models::Shared::AccountingAccount.new(), connection_id: '<id>')

    unless res.accounting_account.nil?
      # handle response
    end
rescue Errors::APIError => e
  # handle default exception
  raise e
end

Server Selection

Select Server by Index

You can override the default server globally by passing a server index to the server_idx (Integer) optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

# Server Description
0 https://api.unified.to North American data region
1 https://api-eu.unified.to European data region
2 https://api-au.unified.to Australian data region

Example

require 'unified_ruby_sdk'

Models = ::UnifiedRubySDK::Models
s = ::UnifiedRubySDK::UnifiedTo.new(
      server_idx: 2,
      security: Models::Shared::Security.new(
        jwt: '<YOUR_API_KEY_HERE>',
      ),
    )

res = s.accounting.create_accounting_account(accounting_account: Models::Shared::AccountingAccount.new(), connection_id: '<id>')

unless res.accounting_account.nil?
  # handle response
end

Override Server URL Per-Client

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

require 'unified_ruby_sdk'

Models = ::UnifiedRubySDK::Models
s = ::UnifiedRubySDK::UnifiedTo.new(
      server_url: 'https://api-au.unified.to',
      security: Models::Shared::Security.new(
        jwt: '<YOUR_API_KEY_HERE>',
      ),
    )

res = s.accounting.create_accounting_account(accounting_account: Models::Shared::AccountingAccount.new(), connection_id: '<id>')

unless res.accounting_account.nil?
  # handle response
end

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

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages