medivo 0.1.25 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/app/models/medivo/appointment.rb +27 -11
  2. data/lib/generators/medivo/templates/appointment_resource.yml +2 -0
  3. data/lib/medivo/version.rb +1 -1
  4. data/lib/support/date_formats.rb +1 -0
  5. data/spec/dummy/config/medivo/appointment_resource.yml +2 -1
  6. data/spec/dummy/log/development.log +247 -0
  7. data/spec/dummy/log/test.log +64 -0
  8. data/spec/dummy/tmp/cache/assets/C46/F00/sprockets%2F2281d588b540056c5a7306c32a3761b9 +0 -0
  9. data/spec/dummy/tmp/cache/assets/C81/D00/sprockets%2F64f056bd752d271308a86a6f865b1911 +0 -0
  10. data/spec/dummy/tmp/cache/assets/CB4/BD0/sprockets%2F3378f27c0d4f5e6d708665b22707a31f +0 -0
  11. data/spec/dummy/tmp/cache/assets/CC3/EF0/sprockets%2F453b504c1f8f374578636f699eaa455d +0 -0
  12. data/spec/dummy/tmp/cache/assets/CDD/820/sprockets%2Fb28231960c7ac62eff9048e702a29c70 +0 -0
  13. data/spec/dummy/tmp/cache/assets/CEC/EF0/sprockets%2F4b24a74018f693c06088bd52f8cc9f86 +0 -0
  14. data/spec/dummy/tmp/cache/assets/CEE/250/sprockets%2F96688f33f2f8aa261bf6701c1d6d7575 +0 -0
  15. data/spec/dummy/tmp/cache/assets/D20/F10/sprockets%2Fb2e907e4faa85fe755f4439e3b229088 +0 -0
  16. data/spec/dummy/tmp/cache/assets/D29/000/sprockets%2F61a10ddf57f1129c02a1049bfed6e007 +0 -0
  17. data/spec/dummy/tmp/cache/assets/D2C/F80/sprockets%2F399f6d5eb273936af7ff8f35a77c5037 +0 -0
  18. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  19. data/spec/dummy/tmp/cache/assets/D36/870/sprockets%2Fce9e887568de873b133ae43d7c977f68 +0 -0
  20. data/spec/dummy/tmp/cache/assets/D41/250/sprockets%2F7b3c4426715dcd1feedc4a95e5444256 +0 -0
  21. data/spec/dummy/tmp/cache/assets/D45/320/sprockets%2Fc50ff379a1bdf1dd4d22249058749cf6 +0 -0
  22. data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
  23. data/spec/dummy/tmp/cache/assets/D55/ED0/sprockets%2F0f673e42e816c6fe5b66a5c96f896f1a +0 -0
  24. data/spec/dummy/tmp/cache/assets/D5D/3E0/sprockets%2F63fea6cc142b5f02da93bf81e70b2116 +0 -0
  25. data/spec/dummy/tmp/cache/assets/D60/030/sprockets%2Ffc9485f617fc5e9b8918755d2e08ecc6 +0 -0
  26. data/spec/dummy/tmp/cache/assets/D64/C50/sprockets%2F22ee6fb2ab1ea9694ac7f0f41a406094 +0 -0
  27. data/spec/dummy/tmp/cache/assets/D69/130/sprockets%2Fbaa4ec50a34ce938c986612c2a47a64e +0 -0
  28. data/spec/dummy/tmp/cache/assets/D74/9A0/sprockets%2F0ca4e6e833c72156fc7e7d5f007d9ce3 +0 -0
  29. data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  30. data/spec/dummy/tmp/cache/assets/D88/2C0/sprockets%2F452ab3ebb1912cf1c2ba617eec52a718 +0 -0
  31. data/spec/dummy/tmp/cache/assets/DCE/E80/sprockets%2Fc71ec62157b9cc7aabfc030955cef87b +0 -0
  32. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  33. data/spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4 +0 -0
  34. data/spec/dummy/tmp/pids/server.pid +1 -0
  35. data/spec/models/appointment_spec.rb +21 -6
  36. data/spec/spec_helper.rb +1 -0
  37. metadata +23 -20
@@ -3,16 +3,19 @@ require 'restclient'
3
3
  module Medivo
4
4
  class Appointment
5
5
 
