0.0
The project is in a healthy, maintained state
Ruby SDK for Kintsugi Tax Platform
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 5.27.0
>= 0
~> 1.73.2
>= 0
~> 0.6.12872
~> 0.17.10
~> 0.2.0

Runtime

>= 0.2.0, < 1.0
>= 2.14.1
~> 0.6.12872
 Project Readme

Kintsugi Tax

Developer-friendly & type-safe Ruby SDK specifically catered to leverage Kintsugi's tax API.



Summary

Table of Contents

  • Kintsugi Tax
    • SDK Installation
    • SDK Example Usage
    • Authentication
    • Available Resources and Operations
    • Error Handling
    • Server Selection
    • Debug Logging
  • Development
    • Maturity
    • Contributions

SDK Installation

The SDK can be installed using RubyGems:

gem install kintsugi_sdk

SDK Example Usage

Example

require 'kintsugi_sdk'

Models = ::KintsugiSDK::Models
s = ::KintsugiSDK::OpenApiSDK.new

req = Models::Shared::AddressBase.new(
  phone: '555-123-4567',
  street_1: '1600 Amphitheatre Parkway',
  street_2: 'Building 40',
  city: 'Mountain View',
  county: 'Santa Clara',
  state: 'CA',
  postal_code: '94043',
  country: Models::Shared::CountryCodeEnum::US,
  full_address: '1600 Amphitheatre Parkway, Mountain View, CA 94043'
)
res = s.address_validation.search(request: req, security: Models::Ops::SearchV1AddressValidationSearchPostSecurity.new(
  api_key_header: '<YOUR_API_KEY_HERE>'
))

unless res.nil?
  # handle response
end

Authentication

Per-Client Security Schemes

This SDK supports the following security schemes globally:

Name Type Scheme
api_key_header apiKey API key
custom_header apiKey API key

You can set the security parameters through the security optional parameter when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example:

require 'kintsugi_sdk'

Models = ::KintsugiSDK::Models
s = ::KintsugiSDK::OpenApiSDK.new(
  security: Models::Shared::Security.new(
    api_key_header: '<YOUR_API_KEY_HERE>',
    custom_header: '<YOUR_API_KEY_HERE>'
  )
)

req = Models::Shared::ValidationAddress.new(
  line1: '1600 Amphitheatre Parkway',
  line2: '',
  line3: '',
  city: 'Mountain View',
  state: 'CA',
  postal_code: '94043',
  id: 215,
  county: '',
  full_address: '1600 Amphitheatre Parkway, Mountain View, CA 94043'
)
res = s.address_validation.suggestions(request: req)

unless res.nil?
  # handle response
end

Per-Operation Security Schemes

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

require 'kintsugi_sdk'

Models = ::KintsugiSDK::Models
s = ::KintsugiSDK::OpenApiSDK.new

req = Models::Shared::AddressBase.new(
  phone: '555-123-4567',
  street_1: '1600 Amphitheatre Parkway',
  street_2: 'Building 40',
  city: 'Mountain View',
  county: 'Santa Clara',
  state: 'CA',
  postal_code: '94043',
  country: Models::Shared::CountryCodeEnum::US,
  full_address: '1600 Amphitheatre Parkway, Mountain View, CA 94043'
)
res = s.address_validation.search(request: req, security: Models::Ops::SearchV1AddressValidationSearchPostSecurity.new(
  api_key_header: '<YOUR_API_KEY_HERE>'
))

unless res.nil?
  # handle response
end

Available Resources and Operations

Available methods
  • list - Get Nexus For Org
  • get - Get Product By Id
  • update - Update Product

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

