class Ruspider::ChemSpider

ChemSpider Ruby interface

Public Class Methods

new(token = '', header = {}) click to toggle source
# File lib/ruspider/chemspider.rb, line 17
def initialize(token = '', header = {})
  @rest = RestClient.new(token, header)
  InchIAPI.instance_method(:initialize).bind(self).call(@rest)
  MassSpecAPI.instance_method(:initialize).bind(self).call(@rest)
  SpectraAPI.instance_method(:initialize).bind(self).call(@rest)
end

Public Instance Methods

get_compound(csid) click to toggle source
# File lib/ruspider/chemspider.rb, line 24
def get_compound(csid)
  Compound.new(csid, self)
end
get_compound_spectra(csid) click to toggle source
# File lib/ruspider/chemspider.rb, line 40
def get_compound_spectra(csid)
  get_spectra_info_list([csid]).map do |x|
    Spectrum.from_info_dict(x, self)
  end
end
get_compounds(csids) click to toggle source
# File lib/ruspider/chemspider.rb, line 28
def get_compounds(csids)
  csids.map { |x| Compound.new(x, self) }
end
get_spectra(spectrum_ids) click to toggle source
# File lib/ruspider/chemspider.rb, line 36
def get_spectra(spectrum_ids)
  spectrum_ids.map { |x| Spectrum.new(x, self) }
end
get_spectrum(spectrum_id) click to toggle source
# File lib/ruspider/chemspider.rb, line 32
def get_spectrum(spectrum_id)
  Spectrum.new(spectrum_id, self)
end