metamolecular-chemcaster 0.1.6 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = Chemcaster Ruby API
1
+ = Chemcaster[http://chemcaster.com] Ruby API
2
2
 
3
3
  This is the Ruby interface for the Chemcaster[http://chemcaster.com] RESTful Web
4
4
  API. It consists of basic functionality needed to create
@@ -24,7 +24,24 @@ Installation through the Ruby Gem hosted on GitHub is recommended:
24
24
 
25
25
  service = Chemcaster::Service.connect 'username', 'password'
26
26
 
27
- === Loading a Registry
27
+ Because Chemcaster[http://chemcaster.com] authenticates using SSL, you'll need to make sure the
28
+ Ruby HTTP library can find the root SSL certificates on your system. On
29
+ Debian Linux systems, these files are found in /etc/ssl/certs. This is
30
+ also the default location used by the Chemcaster Ruby Client.
31
+
32
+ To override the default SSL certificates path, pass the +root_ca+ option to the
33
+ +connect+ method:
34
+
35
+ service = Chemcaster::Service.connect 'username', 'password',
36
+ :root_ca => 'path/to/root_ssl_certs'
37
+
38
+ More information can be found here:
39
+
40
+ * {Making an HTTPS Web Request}[http://codeidol.com/other/rubyckbk/Internet-Services/Making-an-HTTPS-Web-Request]
41
+ * {SSL Certificates and Net::HTTPS}[http://redcorundum.blogspot.com/2008/03/ssl-certificates-and-nethttps.html]
42
+ * {Verified HTTPS in Ruby}[http://notetoself.vrensk.com/2008/09/verified-https-in-ruby]
43
+
44
+ === Loading a Registry from a Listing
28
45
 
29
46
  require 'rubygems'
30
47
  require 'chemcaster'
@@ -34,6 +51,23 @@ Installation through the Ruby Gem hosted on GitHub is recommended:
34
51
  registries.size # => 3
35
52
  registry = registries[0]
36
53
 
54
+ === Loading a Registry from a URI
55
+
56
+ require 'rubygems'
57
+ require 'chemcaster'
58
+
59
+ Chemcaster::Service.connect 'username', 'password'
60
+
61
+ link = Chemcaster::Link.new 'name'=> 'foo',
62
+ 'uri' => 'https://chemcaster.com/registries/123456',
63
+ 'media_type' => 'application/vnd.com.chemcaster.Registry+json'
64
+ registry = link.get
65
+
66
+ Note: No assumptions should be made about Chemcaster[http://chemcaster.com] URI layout. Once
67
+ you receive a resource URI, you can expect it to work at any point
68
+ in the future for random-access. But URI templates are unnecessary
69
+ when accessing resources.
70
+
37
71
  === Creating a Registry
38
72
 
39
73
  require 'rubygems'
@@ -51,4 +85,10 @@ Installation through the Ruby Gem hosted on GitHub is recommended:
51
85
 
52
86
  service = Chemcaster::Service.connect 'username', 'password'
53
87
  registry = service.registries[0]
54
- registry.update :name => 'CarboBlocks International, Inc.'
88
+ registry.update :name => 'CarboBlocks International, Inc.'
89
+
90
+
91
+ == API Documentation
92
+
93
+ RDoc documentation is available at
94
+ {rdoc.info}[http://rdoc.info/projects/metamolecular/chemcaster-ruby].
@@ -0,0 +1,6 @@
1
+ module Chemcaster
2
+ class Component < Item
3
+ attributes :multiplier
4
+ resources :structure, :substance
5
+ end
6
+ end
@@ -1,6 +1,6 @@
1
1
  module Chemcaster
2
2
  class Image < Item
3
- attributes :width, :height, :data
3
+ attributes :width, :height, :data, :format
4
4
  resources :imageable
5
5
  end
6
6
  end
@@ -5,7 +5,7 @@ module Chemcaster
5
5
  attr_accessor :item_links#, :items
6
6
  resources :parent
7
7
 
8
- def create representation_attributes
8
+ def create representation_attributes={}
9
9
  @create_link.post representation_attributes
10
10
  end
11
11
 
@@ -1,6 +1,6 @@
1
1
  module Chemcaster
2
2
  class Query < Item
3
- attributes :molfile
4
- resources :images, :registry
3
+ attributes :serialization
4
+ resources :images, :registry, :executions
5
5
  end
6
6
  end
@@ -0,0 +1,8 @@
1
+ require File.dirname(__FILE__) + '/../chemcaster/item'
2
+
3
+ module Chemcaster
4
+ class Registration < Item
5
+ attributes :templates
6
+ resources :substance, :registry
7
+ end
8
+ end
@@ -3,6 +3,7 @@ require File.dirname(__FILE__) + '/../chemcaster/item'
3
3
  module Chemcaster
4
4
  class Registry < Item
5
5
  attributes :name, :deletable
6
- resources :queries, :structures
6
+ resources :service, :queries, :structures, :substances,
7
+ :archives, :registrations
7
8
  end
8
9
  end
@@ -2,7 +2,8 @@ require File.dirname(__FILE__) + '/../chemcaster/representation'
2
2
 
3
3
  module Chemcaster
4
4
  class Service < Representation
5
- attr_accessor :registries_link
5
+ attributes :version
6
+ resources :registries
6
7
 
7
8
  # Ruby SSL needs to be told the location of the system's SSL CA files.
8
9
  # On Debian Linux systems, these files are located at /etc/ssl/certs,
@@ -26,16 +27,5 @@ module Chemcaster
26
27
  'media_type' => 'application/vnd.com.chemcaster.Service+json', 'name' => 'root'
27
28
  service_link.get
28
29
  end
29
-
30
- def registries
31
- @registries_link.get
32
- end
33
-
34
- protected
35
-
36
- def load_hash hash
37
- super
38
- @registries_link = Link.new hash['registries']
39
- end
40
30
  end
41
31
  end
@@ -1,6 +1,6 @@
1
1
  module Chemcaster
2
2
  class Structure < Item
3
- attributes :name, :molfile
4
- resources :images, :registry
3
+ attributes :serialization, :inchi
4
+ resources :images, :registry, :components
5
5
  end
6
6
  end
data/lib/chemcaster.rb CHANGED
@@ -1,9 +1,14 @@
1
1
  require File.dirname(__FILE__) + "/chemcaster/service"
2
2
  require File.dirname(__FILE__) + '/chemcaster/service'
3
3
  require File.dirname(__FILE__) + '/chemcaster/registry'
4
+ require File.dirname(__FILE__) + '/chemcaster/registration'
4
5
  require File.dirname(__FILE__) + '/chemcaster/structure'
6
+ require File.dirname(__FILE__) + '/chemcaster/substance'
7
+ require File.dirname(__FILE__) + '/chemcaster/component'
5
8
  require File.dirname(__FILE__) + '/chemcaster/query'
6
9
  require File.dirname(__FILE__) + '/chemcaster/image'
10
+ require File.dirname(__FILE__) + '/chemcaster/execution'
11
+ require File.dirname(__FILE__) + '/chemcaster/archive'
7
12
  require File.dirname(__FILE__) + '/chemcaster/link'
8
13
  require File.dirname(__FILE__) + '/chemcaster/index'
9
14
  require File.dirname(__FILE__) + '/chemcaster/item'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metamolecular-chemcaster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Apodaca
@@ -45,8 +45,11 @@ files:
45
45
  - lib/chemcaster/representation.rb
46
46
  - lib/chemcaster/service.rb
47
47
  - lib/chemcaster/structure.rb
48
+ - lib/chemcaster/registration.rb
49
+ - lib/chemcaster/component.rb
48
50
  has_rdoc: false
49
51
  homepage: http://chemcaster.com
52
+ licenses:
50
53
  post_install_message:
51
54
  rdoc_options: []
52
55
 
@@ -67,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
70
  requirements: []
68
71
 
69
72
  rubyforge_project:
70
- rubygems_version: 1.2.0
73
+ rubygems_version: 1.3.5
71
74
  signing_key:
72
75
  specification_version: 2
73
76
  summary: A hypertext-driven Ruby client for the Chemcaster cheminformatics Web services platform. End.