Error Type Status Code Content Type
Models::Errors::ErrorResponse 401 application/json
Models::Errors::BackendSrcAddressValidationResponsesValidationErrorResponse 422 application/json
Models::Errors::ErrorResponse 500 application/json
Errors::APIError 4XX, 5XX */*

Example

require 'kintsugi_sdk'

Models = ::KintsugiSDK::Models
s = ::KintsugiSDK::OpenApiSDK.new

begin
    req = Models::Shared::AddressBase.new(
      phone: '555-123-4567',
      street_1: '1600 Amphitheatre Parkway',
      street_2: 'Building 40',
      city: 'Mountain View',
      county: 'Santa Clara',
      state: 'CA',
      postal_code: '94043',
      country: Models::Shared::CountryCodeEnum::US,
      full_address: '1600 Amphitheatre Parkway, Mountain View, CA 94043'
    )
    res = s.address_validation.search(request: req, security: Models::Ops::SearchV1AddressValidationSearchPostSecurity.new(
      api_key_header: '<YOUR_API_KEY_HERE>'
    ))

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

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 'kintsugi_sdk'

Models = ::KintsugiSDK::Models
s = ::KintsugiSDK::OpenApiSDK.new(
  server_url: 'https://api.trykintsugi.com'
)

req = Models::Shared::AddressBase.new(
  phone: '555-123-4567',
  street_1: '1600 Amphitheatre Parkway',
  street_2: 'Building 40',
  city: 'Mountain View',
  county: 'Santa Clara',
  state: 'CA',
  postal_code: '94043',
  country: Models::Shared::CountryCodeEnum::US,
  full_address: '1600 Amphitheatre Parkway, Mountain View, CA 94043'
)
res = s.address_validation.search(request: req, security: Models::Ops::SearchV1AddressValidationSearchPostSecurity.new(
  api_key_header: '<YOUR_API_KEY_HERE>'
))

unless res.nil?
  # handle response
end

Debug Logging

The SDK provides comprehensive debug logging capabilities to help you troubleshoot API requests and responses. When enabled, debug logging will output detailed information about HTTP requests and responses, including headers and body content.

Enabling Debug Logging

You can enable debug logging in two ways:

Method 1: SDK Initialization Parameter

Pass debug_logging: true when initializing the SDK:

require 'kintsugi_sdk'

Models = ::KintsugiSDK::Models
s = ::KintsugiSDK::OpenApiSDK.new(
  debug_logging: true,
  security: Models::Shared::Security.new(
    api_key_header: '<YOUR_API_KEY_HERE>',
  ),
)

# All API calls will now log request/response details
req = Models::Shared::AddressBase.new(
  phone: '555-123-4567',
  street_1: '1600 Amphitheatre Parkway',
  city: 'Mountain View',
  state: 'CA',
  postal_code: '94043',
  country: Models::Shared::CountryCodeEnum::US,
)

res = s.address_validation.search(request: req)

Method 2: Environment Variable

Set the KINTSUGI_DEBUG environment variable to true:

export KINTSUGI_DEBUG=true
ruby your_script.rb

Or inline:

KINTSUGI_DEBUG=true ruby your_script.rb

Debug Output

When debug logging is enabled, you'll see detailed output like this:

D, [2024-01-15T10:30:45.123456 #12345] DEBUG -- : --> POST https://api.trykintsugi.com/v1/address-validation/search
D, [2024-01-15T10:30:45.123456 #12345] DEBUG -- : Content-Type: "application/json"
D, [2024-01-15T10:30:45.123456 #12345] DEBUG -- : Authorization: "Bearer ***"
D, [2024-01-15T10:30:45.123456 #12345] DEBUG -- : 
D, [2024-01-15T10:30:45.123456 #12345] DEBUG -- : {"phone":"555-123-4567","street_1":"1600 Amphitheatre Parkway"...}
D, [2024-01-15T10:30:45.234567 #12345] DEBUG -- : 
D, [2024-01-15T10:30:45.234567 #12345] DEBUG -- : <-- 200 https://api.trykintsugi.com/v1/address-validation/search
D, [2024-01-15T10:30:45.234567 #12345] DEBUG -- : Content-Type: "application/json"
D, [2024-01-15T10:30:45.234567 #12345] DEBUG -- : 
D, [2024-01-15T10:30:45.234567 #12345] DEBUG -- : {"validated_address":{"street_1":"1600 Amphitheatre Pkwy"...}}

Security Note

⚠️ Important: Debug logging outputs request and response bodies, which may contain sensitive information like API keys, personal data, or other confidential information. Only enable debug logging in development environments and ensure debug logs are not exposed in production systems.

Disabling Debug Logging

Debug logging is disabled by default. To explicitly disable it:

s = ::KintsugiSDK::OpenApiSDK.new(
  debug_logging: false,  # Explicitly disabled
  security: Models::Shared::Security.new(
    api_key_header: '<YOUR_API_KEY_HERE>',
  ),
)

Or unset the environment variable:

unset KINTSUGI_DEBUG

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. 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