Octri

Languages

Ruby

The Ruby SDK publishes to RubyGems.

Install

bash
gem install your-org-api-client

Or in a Gemfile:

ruby
gem "your-org-api-client", "~> 1.0"

Options

OptionValuesDefault
Client stylefunctions, namespaced, class, class-namespacedfunctions
Argument styleobject, positionalobject
Namespacetags, pathtags
Doc commentsfull, minimalfull
File headeromit, includeomit
Usage examplefull, concisefull
class fits Ruby's conventions

Ruby consumers expect Acme::Client.new(...). Set Client style to class or class-namespaced for Ruby rather than leaving it on functions.

Package name

Gem names are global and hyphenated by convention. A hyphen implies a namespace, so acme-api suggests Acme::Api:

text
acme-api
Yanking a gem doesn't free the version

RubyGems lets you yank a version, which stops new installs, but the version number stays claimed and the name stays yours forever. See Publishing.

What callers write

ruby
require "acme"

client = Acme::Client.new(token: ENV["ACME_TOKEN"])

client.users.list(limit: 100).each do |user|
  puts user.id
end