Class: ChemSpider::CompoundInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/chem_spider/services/search.rb

Constant Summary collapse

ATTRIBUTES =
{
  :csid => {
    :selector => 'CSID',
    :datatype => Integer,
    :first_child => true,
  },
  :inchi => {
    :selector => 'InChI',
    :datatype => String,
    :first_child => true,
  },
  :inchi_key => {
    :selector => 'InChIKey',
    :datatype => String,
    :first_child => true,
  },
  :smiles => {
    :selector => 'SMILES',
    :datatype => String,
    :first_child => true,
  },
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CompoundInfo

Returns a new instance of CompoundInfo.



34
35
36
37
38
# File 'lib/chem_spider/services/search.rb', line 34

def initialize(attributes = {})
  ATTRIBUTES.keys.each do |attr_name|
    instance_variable_set(:"@#{attr_name}", attributes[attr_name])
  end
end

Class Method Details

.__attributes__Object



27
28
29
# File 'lib/chem_spider/services/search.rb', line 27

def __attributes__
  ATTRIBUTES
end