Module: CtGov
- Defined in:
- lib/ct_gov.rb,
lib/ct_gov/version.rb,
lib/ct_gov/publication.rb,
lib/ct_gov/clinical_trial.rb
Defined Under Namespace
Classes: ClinicalTrial, Publication
Constant Summary collapse
- BASE_URL =
'https://www.clinicaltrials.gov'- BASE_OPTIONS =
'?displayxml=true'- VERSION =
"0.0.1"
Class Method Summary collapse
Class Method Details
.find_by_nctid(nctid) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ct_gov.rb', line 12 def self.find_by_nctid(nctid) uri = URI.parse("#{BASE_URL}/ct2/show/#{nctid}#{BASE_OPTIONS}") http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) ClinicalTrial.new(Saxerator.parser(response.body)) if response.code == "200" end |