medivo 0.1.9 → 0.1.10

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.9"
2
+ VERSION = "0.1.10"
3
3
  end
@@ -2,22 +2,26 @@ require 'spec_helper'
2
2
 
3
3
  describe Medivo::FdfGenerator do
4
4
  before(:all) do
5
- @birth_date = '12/23/1901'
6
- @fdf = Medivo::FdfGenerator.file({:patient_name=>'jane', :birth_date=>@birth_date , :result_date=> '12/24/1901', :missing=>'dude'})
5
+ @fields = {
6
+ :patient_name=>'jane',
7
+ :birth_date=> '01/29/2000',
8
+ :result_date=> '12/24/1901',
9
+ :missing=>'dude'
10
+ }
11
+ @fdf = Medivo::FdfGenerator.file(@fields)
7
12
  end
8
13
 
9
14
  it "generate fdf" do
10
15
  fdf = open(@fdf.path, 'r:ascii-8bit').read
11
- fdf.should == "%FDF-1.2\r%\xE2\xE3\xCF\xD3\r\n1 0 obj\r<< \r/FDF << /Fields [ << /T (patient_name) /V (jane) /ClrF 2 /ClrFf 1 >> << /T (birth_date) /V (12/23/1901) /ClrF 2 /ClrFf 1 >> << /T (result_date) /V (12/24/1901) /ClrF 2 /ClrFf 1 >> << /T (missing) /V (dude) /ClrF 2 /ClrFf 1 >> ] \r>> \r>> \rendobj\rtrailer\r<<\r/Root 1 0 R \r\r>>\r%%EOF\r\n"
16
+ fdf.should == "%FDF-1.2\r%\xE2\xE3\xCF\xD3\r\n1 0 obj\r<< \r/FDF << /Fields [ << /T (patient_name) /V (jane) /ClrF 2 /ClrFf 1 >> << /T (birth_date) /V (01/29/2000) /ClrF 2 /ClrFf 1 >> << /T (result_date) /V (12/24/1901) /ClrF 2 /ClrFf 1 >> << /T (missing) /V (dude) /ClrF 2 /ClrFf 1 >> ] \r>> \r>> \rendobj\rtrailer\r<<\r/Root 1 0 R \r\r>>\r%%EOF\r\n"
12
17
  end
13
18
 
14
19
  it "fill in pdf form" do
15
- pdf_path = fixture_path "negative_results.pdf"
20
+ pdf_path = medivo_fixture_path "negative_results.pdf"
16
21
  pdf_output = `pdftk #{pdf_path} fill_form #{@fdf.path} output - flatten`
17
22
  text = pdf_stream_to_text(pdf_output)
18
- text.should =~ /jane/
19
- text.should =~ Regexp.new(@birth_date)
20
- text.should =~ Regexp.new('12/24/1901')
21
- text.should_not =~ /we rock/
23
+ @fields.values.each do |value|
24
+ text.should match value
25
+ end
22
26
  end
23
27
  end
@@ -4,7 +4,7 @@ describe Medivo::PdfGenerator do
4
4
 
5
5
  it "#variable_fields generates pdf by filling in the variables" do
6
6
  name = "Duderoni"
7
- path = fixture_path "negative_results.pdf"
7
+ path = medivo_fixture_path "negative_results.pdf"
8
8
  pdf_file = Medivo::PdfGenerator.variable_fields(path, {:patient_name=>name})
9
9
  text = pdf_to_text(pdf_file)
10
10
  text.should match name
@@ -24,7 +24,7 @@ describe Medivo::PdfGenerator do
24
24
  :order_number => 'the lab id'
25
25
  }
26
26
 
27
- path = fixture_path "uhc_requisition_cover_letter.pdf"
27
+ path = medivo_fixture_path "uhc_requisition_cover_letter.pdf"
28
28
  pdf_file = Medivo::PdfGenerator.variable_fields(path, fields)
29
29
  text = pdf_to_text(pdf_file)
30
30
  fields.values.each do |value|
@@ -41,8 +41,8 @@ describe Medivo::PdfGenerator do
41
41
  Southeast Region
42
42
  MD
43
43
 
44
- path = fixture_path "uhc_requisition_cover_letter.pdf"
45
- img_path = fixture_path "Southeast.jpg"
44
+ path = medivo_fixture_path "uhc_requisition_cover_letter.pdf"
45
+ img_path = medivo_fixture_path "Southeast.jpg"
46
46
  pdf_file = Medivo::PdfGenerator.variable_fields_with_images(path, {:director_name=>md}, [{:path=> img_path, :at=> [0, 120]}])
47
47
  #open('/tmp/test.pdf', 'wb+') { |f| f.write pdf_file.read }
48
48
  text = pdf_to_text(pdf_file)
@@ -5,7 +5,7 @@ describe Medivo::PdfGroup do
5
5
  it "#variable_fields" do
6
6
  name = "Duderoni"
