Menu

Ruby

Packet Ruby API Client Banner

Welcome to Packet Ruby API Client.

Installation

gem install packethost

Configuration

You can either configure the library in a global way (easier):

Packet.configure do |config|
  config.auth_token = 'my_token'
end

or create and use an individual instance of Packet::Client (more complex):

Packet::Client.new(auth_token)

Generally speaking, you'll probably want to configure it globally if you only ever use a single API token.

Usage

If you configured the library globally, you can just call methods on the Packet module. For example:

Packet.list_projects
=> [#<Packet::Project>, #<Packet::Project>]

If you configured a Packet::Client manually, you can call those same methods on the client itself:

client = Packet::Client.new( ... )
client.list_projects
=> [#<Packet::Project>, #<Packet::Project>]

See a list of available methods.

For more information, please visit Packet Ruby CLI public repo.

Was it helpful?