Module: Onetime

Defined in:
lib/onetime.rb,
lib/onetime/client.rb,
lib/onetime/errors.rb,
lib/onetime/version.rb,
lib/onetime/response.rb,
lib/onetime/transport.rb,
lib/onetime/configuration.rb,
lib/onetime/resources/secrets.rb,
lib/onetime/resources/receipts.rb

Overview

Onetime is the official Ruby client for the OnetimeSecret API.

It supports the v1 and v2 APIs over a zero-dependency, stdlib-only transport. See Onetime::Client for the primary interface.

require "onetime"

client = Onetime::Client.new(
base_url:    "https://ca.onetimesecret.com",
customer:    "ur1abc23def",
api_token:   ENV["ONETIME_API_TOKEN"],
api_version: :v2,
)
res = client.secrets.conceal(secret: "hunter2", ttl: 3600)
res.dig("record", "secret", "secret_value")

Defined Under Namespace

Modules: Errors, Resources Classes: APIError, AccountRequiredError, AuthenticationError, BadRequestError, Client, Configuration, ConfigurationError, ConflictError, EntitlementError, Error, ForbiddenError, NotFoundError, RateLimitError, Response, ServerError, TimeoutError, Transport, TransportError, UnsupportedOperationError

Constant Summary collapse

VERSION =

Library version. Source of truth for the gemspec, the release workflow's tag check, and the X-Onetime-Client / User-Agent request headers.

Note for anyone comparing against RubyGems: 0.5.1 (2013) and earlier are the command-line tool that shipped under this gem name. 0.6.0 is the cleaned-up client library.

"0.6.0"

Class Method Summary collapse

Class Method Details

.client(**options) ⇒ Object

Convenience constructor mirroring Onetime::Client.new.

Onetime.client(base_url: "https://ca.onetimesecret.com",
             customer: "ur1abc23def", api_token: "...")


30
31
32
# File 'lib/onetime.rb', line 30

def self.client(**options)
  Client.new(**options)
end