ct_gov 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2cbc97f4cd880185f298bb615c8f3c8c9b67b2b
4
- data.tar.gz: fedc4b404245cc5582168ae9c4cd90aad6b4a3c8
3
+ metadata.gz: c93b88131f5a4ac20be43a1111e41fa3140c6d1b
4
+ data.tar.gz: 3cb7e486b1cbf27a196fb2f749abdf7ab8a99dc5
5
5
  SHA512:
6
- metadata.gz: 84b5c655602e955600b1fec84b6db4386e9cef1663ef662336e012b55c2c07fd4a9c80c0348bd9a1805c42a8e00fadb70bd550bf2031b545ba0f0512e8451c69
7
- data.tar.gz: 23612bf19e8b575894dbeddb2f566d467158b66670169dcb8cbe5003f495fd9be9ef72247008b93635c20467ec9eef3423228a2d63b39fc1c52656d115ead1a5
6
+ metadata.gz: 56758404722c96db1ae0a6a2f870c60f0ee39f7741518be241884c566c3a7ddaa52f264f20ecf8a5ba7394b735f304368b9bfb43bd6cabbc7fb3be7ad02e47b3
7
+ data.tar.gz: 00e6d2825da736197a65afe22384451975698624702d1a6f894e20fc8988c824d1e8f130f4b41f153f90ea6701475cb832c032c7a386cfcfc366211fe259e87d
data/ct_gov-0.0.2.gem ADDED
Binary file
data/ct_gov.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["daniel.carpenter01@gmail.com"]
11
11
  spec.summary = %q{A ruby client for the ClinicalTrials.gov api.}
12
12
  spec.description = %q{A ruby client for the ClinicalTrials.gov api.}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/carp47/ct_gov"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_runtime_dependency "saxerator"
21
+ spec.add_runtime_dependency "saxerator", "~> 0.9.5"
22
22
  spec.add_development_dependency "bundler", "~> 1.7"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
24
  end
data/lib/ct_gov.rb CHANGED
@@ -8,6 +8,9 @@ require 'ct_gov/location'
8
8
  require 'ct_gov/publication'
9
9
 
10
10
  require 'saxerator'
11
+ require 'uri'
12
+ require 'openssl'
13
+ require 'net/http'
11
14
 
12
15
  module CtGov
13
16
 
@@ -23,7 +26,7 @@ module CtGov
23
26
  request = Net::HTTP::Get.new(uri.request_uri)
24
27
  response = http.request(request)
25
28
 
26
- ClinicalTrial.new(Saxerator.parser(response.body)) if response.code == "200"
29
+ ClinicalTrial.new(Saxerator.parser(response.body).for_tag(:clinical_study).first) if response.code == "200"
27
30
  end
28
31
 
29
32
  end
@@ -87,8 +87,12 @@ module CtGov
87
87
  end
88
88
 
89
89
  def publications
90
- @raw_trial['reference'].map do |reference|
91
- Publication.new(reference)
90
+ if @raw_trial['reference'].nil?
91
+ []
92
+ else
93
+ [@raw_trial['reference']].flatten.map do |reference|
94
+ Publication.new(reference)
95
+ end
92
96
  end
93
97
  end
94
98
 
@@ -1,3 +1,3 @@
1
1
  module CtGov
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -203,6 +203,12 @@ describe CtGov::ClinicalTrial do
203
203
  it { expect(subject.count).to eq 3 }
204
204
 
205
205
  it { expect(subject.first.pmid).to eq '7762914' }
206
+
207
+ context 'when there are no publications' do
208
+ before { raw_trial.delete('reference') }
209
+
210
+ it { expect(subject).to eq [] }
211
+ end
206
212
  end
207
213
 
208
214
  describe '#start_date' do
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ct_gov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Carpenter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-15 00:00:00.000000000 Z
11
+ date: 2015-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: saxerator
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.9.5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.9.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -65,6 +65,7 @@ files:
65
65
  - README.md
66
66
  - Rakefile
67
67
  - ct_gov-0.0.1.gem
68
+ - ct_gov-0.0.2.gem
68
69
  - ct_gov.gemspec
69
70
  - lib/ct_gov.rb
70
71
  - lib/ct_gov/address.rb
@@ -85,7 +86,7 @@ files:
85
86
  - rspec/ct_gov_spec.rb
86
87
  - rspec/data/sample_trial.xml
87
88
  - rspec/spec_helper.rb
88
- homepage: ''
89
+ homepage: https://github.com/carp47/ct_gov
89
90
  licenses:
90
91
  - MIT
91
92
  metadata: {}