ihealth 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ihealth.rb +38 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d877f311982cdfba88603a3bbb13e371ebf04fe8
4
- data.tar.gz: 90f17132d7dcd7b628be618b3734fe107fc7b0b8
3
+ metadata.gz: 626f890de4d411637b330158b9de88320790dbc0
4
+ data.tar.gz: f0cf697ac48a5ff09e08c43c672f77a167c82841
5
5
  SHA512:
6
- metadata.gz: 31ddfe239e7ce21f55e3ca283a103f223dddb4d35be61d6ed24b938ff96ef8ed43b897b44bbeb598605d3cd425d910d12e98ee5130085a81d0c29822b12db045
7
- data.tar.gz: 856e81651841ee106ee0671fd2e42c4ebb6252968ac3abd76a52ffddb229defec5c55e6e37ad2a890d69a03974d3e68b2078059a39743776d520978245613321
6
+ metadata.gz: adf11e9e352de91de5eb783f1e973d671159728a22787391d63d1f5ee1e3c38dc6d02e4aa8ef9e73abb289dc0f905bb7109714af6cb2ecf0b5de60decf2d36e5
7
+ data.tar.gz: eeab40c65e138815e6a807e54e5624ec1d961a1b402fac28e1dfc005c70ababe45782bf57cdcb286cadfaebe8602e23ce1a59698f1dbe30695fa46e17674aaf5
@@ -189,6 +189,44 @@ class Ihealth
189
189
  # response.code != "200" ? (return nil) : (return response.body)
190
190
  # end
191
191
 
192
+ def get_file_list qid, format = "json"
193
+ authenticate if !@authenticated
194
+ url = URI("#{@IHEALTHBASE}qkviews/#{qid}/files.#{format}")
195
+ headers = {'User Agent' => USER_AGENT, 'Cookie' => @cookies }
196
+ @proxyserver.nil? ? (ihealthclient = Net::HTTP::new(url.host, url.port)) : (ihealthclient = Net::HTTP::new(url.host, url.port,@proxyserver, @proxyport, @proxyuser, @proxypass))
197
+ ihealthclient.use_ssl = true
198
+ ihealthclient.verify_mode = OpenSSL::SSL::VERIFY_NONE
199
+ httprequest = Net::HTTP::Get.new(url.path, headers)
200
+ httprequest.content_type = 'application/text'
201
+ response = ihealthclient.start do |http|
202
+ http.request(httprequest)
203
+ end
204
+ response.code != "200" ? (return nil) : (return response.body)
205
+ end
206
+
207
+ def get_file qid, fileid, location
208
+ authenticate if !@authenticated
209
+ url = URI("#{@IHEALTHBASE}qkviews/#{qid}/files/#{fileid}")
210
+ headers = {'User Agent' => USER_AGENT, 'Cookie' => @cookies }
211
+ @proxyserver.nil? ? (ihealthclient = Net::HTTP::new(url.host, url.port)) : (ihealthclient = Net::HTTP::new(url.host, url.port,@proxyserver, @proxyport, @proxyuser, @proxypass))
212
+ ihealthclient.use_ssl = true
213
+ ihealthclient.verify_mode = OpenSSL::SSL::VERIFY_NONE
214
+ httprequest = Net::HTTP::Get.new(url.path, headers)
215
+ httprequest.content_type = 'application/octet-stream'
216
+ response = ihealthclient.start do |http|
217
+ begin
218
+ file = open(location,'wb')
219
+ http.request(httprequest) do |response|
220
+ response.read_body do |segment|
221
+ file.write(segment)
222
+ end
223
+ end
224
+ ensure
225
+ file.close
226
+ end
227
+ end
228
+ response.code != "200" ? (return nil) : (return location)
229
+ end
192
230
 
193
231
 
194
232
  # no reason to call authenticate directly
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ihealth
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave B. Greene