6
- def self.find(lab_code, date, am_pm=nil)
6
+ LABCORP_FORMAT = "%m/%d/%Y|%H:%M %P" unless defined? LABCORP_FORMAT
7
+ MDY_FORMAT = "%m/%d/%Y" unless defined? MDY_FORMAT
8
+
9
+ def self.find(lab_code, date, am_pm='')
7
10
  if real_data?
8
- json = resource.get :params=>{:labcorp_id=>lab_code, :appointment_date=>date}
9
- JSON.parse(json)
11
+ data = resource.get :params=>{:labcorp_id=>lab_code, :appointment_date=>date}
12
+ data = JSON.parse(data)
10
13
  else
11
- build_fake_data(date)
14
+ data = build_fake_data(date)
12
15
  end
16
+ filter_data(data, am_pm)
13
17
  end
14
18
 
15
- private
16
19
  def self.resource
17
20
  @resource ||= begin
18
21
  @config = ResourceConfig.find 'appointment_resource.yml'
@@ -25,15 +28,28 @@ module Medivo
25
28
 
26
29
  def self.real_data?
27
30
  resource # to init the resource and config file
28
- true unless (Rails.env.development? and @config.real_data == false)
31
+ true unless ((Rails.env.development? or Rails.env.staging?) and @config.real_data == false)
32
+ end
33
+
34
+ def self.filter_data(hash, am_pm)
35
+ now = Time.now
36
+ hash['times'].reject! do |time|
37
+ (!time.match(/#{am_pm}/) or Time.strptime(time, LABCORP_FORMAT) < now)
38
+ end
39
+ hash
29
40
  end
30
41
 
31
42
  def self.build_fake_data(date)
32
- {:times=>[]}
33
- "{\"times\":[\"11/03/2011|08:30 AM\",\"11/04/2011|08:30 AM\",
34
- \"11/02/2011|09:00 AM\",\"11/01/2011|09:30 AM\",\"11/02/2011|09:30 AM\",
35
- \"11/03/2011|09:30 AM\",\"11/04/2011|09:30 AM\",\"10/31/2011|10:00 AM\",
36
- \"11/02/2011|04:00 PM\",\"11/03/2011|04:00 PM\",\"11/04/2011|04:00 PM\"]}"
43
+ date = date.is_a?(String) ? Date.strptime(date,MDY_FORMAT) : date
44
+ {'times'=> [
45
+ build_date(date,"08:30 AM"), build_date(date,"10:30 AM"),
46
+ build_date((date + 1),"03:30 PM"), build_date((date+1),"01:30 PM"),
47
+ build_date((date + 2),"10:30 AM"), build_date((date+1),"03:00 PM"),
48
+ ]}
49
+ end
50
+
51
+ def self.build_date(date, time)
52
+ "#{date.strftime(MDY_FORMAT)}|#{time}"
37
53
  end
38
54
  end
39
55
  end
@@ -11,9 +11,11 @@ test:
11
11
 
12
12
  development:
13
13
  <<: *default
14
+ real_data: false
14
15
 
15
16
  staging:
16
17
  <<: *default
18
+ real_data: true
17
19
 
18
20
  production:
19
21
  <<: *default
@@ -1,3 +1,3 @@
1
1
  module Medivo
2
- VERSION = "0.1.25 "
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1 @@
1
+
@@ -12,10 +12,11 @@ test:
12
12
 
13
13
  development:
14
14
  <<: *default
15
- real_data: true
15
+ real_data: false
16
16
 
17
17
  staging:
18
18
  <<: *default
19
+ real_data: true
19
20
 
20
21
  production:
21
22
  <<: *default
@@ -6630,3 +6630,250 @@ ActionView::Template::Error (Error: Parse error on line 47: Unexpected '..'
6630
6630
  Rendered /Users/danielsudol/.rvm/gems/ruby-1.9.2-p290@medivo_resource/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.5ms)
6631
6631
  Rendered /Users/danielsudol/.rvm/gems/ruby-1.9.2-p290@medivo_resource/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.1ms)
6632
6632
  Rendered /Users/danielsudol/.rvm/gems/ruby-1.9.2-p290@medivo_resource/gems/actionpack-3.1.1/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (5.0ms)
6633
+
6634
+
6635
+ Started GET "/labs/l;abs_search?zip_code=90210" for 127.0.0.1 at 2011-11-09 20:28:08 -0500
6636
+
6637
+ ActionController::RoutingError (No route matches [GET] "/labs/l;abs_search"):
6638
+
6639
+
6640
+ 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)
6641
+
6642
+
6643
+ Started GET "/labs/labs_search?zip_code=90210" for 127.0.0.1 at 2011-11-09 20:28:16 -0500
6644
+
6645
+ ActionController::RoutingError (No route matches [GET] "/labs/labs_search"):
6646
+
6647
+
6648
+ 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.5ms)
6649
+
6650
+
6651
+ Started GET "/labs/lab_search?zip_code=90210" for 127.0.0.1 at 2011-11-09 20:28:22 -0500
6652
+ Processing by LabsController#lab_search as HTML
6653
+ Parameters: {"zip_code"=>"90210"}
6654
+ Rendered labs/search.html.haml within layouts/application (27.5ms)
6655
+ Compiled medivo/lab_appointment/handlers.js (173ms) (pid 17967)
6656
+ Compiled medivo/lab_appointment/application.js (42ms) (pid 17967)
6657
+ Compiled application.js (8ms) (pid 17967)
6658
+ Completed 200 OK in 2462ms (Views: 301.2ms)
6659
+
6660
+
6661
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6662
+ Served asset /application.css - 200 OK (0ms)
6663
+
6664
+
6665
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6666
+ Served asset /jquery.js - 200 OK (7ms)
6667
+
6668
+
6669
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6670
+ Served asset /jquery_ujs.js - 200 OK (2ms)
6671
+
6672
+
6673
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6674
+ Served asset /medivo/handlebars.js - 200 OK (5ms)
6675
+
6676
+
6677
+ Started GET "/assets/medivo/helpers.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6678
+ Served asset /medivo/helpers.js - 200 OK (2ms)
6679
+
6680
+
6681
+ Started GET "/assets/medivo/lab_list/models.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6682
+ Served asset /medivo/lab_list/models.js - 200 OK (2ms)
6683
+
6684
+
6685
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6686
+ Served asset /medivo/models.js - 200 OK (2ms)
6687
+
6688
+
6689
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6690
+ Served asset /medivo/views.js - 200 OK (2ms)
6691
+
6692
+
6693
+ Started GET "/assets/medivo/lab_list/views.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6694
+ Served asset /medivo/lab_list/views.js - 200 OK (2ms)
6695
+
6696
+
6697
+ Started GET "/assets/medivo/lab_list/handlers.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6698
+ Served asset /medivo/lab_list/handlers.js - 200 OK (2ms)
6699
+
6700
+
6701
+ Started GET "/assets/medivo/lab_list/application.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6702
+ Served asset /medivo/lab_list/application.js - 200 OK (3ms)
6703
+
6704
+
6705
+ Started GET "/assets/medivo/lab_list/sample/show_labs.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6706
+ Served asset /medivo/lab_list/sample/show_labs.js - 200 OK (2ms)
6707
+
6708
+
6709
+ Started GET "/assets/medivo/date.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6710
+ Served asset /medivo/date.js - 200 OK (6ms)
6711
+
6712
+
6713
+ Started GET "/assets/medivo/lab_appointment/models.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6714
+ Served asset /medivo/lab_appointment/models.js - 200 OK (4ms)
6715
+
6716
+
6717
+ Started GET "/assets/medivo/lab_appointment/views.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6718
+ Served asset /medivo/lab_appointment/views.js - 200 OK (2ms)
6719
+
6720
+
6721
+ Started GET "/assets/medivo/lab_appointment/handlers.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6722
+ Served asset /medivo/lab_appointment/handlers.js - 200 OK (2ms)
6723
+
6724
+
6725
+ Started GET "/assets/medivo/lab_appointment/sample/show_appointments.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6726
+ Served asset /medivo/lab_appointment/sample/show_appointments.js - 200 OK (2ms)
6727
+
6728
+
6729
+ Started GET "/assets/medivo/lab_appointment/application.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6730
+ Served asset /medivo/lab_appointment/application.js - 200 OK (3ms)
6731
+
6732
+
6733
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6734
+ Served asset /application.js - 200 OK (0ms)
6735
+
6736
+
6737
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6738
+ Served asset /medivo/markerA.png - 200 OK (1ms)
6739
+
6740
+
6741
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6742
+ Served asset /medivo/markerB.png - 200 OK (3ms)
6743
+
6744
+
6745
+ Started GET "/assets/medivo/markerC.png" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6746
+ Served asset /medivo/markerC.png - 200 OK (1ms)
6747
+
6748
+
6749
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-09 20:28:25 -0500
6750
+ Served asset /medivo/arrow.png - 200 OK (1ms)
6751
+
6752
+
6753
+ Started GET "/labs/lab_search?zip_code=90210" for 127.0.0.1 at 2011-11-10 12:13:38 -0500
6754
+ Processing by LabsController#lab_search as HTML
6755
+ Parameters: {"zip_code"=>"90210"}
6756
+ Rendered labs/search.html.haml within layouts/application (26.3ms)
6757
+ Completed 200 OK in 2690ms (Views: 125.7ms)
6758
+
6759
+
6760
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6761
+ Served asset /application.css - 304 Not Modified (0ms)
6762
+
6763
+
6764
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6765
+ Served asset /jquery.js - 304 Not Modified (3ms)
6766
+
6767
+
6768
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6769
+ Served asset /jquery_ujs.js - 304 Not Modified (1ms)
6770
+
6771
+
6772
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6773
+ Served asset /medivo/handlebars.js - 304 Not Modified (3ms)
6774
+
6775
+
6776
+ Started GET "/assets/medivo/helpers.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6777
+ Served asset /medivo/helpers.js - 304 Not Modified (2ms)
6778
+
6779
+
6780
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6781
+ Served asset /medivo/models.js - 304 Not Modified (3ms)
6782
+
6783
+
6784
+ Started GET "/assets/medivo/lab_list/models.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6785
+ Served asset /medivo/lab_list/models.js - 304 Not Modified (3ms)
6786
+
6787
+
6788
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6789
+ Served asset /medivo/views.js - 304 Not Modified (3ms)
6790
+
6791
+
6792
+ Started GET "/assets/medivo/lab_list/views.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6793
+ Served asset /medivo/lab_list/views.js - 304 Not Modified (3ms)
6794
+
6795
+
6796
+ Started GET "/assets/medivo/lab_list/handlers.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6797
+ Served asset /medivo/lab_list/handlers.js - 304 Not Modified (3ms)
6798
+
6799
+
6800
+ Started GET "/assets/medivo/lab_list/application.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6801
+ Served asset /medivo/lab_list/application.js - 304 Not Modified (4ms)
6802
+
6803
+
6804
+ Started GET "/assets/medivo/lab_list/sample/show_labs.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6805
+ Served asset /medivo/lab_list/sample/show_labs.js - 304 Not Modified (2ms)
6806
+
6807
+
6808
+ Started GET "/assets/medivo/date.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6809
+ Served asset /medivo/date.js - 304 Not Modified (2ms)
6810
+
6811
+
6812
+ Started GET "/assets/medivo/lab_appointment/models.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6813
+ Served asset /medivo/lab_appointment/models.js - 304 Not Modified (2ms)
6814
+
6815
+
6816
+ Started GET "/assets/medivo/lab_appointment/views.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6817
+ Served asset /medivo/lab_appointment/views.js - 304 Not Modified (2ms)
6818
+
6819
+
6820
+ Started GET "/assets/medivo/lab_appointment/handlers.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6821
+ Served asset /medivo/lab_appointment/handlers.js - 200 OK (2ms)
6822
+
6823
+
6824
+ Started GET "/assets/medivo/lab_appointment/application.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6825
+ Served asset /medivo/lab_appointment/application.js - 200 OK (3ms)
6826
+
6827
+
6828
+ Started GET "/assets/medivo/lab_appointment/sample/show_appointments.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6829
+ Served asset /medivo/lab_appointment/sample/show_appointments.js - 304 Not Modified (2ms)
6830
+
6831
+
6832
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6833
+ Served asset /application.js - 200 OK (0ms)
6834
+
6835
+
6836
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6837
+ Served asset /medivo/markerA.png - 200 OK (3ms)
6838
+
6839
+
6840
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6841
+ Served asset /medivo/markerB.png - 200 OK (4ms)
6842
+
6843
+
6844
+ Started GET "/assets/medivo/markerC.png" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6845
+ Served asset /medivo/markerC.png - 200 OK (1ms)
6846
+
6847
+
6848
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-10 12:13:41 -0500
6849
+ Served asset /medivo/arrow.png - 304 Not Modified (2ms)
6850
+
6851
+
6852
+ Started GET "/medivo/labs/appointment_data?utf8=%E2%9C%93&appointment_date=11%2F13%2F2011&lab_code=20060&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-10 12:13:45 -0500
6853
+ Processing by Medivo::LabsController#appointment_data as JS
6854
+ Parameters: {"utf8"=>"✓", "appointment_date"=>"11/13/2011", "lab_code"=>"20060", "commit"=>"Search for appointments"}
6855
+ Completed 500 Internal Server Error in 669ms (Views: 4.9ms)
6856
+
6857
+
6858
+ Started GET "/medivo/labs/appointment_data?utf8=%E2%9C%93&appointment_date=11%2F13%2F2011&lab_code=20060&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-10 12:14:36 -0500
6859
+ Processing by Medivo::LabsController#appointment_data as JS
6860
+ Parameters: {"utf8"=>"✓", "appointment_date"=>"11/13/2011", "lab_code"=>"20060", "commit"=>"Search for appointments"}
6861
+ Completed 500 Internal Server Error in 12ms (Views: 4.3ms)
6862
+
6863
+
6864
+ Started GET "/medivo/labs/appointment_data?utf8=%E2%9C%93&appointment_date=11%2F13%2F2011&lab_code=20060&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-10 12:15:06 -0500
6865
+ Processing by Medivo::LabsController#appointment_data as JS
6866
+ Parameters: {"utf8"=>"✓", "appointment_date"=>"11/13/2011", "lab_code"=>"20060", "commit"=>"Search for appointments"}
6867
+ Completed 500 Internal Server Error in 10ms (Views: 4.5ms)
6868
+
6869
+
6870
+ Started GET "/medivo/labs/appointment_data?utf8=%E2%9C%93&appointment_date=11%2F13%2F2011&lab_code=20060&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-10 12:15:45 -0500
6871
+ Processing by Medivo::LabsController#appointment_data as JS
6872
+ Parameters: {"utf8"=>"✓", "appointment_date"=>"11/13/2011", "lab_code"=>"20060", "commit"=>"Search for appointments"}
6873
+ Completed 200 OK in 31ms (Views: 4.5ms)
6874
+
6875
+
6876
+ Started GET "/medivo/labs/appointment_data?utf8=%E2%9C%93&appointment_date=11%2F13%2F2011&lab_code=20060&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-10 12:18:12 -0500
6877
+ Processing by Medivo::LabsController#appointment_data as JS
6878
+ Parameters: {"utf8"=>"✓", "appointment_date"=>"11/13/2011", "lab_code"=>"20060", "commit"=>"Search for appointments"}
6879
+ Completed 200 OK in 7050ms (Views: 5.0ms)
@@ -1203,3 +1203,67 @@ Started GET "/medivo/labs/appointment_data?appointment_date=11%2F01%2F2011&lab_c
1203
1203
  Processing by Medivo::LabsController#appointment_data as HTML
