Class: PubChemAPI::SubstanceRecord

Inherits:
APIResponse show all
Defined in:
lib/pubchem_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ SubstanceRecord

Returns a new instance of SubstanceRecord.



51
52
53
54
55
56
57
# File 'lib/pubchem_api.rb', line 51

def initialize(data)
  super(data)
  substance = data['PC_Substances'].first
  @sid = substance['sid']['id']
  @synonyms = substance['synonyms']
  @source_name = substance['source']['db']['name']
end

Instance Attribute Details

#sidObject (readonly)

Returns the value of attribute sid.



49
50
51
# File 'lib/pubchem_api.rb', line 49

def sid
  @sid
end

#source_nameObject (readonly)

Returns the value of attribute source_name.



49
50
51
# File 'lib/pubchem_api.rb', line 49

def source_name
  @source_name
end

#synonymsObject (readonly)

Returns the value of attribute synonyms.



49
50
51
# File 'lib/pubchem_api.rb', line 49

def synonyms
  @synonyms
end