/code42_api_ruby

Ruby gem and examples for the Code 42 API (CrashPlan)

Primary LanguageRubyMIT LicenseMIT

NOTICE: Project is no longer maintained

As of November 7th, 2018, Code42 has chosen to no longer actively host this project. The project was archive at this point. All issues have been closed and pull requests rejected. While archived, the source is still available, but this project may be permanantly removed from GitHub in the near future.

Code 42 API Ruby Gem Build Status

A Ruby interface to the Code 42 API

Installation

Add this line to your application's Gemfile:

gem 'code42'

And then execute:

$ bundle

Or install it yourself as:

$ gem install code42

Configuration

client = Code42::Client.new(
  host: 'staging.code42.com',
  port: 1234,
  https: true,
  api_root: '/api/',
  username: 'testuser',
  password: 'letmein'
)

Authentication

token = client.get_token

Then you can pass this token for further requests:

client = Code42::Client.new(
  host: 'staging.code42.com',
  port: 1234,
  https: true,
  api_root: '/api/',
  token: token
)

Resources

User

attributes:

[:id,
 :uid,
 :status,
 :username,
 :email,
 :first_name,
 :last_name,
 :quota_in_bytes,
 :org_id,
 :org_uid,
 :org_name,
 :active,
 :blocked,
 :email_promo,
 :invited,
 :org_type,
 :username_is_an_email,
 :created_at,
 :updated_at]

Org

attributes:

[:id,
 :uid,
 :name,
 :status,
 :active,
 :blocked,
 :parent_id,
 :type,
 :external_id,
 :hierarchy_counts,
 :config_inheritance_counts,
 :created_at,
 :updated_at,
 :registration_key,
 :reporting,
 :custom_config,
 :settings,
 :settings_inherited,
 :settings_summary]

Usage

Ping a host

success = client.ping.success?

Fetch the currently authorized API user

user = client.user

Fetch a user by ID

user = client.user(42)

Fetch the Org for the currently authorized API user

org = client.org

Fetch a specific Org by ID

org = client.org(42)

Validate a token

client.validate_token(token).valid?

Documentation

The project owner will publish a README.md with each project.

The community can created linked and versioned documentation in the Wiki associated with this project:

https://github.com/code42/code42_api_ruby/wiki

Bug / Issue tracking

Please open a new issue. Before opening any issue, please search for existing issues.

Authors/Maintainers

@ncolgan

@melissavoegeli

Contributors

@jrmehle

Code 42 README

What is this?

The Code 42 open source project is a set of frameworks and examples for developing solutions based on the Code 42 CrashPlan REST API.

Our goal is to give developers the tools necessary to build solutions that range from integration efforts to stand-alone application experiences.

Communication

The Code 42 API is available as an open source project on Github, located here:

Announcements, updates, bug fixes and issue tracking are managed within each repository listed.