1204
1204
  Parameters: {"appointment_date"=>"11/01/2011", "lab_code"=>"20060"}
1205
1205
  Completed 200 OK in 1ms (Views: 0.5ms)
1206
+ Processing by OrdersController#download_requisition as HTML
1207
+ Rendered text template (0.0ms)
1208
+ Sent data unitedhealthcare_requisition.pdf (70.8ms)
1209
+ Completed 200 OK in 872ms (Views: 69.9ms)
1210
+ Processing by OrdersController#download_result as HTML
1211
+ Sent data unitedhealthcare_result.pdf (2.0ms)
1212
+ Completed 200 OK in 699ms (Views: 1.1ms)
1213
+
1214
+
1215
+ Started GET "/medivo/labs/lab_data?zip_code=90210" for 127.0.0.1 at 2011-11-10 13:32:02 -0500
1216
+ Processing by Medivo::LabsController#lab_data as HTML
1217
+ Parameters: {"zip_code"=>"90210"}
1218
+ Completed 200 OK in 205ms (Views: 1.9ms)
1219
+
1220
+
1221
+ Started GET "/labs/lab_search?zip_code=90210" for 127.0.0.1 at 2011-11-10 13:32:04 -0500
1222
+ Processing by LabsController#lab_search as HTML
1223
+ Parameters: {"zip_code"=>"90210"}
1224
+ Completed 200 OK in 167ms (Views: 38.4ms)
1225
+
1226
+
1227
+ Started GET "/assets/application.css" for 127.0.0.1 at 2011-11-10 13:32:04 -0500
1228
+ Compiled application.css (1ms) (pid 24535)
1229
+ Served asset /application.css - 200 OK (8ms)
1230
+
1231
+
1232
+ Started GET "/assets/application.js" for 127.0.0.1 at 2011-11-10 13:32:04 -0500
1233
+ Compiled application.js (9ms) (pid 24535)
1234
+ Compiled jquery.js (1ms) (pid 24535)
1235
+ Compiled jquery_ujs.js (0ms) (pid 24535)
1236
+ Compiled medivo/lab_list/application.js (8ms) (pid 24535)
1237
+ Compiled medivo/handlebars.js (0ms) (pid 24535)
1238
+ Compiled medivo/helpers.js (167ms) (pid 24535)
1239
+ Compiled medivo/lab_list/models.js (181ms) (pid 24535)
1240
+ Compiled medivo/models.js (167ms) (pid 24535)
1241
+ Compiled medivo/lab_list/views.js (239ms) (pid 24535)
1242
+ Compiled medivo/views.js (165ms) (pid 24535)
1243
+ Compiled medivo/lab_list/handlers.js (165ms) (pid 24535)
1244
+ Compiled medivo/lab_list/sample/show_labs.js (162ms) (pid 24535)
1245
+ Compiled medivo/lab_appointment/application.js (14ms) (pid 24535)
1246
+ Compiled medivo/date.js (0ms) (pid 24535)
1247
+ Compiled medivo/lab_appointment/models.js (162ms) (pid 24535)
1248
+ Compiled medivo/lab_appointment/views.js (162ms) (pid 24535)
1249
+ Compiled medivo/lab_appointment/handlers.js (170ms) (pid 24535)
1250
+ Compiled medivo/lab_appointment/sample/show_appointments.js (156ms) (pid 24535)
1251
+ Served asset /application.js - 200 OK (2016ms)
1252
+
1253
+
1254
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-10 13:32:06 -0500
1255
+ Served asset /medivo/markerA.png - 200 OK (6ms)
1256
+
1257
+
1258
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-10 13:32:06 -0500
1259
+ Served asset /medivo/markerB.png - 200 OK (3ms)
1260
+
1261
+
1262
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-10 13:32:06 -0500
1263
+ Served asset /medivo/arrow.png - 200 OK (5ms)
1264
+
1265
+
1266
+ Started GET "/medivo/labs/appointment_data?appointment_date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-10 13:32:06 -0500
1267
+ Processing by Medivo::LabsController#appointment_data as HTML
1268
+ Parameters: {"appointment_date"=>"11/01/2011", "lab_code"=>"20060"}
1269
+ Completed 200 OK in 1ms (Views: 0.4ms)
@@ -0,0 +1 @@
1
+ 22751
@@ -2,15 +2,29 @@ require 'spec_helper'
2
2
 
