The project is in a healthy, maintained state
The Comet Server can be controlled via an API over HTTP / HTTPS.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1.4
~> 5.14
~> 13.0
~> 0.88
 Project Readme

Ruby SDK for the Comet Server API

@CometBackup on Twitter Gem Version MIT License

The Comet Server API allows you to create and manage customer accounts on your Comet Server.

Comet Licensing Ltd makes this library freely available under the MIT license; you may embed it in any Ruby project, either free or commercial, as long as the copyright header comment remains intact in the *.rb files.

Features

  • Full coverage of Comet Server API methods, data structures, and constant definitions

Version compatibility

This library uses Semantic Versioning. However, large parts of this library are autogenerated from internal protocol descriptions from a specific version of Comet Server; to find the source Comet Server version, check the Comet::APPLICATION_VERSION constant.

Newer API libraries can be safely used with older versions of Comet Server, however some features may be unavailable, and any new API properties will be unrecognized and ignored by the Comet Server.

Older API libraries can be safely used with newer versions of Comet Server. Unknown API properties corresponding to new Comet Server features will be preserved via the @unknown_json_fields system.

Getting Started

This package is provided as a Gem hosted on rubygems.org.

Install using Bundler:

echo "gem 'comet_backup_ruby_sdk'" >> Gemfile
bundle

Or install using Gem:

gem install comet_backup_ruby_sdk

To compile the Gem from source:

git clone https://github.com/CometBackup/comet-ruby-sdk.git
cd comet-ruby-sdk
gem build comet_backup_ruby_sdk.gemspec

Usage

Connect to the Comet Server and iterate through user profiles:

require 'comet_backup_ruby_sdk'

client = Comet::CometServer.new("http://127.0.0.1:8060", "admin", "admin")

client.admin_list_users_full.each do |username, profile|
  puts "#{username} has #{profile.destinations.length} Storage Vault(s)"
end

Error handling

The Comet Server API always returns an HTTP 200 status code, and puts application-level errors in the response message body using the Comet::CometAPIResponseMessage structure. This helps to distinguish between network-level errors and proxy-level errors. This SDK converts application-level errors to raise exceptions:

begin
  client.admin_get_user_profile('non_existent_user')

rescue Comet::APIResponseError => err
  if err.detail.status >= 400 && err.detail.status < 500
    puts "Comet Server returned caller-side error (4xx) - permanent, do not retry"
  else
    puts "Comet Server returned server-side error (5xx) - may want to retry"
  end

rescue StandardError
  puts "Failed to reach the Comet Server (non-200 HTTP status code) - may want to retry"
end

Running SDK test suite

# safe formatting/fixing and linting
bundle exec rake rubocop -a

  COMETSERVER_ADDRESS='http://127.0.0.1:8060' \
	COMETSERVER_ADMINUSER=admin \
	COMETSERVER_ADMINPASS=admin \
	bundle exec rake test

Getting Help

Bug reports and pull requests are welcome on GitHub at https://github.com/CometBackup/comet-ruby-sdk.

You may also submit issues via the ticket system at cometbackup.com.