medivo 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Medivo
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -11,6 +11,7 @@ module Medivo
11
11
  pdf = Tempfile.new('pdf', :encoding => 'ascii-8bit')
12
12
  fdf = FdfGenerator.file(variables)
13
13
  system 'pdftk', file_path, 'fill_form', fdf.path, 'output', pdf.path, 'flatten'
14
+ pdf.close
14
15
  pdf
15
16
  end
16
17
 
@@ -12,22 +12,23 @@ module Medivo
12
12
  pdf_group.pdf
13
13
  end
14
14
 
15
+ def tmp_pdf
16
+ pdf = Tempfile.new('pdf', :encoding => 'ascii-8bit')
17
+ yield pdf
18
+ pdf.close
19
+ pdf
20
+ end
21
+
15
22
  def variable_fields(file_path, variables)
16
23
  @pdfs << PdfGenerator.variable_fields(file_path, variables)
17
24
  end
18
25
 
19
26
  def lab_requisition(requisition_id)
20
- pdf = Tempfile.new('pdf', :encoding => 'ascii-8bit')
21
- pdf.write Medivo::Order.pdf_requisition(requisition_id)
22
- pdf.close
23
- @pdfs << pdf
27
+ @pdfs << tmp_pdf {|pdf| pdf.write Medivo::Order.pdf_requisition(requisition_id) }
24
28
  end
25
29
 
26
30
  def lab_result(requisition_id)
27
- pdf = Tempfile.new('pdf', :encoding => 'ascii-8bit')
28
- pdf.write Medivo::Order.pdf_result(requisition_id)
29
- pdf.close
30
- @pdfs << pdf
31
+ @pdfs << tmp_pdf {|pdf| pdf.write Medivo::Order.pdf_result(requisition_id) }
31
32
  end
32
33
 
33
34
  def static_pdf(path)
@@ -37,11 +38,10 @@ module Medivo
37
38
  ##
38
39
  # Combines the PDFs
39
40
  def pdf
40
- pdf = Tempfile.new('pdf', :encoding => 'ascii-8bit')
41
- args = [@pdfs.collect(&:path), 'cat', 'output', pdf.path].flatten
42
- system 'pdftk', *args
43
- pdf.close
44
- pdf
41
+ tmp_pdf do |pdf|
42
+ args = [@pdfs.collect(&:path), 'cat', 'output', pdf.path].flatten
43
+ system 'pdftk', *args
44
+ end
45
45
  end
46
46
  end
47
47
  end
@@ -2263,3 +2263,11 @@ Served asset /medivo/markerC.png - 304 Not Modified (0ms)
2263
2263
 
2264
2264
  Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-04 15:59:58 -0400
2265
2265
  Served asset /medivo/arrow.png - 304 Not Modified (0ms)
2266
+
2267
+
2268
+ Started GET "/consumers" for 127.0.0.1 at 2011-11-05 09:05:37 -0400
2269
+
2270
+ ActionController::RoutingError (No route matches [GET] "/consumers"):
2271
+
2272
+
2273
+ Rendered /Users/danielsudol/.rvm/gems/ruby-1.9.2-p290@medivo_resource/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.6ms)
@@ -9,7 +9,7 @@ describe Medivo::PdfGroup do
9
9
  variable_fields(path, {:patient_name=>name})
10
10
  end
11
11
  text = pdf_to_text(pdf)
12
- text.should =~ /#{name}/
12
+ text.should match name
13
13
  end
14
14
 
15
15
  it "#lab_requisition" do
@@ -35,7 +35,7 @@ describe Medivo::PdfGroup do
35
35
  end
36
36
 
37
37
  text = pdf_to_text(pdf)
38
- text.should match /COLLECTED:2011-09-06 RECEIVED:2011-09-06 REPORTED:2011-09-06/
38
+ text.should match "COLLECTED:2011-09-06 RECEIVED:2011-09-06 REPORTED:2011-09-06"
39
39
  end
40
40
 
41
41
  it "#static_pdf" do
@@ -43,9 +43,9 @@ describe Medivo::PdfGroup do
43
43
  pdf = Medivo::PdfGroup.create do
44
44
  static_pdf(path)
45
45
  end
46
- #open('/tmp/test.pdf', 'wb+') { |f| f.write pdf.read }
46
+
47
47
  text = pdf_to_text(pdf)
48
- text.should match /Q: What does a positive result mean/
48
+ text.should match "Q: What does a positive result mean"
49
49
  end
50
50
 
51
51
  it "handles a combination of pdfs" do
@@ -63,10 +63,10 @@ describe Medivo::PdfGroup do
63
63
  lab_requisition(requisition_number)
64
64
  static_pdf(faq_path)
65
65
  end
66
-
66
+ # open('/tmp/test.pdf', 'wb+') { |f| f.write pdf.read }
67
67
  text = pdf_to_text(pdf)
68
- text.should match /#{name}/
69
- text.should match /Q: What does a positive result mean/
70
- text.should match /Account #:111111111 Req\/Control #:#{requisition_number}/
68
+ text.should match name
69
+ text.should match "Account #:111111111 Req\/Control #:#{requisition_number}"
70
+ text.should match "Q: What does a positive result mean"
71
71
  end
72
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2158570100 !ruby/object:Gem::Requirement
17
+ requirement: &2156507100 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2158570100
25
+ version_requirements: *2156507100
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2158569660 !ruby/object:Gem::Requirement
28
+ requirement: &2156506680 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2158569660
36
+ version_requirements: *2156506680
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2158569200 !ruby/object:Gem::Requirement
39
+ requirement: &2156506200 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *2158569200
47
+ version_requirements: *2156506200
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2158568760 !ruby/object:Gem::Requirement
50
+ requirement: &2156505780 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *2158568760
58
+ version_requirements: *2156505780
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: geocoder
61
- requirement: &2158568320 !ruby/object:Gem::Requirement
61
+ requirement: &2156505340 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *2158568320
69
+ version_requirements: *2156505340
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
- requirement: &2158567880 !ruby/object:Gem::Requirement
72
+ requirement: &2156504900 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: '0'
78
78
  type: :runtime
79
79
  prerelease: false
80
- version_requirements: *2158567880
80
+ version_requirements: *2156504900
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: pdf-toolkit
83
- requirement: &2158567440 !ruby/object:Gem::Requirement
83
+ requirement: &2156484140 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0'
89
89
  type: :runtime
90
90
  prerelease: false
91
- version_requirements: *2158567440
91
+ version_requirements: *2156484140
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: pdfkit
94
- requirement: &2158567020 !ruby/object:Gem::Requirement
94
+ requirement: &2156482660 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '0'
100
100
  type: :runtime
101
101
  prerelease: false
102
- version_requirements: *2158567020
102
+ version_requirements: *2156482660
103
103
  description: Use the medivo platform to find lab locations, make labcorp appointments,
104
104
  place lab orders
105
105
  email:
@@ -290,7 +290,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
290
290
  version: '0'
291
291
  segments:
292
292
  - 0
293
- hash: -549547875535863151
293
+ hash: -3711177596364803719
294
294
  required_rubygems_version: !ruby/object:Gem::Requirement
295
295
  none: false
296
296
  requirements:
@@ -299,7 +299,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
299
299
  version: '0'
300
300
  segments:
301
301
  - 0
302
- hash: -549547875535863151
302
+ hash: -3711177596364803719
303
303
  requirements: []
304
304
  rubyforge_project:
305
305
  rubygems_version: 1.6.2