KamateraApiWrapper
A small Ruby client for authenticating with Kamatera and calling server endpoints (GET /servers etc).
Installation
Add to your Gemfile:
gem "kamatera_api_wrapper"
Then:
bundle install
Usage
require "kamatera_api_wrapper"
client = KamateraApiWrapper::Client.new(
client_id: "your_client_id",
client_secret: "your_secret"
)
# authenticate explicitly (optional, client will auto-auth on first request)
client.authenticate!
# list servers
servers = client.servers
puts servers.inspect
Configuration options
You can pass options to the client:
base_url— default"https://console.kamatera.com"timeout— Faraday open/read timeout in seconds (default:10)token_expiry_margin— seconds to subtract from expiry to refresh early (default:30)
Example:
client = KamateraApiWrapper::Client.new(
client_id: "...",
client_secret: "...",
base_url: "https://console.kamatera.com",
timeout: 15,
token_expiry_margin: 10
)
Tests
Run:
bundle exec rspec
Notes
- Token caching is in-memory in the
Clientinstance. For multi-process environments or long-running services you should persist token(s) appropriately. Application/jsonContent-Type is used for authentication per Kamatera API requirement.