7
7
  o = OpenStruct.new(:name=>name)
8
- path = fixture_path "negative_results.pdf"
8
+ path = medivo_fixture_path "negative_results.pdf"
9
9
  pdf = Medivo::PdfGroup.create do
10
10
  variable_fields(path, {:patient_name=>o.name})
11
11
  end
@@ -38,7 +38,7 @@ describe Medivo::PdfGroup do
38
38
  end
39
39
 
40
40
  it "#static_pdf" do
41
- path = fixture_path "result_faq.pdf"
41
+ path = medivo_fixture_path "result_faq.pdf"
42
42
  pdf = Medivo::PdfGroup.create do
43
43
  static_pdf(path)
44
44
  end
@@ -49,12 +49,12 @@ describe Medivo::PdfGroup do
49
49
 
50
50
  it "handles a combination of pdfs" do
51
51
  name = "Duderoni"
52
- cover_letter_path = fixture_path "negative_results.pdf"
52
+ cover_letter_path = medivo_fixture_path "negative_results.pdf"
53
53
 
54
54
  requisition_id = 170420
55
55
  stub_order_requisition(requisition_id, "lc_order_with_requisition.xml")
56
56
 
57
- faq_path = fixture_path "result_faq.pdf"
57
+ faq_path = medivo_fixture_path "result_faq.pdf"
58
58
 
59
59
  pdf = Medivo::PdfGroup.create do
60
60
  variable_fields(cover_letter_path, {:patient_name=>name})
@@ -20,7 +20,7 @@ module Medivo::Spec
20
20
 
21
21
  FIXTURE_PATH = File.expand_path('../../fixtures', __FILE__) unless defined? FIXTURE_PATH
22
22
 
23
- def fixture_path(file_name)
23
+ def medivo_fixture_path(file_name)
24
24
  "#{FIXTURE_PATH}/#{file_name}"
25
25
  end
26
26
 
@@ -30,7 +30,7 @@ module Medivo::Spec
30
30
  # requisition that includes requisition pdf
31
31
  def stub_order_requisition(requisition_id, file_path)
32
32
  stub_request(:get, "test:test@test.medivo.com/customers/#{requisition_id}.xml?include=requisition").
33
- to_return(:body => File.read(fixture_path(file_path)))
33
+ to_return(:body => File.read(medivo_fixture_path(file_path)))
34
34
  end
35
35
 
36
36
  ##
@@ -39,6 +39,6 @@ module Medivo::Spec
39
39
  # result info that includes result pdf
40
40
  def stub_order_result(requisition_id, file_path)
41
41
  stub_request(:get, "test:test@test.medivo.com/customers/#{requisition_id}.xml?include=reconciled_results").
42
- to_return(:body => File.read(fixture_path(file_path)))
42
+ to_return(:body => File.read(medivo_fixture_path(file_path)))
43
43
  end
44
44
  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.9
4
+ version: 0.1.10
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: &2152646500 !ruby/object:Gem::Requirement
17
+ requirement: &2165385840 !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: *2152646500
25
+ version_requirements: *2165385840
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2152646080 !ruby/object:Gem::Requirement
28
+ requirement: &2165385420 !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: *2152646080
36
+ version_requirements: *2165385420
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2152645540 !ruby/object:Gem::Requirement
39
+ requirement: &2165384880 !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: *2152645540
47
+ version_requirements: *2165384880
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2152645100 !ruby/object:Gem::Requirement
50
+ requirement: &2165384440 !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: *2152645100
58
+ version_requirements: *2165384440
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: geocoder
61
- requirement: &2152644680 !ruby/object:Gem::Requirement
61
+ requirement: &2165384020 !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: *2152644680
69
+ version_requirements: *2165384020
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
- requirement: &2152644260 !ruby/object:Gem::Requirement
72
+ requirement: &2165383600 !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: *2152644260
80
+ version_requirements: *2165383600
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: pdfkit
83
- requirement: &2152643760 !ruby/object:Gem::Requirement
83
+ requirement: &2165383160 !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: *2152643760
91
+ version_requirements: *2165383160
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: prawn
94
- requirement: &2152643340 !ruby/object:Gem::Requirement
94
+ requirement: &2165382740 !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: *2152643340
102
+ version_requirements: *2165382740
103
103
  description: Use the medivo platform to find lab locations, make labcorp appointments,
104
104
  place lab orders
105
105
  email:
@@ -292,7 +292,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
292
292
  version: '0'
293
293
  segments:
294
294
  - 0
295
- hash: -677947114815141566
295
+ hash: 4582220980121328817
296
296
  required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  none: false
298
298
  requirements:
@@ -301,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
301
  version: '0'
302
302
  segments:
303
303
  - 0
304
- hash: -677947114815141566
304
+ hash: 4582220980121328817
305
305
  requirements: []
306
306
  rubyforge_project:
307
307
  rubygems_version: 1.6.2