Module: CtGov
- Defined in:
- lib/ct_gov.rb,
lib/ct_gov/address.rb,
lib/ct_gov/contact.rb,
lib/ct_gov/version.rb,
lib/ct_gov/facility.rb,
lib/ct_gov/location.rb,
lib/ct_gov/publication.rb,
lib/ct_gov/investigator.rb,
lib/ct_gov/clinical_trial.rb
Defined Under Namespace
Classes: Address, ClinicalTrial, Contact, Facility, Investigator, Location, Publication
Constant Summary collapse
- BASE_URL =
'https://www.clinicaltrials.gov'- BASE_OPTIONS =
'?displayxml=true'- VERSION =
"0.0.2"
Class Method Summary collapse
Class Method Details
.find_by_nctid(nctid) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ct_gov.rb', line 17 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 |