Misar Docs
MisarMailMisar.BlogMisarReachMisarPostMisar.DevMisar PlatformMisar IdentityMisar Posts API
Sdks

Ruby SDK

Official Misar.Dev SDK for Ruby — build, deploy, and manage apps via api.misar.io/dev.

The official Misar.Dev client SDK for Ruby.

Installation

Add to your Gemfile:

gem "misar_dev"

Then run bundle install, or install directly:

gem install misar_dev

Requires Ruby >= 2.6 and depends on faraday >= 2.0.

Quick start

require "misar_dev"

client = MisarDev.new(api_key: "mdk_your_api_key")

projects = client.projects_list
puts projects

Optional keyword arguments override the base URL, retry count, and timeout:

client = MisarDev.new(
  api_key: "mdk_your_api_key",
  base_url: "https://api.misar.io/dev",
  max_retries: 3,
  timeout: 30.0
)

Configuration

Base URL https://api.misar.io/dev; auth Authorization: Bearer <key> (set as a default Faraday header). Retries (default 3) apply to 429, 500, 502, 503, 504 with exponential backoff (base 0.5 s). Default timeout 30 s. Every method returns a parsed Hash.

Resources

This Ruby port (v1.0.0) implements a subset of the full Misar.Dev API:

client.projects_list(params = {})   # GET  /projects
client.projects_create(params)      # POST /projects
client.api_keys_list                # GET  /api-keys
client.usage_get(params = {})       # GET  /usage
client.chat_complete(params)        # POST /chat
client.templates_list               # GET  /templates
  • projectsprojects_list, projects_create
  • apiKeysapi_keys_list
  • usageusage_get
  • chatchat_complete
  • templatestemplates_list

Error handling

The SDK raises two error classes from the MisarDev module:

  • MisarDev::ApiError — raised on any non-200 response. Exposes #status and #error_type (defaults to api_error).
  • MisarDev::NetworkError — subclass of ApiError with status 0 and error type network_error; raised when retries are exhausted on a connection or timeout failure.
begin
  projects = client.projects_list
rescue MisarDev::NetworkError => e
  warn "Network error: #{e.message}"
rescue MisarDev::ApiError => e
  warn "API error #{e.status} (#{e.error_type}): #{e.message}"
end