Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

testttttttttttttttomgomgomg12

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testttttttttttttttomgomgomg12

  • 0.0.1.pre.alpha.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Sink Ruby API library

The Sink Ruby library provides convenient access to the Sink REST API from any Ruby 3.0+ application.

It is generated with Stainless.

Documentation

Documentation for the most recent version of this gem can be found on RubyDoc.

The underlying REST API documentation can be found on stainlessapi.com.

Installation

To use this gem during the beta, install directly from GitHub with Bundler by adding the following to your application's Gemfile:

gem "sink", git: "https://github.com/stainless-sdks/sink-ruby", branch: "main"

To fetch an initial copy of the gem:

bundle install

To update the version used by your application when updates are pushed to GitHub:

bundle update sink

Usage

require "sink"

sink = Sink::Client.new(
  user_token: "My User Token", # defaults to ENV["SINK_CUSTOM_API_KEY_ENV"]
  environment: "sandbox", # defaults to "production"
  username: "Robert",
  some_number_arg_required_no_default: 0,
  some_number_arg_required_no_default_no_env: 0,
  required_arg_no_env: "<example>"
)

card = sink.cards.create(
  type: "SINGLE_USE",
  exp_month: "08",
  not_: "TEST",
  shipping_address: {
    "address1" => "180 Varick St",
    "city" => "New York",
    "country" => "USA",
    "first_name" => "Jason",
    "last_name" => "Mimosa",
    "state" => "NY",
    "postal_code" => "H0H0H0"
  }
)

puts card.token

Errors

When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of Sink::HTTP::Error will be thrown:

begin
  sink.cards.create(type: "an_incorrect_type")
rescue Sink::HTTP::Error => e
  puts e.code # 400
end

Error codes are as followed:

Status CodeError Type
400BadRequestError
401AuthenticationError
403PermissionDeniedError
404NotFoundError
409ConflictError
422UnprocessableEntityError
429RateLimitError
>=500InternalServerError
(else)APIStatusError
N/AAPIConnectionError

Retries

Certain errors will be automatically retried 1 times by default, with a short exponential backoff. Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried by default.

You can use the max_retries option to configure or disable this:

# Configure the default for all requests:
sink = Sink::Client.new(
  max_retries: 0, # default is 1
  username: "Robert",
  some_number_arg_required_no_default: 0,
  some_number_arg_required_no_default_no_env: 0,
  required_arg_no_env: "<example>"
)

# Or, configure per-request:
sink.cards.provision_foo("my card token", digital_wallet: "GOOGLE_PAY", max_retries: 5)

Versioning

This package follows SemVer conventions. As the library is in initial development and has a major version of 0, APIs may change at any time.

Requirements

Ruby 3.0 or higher.

FAQs

Package last updated on 02 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc