Module: ChemSpider
- Defined in:
- lib/chem_spider.rb,
lib/chem_spider/version.rb,
lib/chem_spider/services/search.rb,
lib/chem_spider/services/in_ch_i.rb,
lib/chem_spider/services/spectra.rb,
lib/chem_spider/services/open_babel.rb,
lib/chem_spider/services/mass_spec_a_p_i.rb
Overview
ChemSpider.rb: ChemSpider wrapped up with a Ruby bow.
Defined Under Namespace
Modules: VERSION Classes: CompoundInfo, ExtRef, ExtendedCompoundInfo, SpectrumInfo
Class Method Summary collapse
-
.get!(service_name, operation_name, params = {}, uri_options = {}, options = {}) ⇒ Object
Returns the result of calling the specified ChemSpider Web service using the HTTP/1.1 “GET” method.
-
.post!(service_name, operation_name, params = {}, uri_options = {}, options = {}) ⇒ Object
Returns the result of calling the specified ChemSpider Web service using the HTTP/1.1 “POST” method.
Class Method Details
.get!(service_name, operation_name, params = {}, uri_options = {}, options = {}) ⇒ Object
Returns the result of calling the specified ChemSpider Web service using the HTTP/1.1 “GET” method.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/chem_spider.rb', line 61 def get!(service_name, operation_name, params = {}, = {}, = {}) # construct the URI... uri = uri_for(service_name, operation_name, params, ) # dereference the URI... response = Net::HTTP.get_response(uri) # parse the response... doc = Nokogiri::XML(response.body) # process the result... css(doc, ) end |
.post!(service_name, operation_name, params = {}, uri_options = {}, options = {}) ⇒ Object
Returns the result of calling the specified ChemSpider Web service using the HTTP/1.1 “POST” method.
123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/chem_spider.rb', line 123 def post!(service_name, operation_name, params = {}, = {}, = {}) # construct the URI... uri = uri_for(service_name, operation_name, nil, ) # dereference the URI... response = Net::HTTP.post_form(uri, params) # parse the response... doc = Nokogiri::XML(response.body) # process the result... css(doc, ) end |