Project

chemcaster

0.0
No commit activity in last 3 years
No release in over 3 years
A hypertext-driven Ruby client for the Chemcaster cheminformatics Web services platform.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 1.1.4
 Project Readme

Chemcaster Ruby API¶ ↑

This is the Ruby interface for the Chemcaster RESTful Web API. It consists of basic functionality needed to create applications using chemical structure registration, storage, imaging, and search.

Installation¶ ↑

Installation through the Ruby Gem hosted on GitHub is recommended:

# add GitHub to your local list of gem sources:
gem sources -a http://gems.github.com/

# install the gem:
gem install metamolecular-chemcaster

Example Use¶ ↑

Connecting to the Service¶ ↑

require 'rubygems'
require 'chemcaster'

service = Chemcaster::Service.connect 'username', 'password'

Because Chemcaster authenticates using SSL, you’ll need to make sure the Ruby HTTP library can find the root SSL certificates on your system. On Debian Linux systems, these files are found in /etc/ssl/certs. This is also the default location used by the Chemcaster Ruby Client.

To override the default SSL certificates path, pass the root_ca option to the connect method:

service = Chemcaster::Service.connect 'username', 'password',
  :root_ca => 'path/to/root_ssl_certs'

More information can be found here:

Loading a Registry from a Listing¶ ↑

require 'rubygems'
require 'chemcaster'

service = Chemcaster::Service.connect 'username', 'password'
registries = service.registries
registries.size # => 3
registry = registries[0]

Loading a Registry from a URI¶ ↑

require 'rubygems'
require 'chemcaster'

Chemcaster::Service.connect 'username', 'password'

link = Chemcaster::Link.new 'name'=> 'foo',
  'uri' => 'https://chemcaster.com/registries/123456',
  'media_type' => 'application/vnd.com.chemcaster.Registry+json'
registry = link.get

Note: No assumptions should be made about Chemcaster URI layout. Once you receive a resource URI, you can expect it to work at any point in the future for random-access. But URI templates are unnecessary when accessing resources.

Creating a Registry¶ ↑

require 'rubygems'
require 'chemcaster'

service = Chemcaster::Service.connect 'username', 'password'
registries = service.registries

registries.create :name => 'CarboBlocks, Inc.'

Changing a Registry Name¶ ↑

require 'rubygems'
require 'chemcaster'

service = Chemcaster::Service.connect 'username', 'password'
registry = service.registries[0]
registry.update :name => 'CarboBlocks International, Inc.'

API Documentation¶ ↑

RDoc documentation is available at rdoc.info.