3
3
  describe Medivo::Appointment do
4
4
  let(:lab_code) { 20060 }
5
- let(:date) { '11/01/2011' }
6
- let(:am_pm) {}
7
5
 
8
6
  describe "with valid data" do
9
- let(:body) { {'time'=> ["11/03/2011|08:30 AM", "11/04/2011|08:30 AM"]} }
7
+ let(:all_times) { ["11/03/2011|08:30 AM", "11/04/2011|08:30 AM", "11/04/2011|08:30 PM"] }
8
+ let(:body) { {'times'=> all_times} }
10
9
 
11
- it "returns times" do
10
+ def returned_times(date, am_pm)
11
+ Timecop.freeze(Time.strptime(date, "%m/%d/%Y"))
12
12
  stub_appointment_request(lab_code, date, am_pm, body)
13
- Medivo::Appointment.find(lab_code, date).should == body
13
+ value = Medivo::Appointment.find(lab_code, date, am_pm)
14
+ Timecop.return
15
+ return value['times']
16
+ end
17
+
18
+ it "returns times" do
19
+ returned_times('11/01/2011', '').should == all_times
20
+ end
21
+
22
+ it "filters out past date times" do
23
+ returned_times('11/04/2011', '').should == all_times.slice(1,2)
24
+ end
25
+
26
+ it "filters out past am or pm times" do
27
+ returned_times('11/04/2011', 'AM').should == all_times.slice(1,1)
14
28
  end
15
29
  end
16
30
 
@@ -18,7 +32,8 @@ describe Medivo::Appointment do
18
32
  let(:body) { {'message'=> "invalid data"} }
19
33
 
20
34
  it "for status 400" do
21
- stub_appointment_request(lab_code, date, am_pm, body, 400)
35
+ date = '11/01/2011'
36
+ stub_appointment_request(lab_code, date, '', body, 400)
22
37
  expect { Medivo::Appointment.find(lab_code, date) }.to raise_error
23
38
  end
24
39
  end
data/spec/spec_helper.rb CHANGED
@@ -10,6 +10,7 @@ Spork.prefork do
10
10
  require 'machinist/active_record'
11
11
  require 'webmock/rspec'
12
12
  require 'pdf/toolkit'
13
+ require 'timecop'
13
14
 
14
15
  Rails.backtrace_cleaner.remove_silencers!
15
16
  Rails.application.routes.mounted_helpers
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.25
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-09 00:00:00.000000000 -05:00
12
+ date: 2011-11-10 00:00:00.000000000 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &2156633840 !ruby/object:Gem::Requirement
17
+ requirement: &2165213560 !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: *2156633840
25
+ version_requirements: *2165213560
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2156632980 !ruby/object:Gem::Requirement
28
+ requirement: &2165213140 !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: *2156632980
36
+ version_requirements: *2165213140
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2156631700 !ruby/object:Gem::Requirement
39
+ requirement: &2165212680 !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: *2156631700
47
+ version_requirements: *2165212680
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2156630440 !ruby/object:Gem::Requirement
50
+ requirement: &2165212260 !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: *2156630440
58
+ version_requirements: *2165212260
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: geocoder
61
- requirement: &2156629000 !ruby/object:Gem::Requirement
61
+ requirement: &2165211840 !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: *2156629000
69
+ version_requirements: *2165211840
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
- requirement: &2156627860 !ruby/object:Gem::Requirement
72
+ requirement: &2165211420 !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: *2156627860
80
+ version_requirements: *2165211420
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: pdfkit
83
- requirement: &2156626520 !ruby/object:Gem::Requirement
83
+ requirement: &2165210980 !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: *2156626520
91
+ version_requirements: *2165210980
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: prawn
94
- requirement: &2156625500 !ruby/object:Gem::Requirement
94
+ requirement: &2165210560 !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: *2156625500
102
+ version_requirements: *2165210560
103
103
  description: Use the medivo platform to find lab locations, make labcorp appointments,
104
104
  place lab orders
105
105
  email:
@@ -162,6 +162,7 @@ files:
162
162
  - lib/pdf/medivo/fdf_generator.rb
163
163
  - lib/pdf/medivo/pdf_generator.rb
164
164
  - lib/pdf/medivo/pdf_group.rb
165
+ - lib/support/date_formats.rb
165
166
  - lib/support/validators.rb
166
167
  - lib/tasks/medivo_tasks.rake
167
168
  - MIT-LICENSE
@@ -262,6 +263,7 @@ files:
262
263
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
263
264
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
264
265
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
266
+ - spec/dummy/tmp/pids/server.pid
265
267
  - spec/fixtures/hepc_negative_results.pdf
266
268
  - spec/fixtures/hepc_result_faq.pdf
267
269
  - spec/fixtures/lc_order_with_normal_results.xml
@@ -299,7 +301,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
299
301
  version: '0'
300
302
  segments:
301
303
  - 0
302
- hash: 3179551727444907382
304
+ hash: 4245641511955668076
303
305
  required_rubygems_version: !ruby/object:Gem::Requirement
304
306
  none: false
305
307
  requirements:
@@ -308,7 +310,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
310
  version: '0'
309
311
  segments:
310
312
  - 0
311
- hash: 3179551727444907382
313
+ hash: 4245641511955668076
312
314
  requirements: []
313
315
  rubyforge_project:
314
316
  rubygems_version: 1.6.2
@@ -411,6 +413,7 @@ test_files:
411
413
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
412
414
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
413
415
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
416
+ - spec/dummy/tmp/pids/server.pid
414
417
  - spec/fixtures/hepc_negative_results.pdf
415
418
  - spec/fixtures/hepc_result_faq.pdf
416
419
  - spec/fixtures/lc_order_with_normal_results.xml