medivo 0.2.17 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/app/controllers/medivo/labs_controller.rb +1 -1
  2. data/app/models/medivo/appointment.rb +25 -8
  3. data/lib/medivo/version.rb +1 -1
  4. data/spec/dummy/config/medivo/appointment_resource.yml +0 -1
  5. data/spec/dummy/log/development.log +139 -0
  6. data/spec/dummy/log/test.log +153 -0
  7. data/spec/dummy/tmp/cache/assets/C46/F00/sprockets%2F2281d588b540056c5a7306c32a3761b9 +0 -0
  8. data/spec/dummy/tmp/cache/assets/C53/C80/sprockets%2F9297b5f504687910109d311f03f8a7b3 +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/CD5/670/sprockets%2F7f42231e2382a32f5a39dc7807f0b4d1 +0 -0
  13. data/spec/dummy/tmp/cache/assets/CDD/820/sprockets%2Fb28231960c7ac62eff9048e702a29c70 +0 -0
  14. data/spec/dummy/tmp/cache/assets/CEC/EF0/sprockets%2F4b24a74018f693c06088bd52f8cc9f86 +0 -0
  15. data/spec/dummy/tmp/cache/assets/CEE/250/sprockets%2F96688f33f2f8aa261bf6701c1d6d7575 +0 -0
  16. data/spec/dummy/tmp/cache/assets/D20/F10/sprockets%2Fb2e907e4faa85fe755f4439e3b229088 +0 -0
  17. data/spec/dummy/tmp/cache/assets/D29/000/sprockets%2F61a10ddf57f1129c02a1049bfed6e007 +0 -0
  18. data/spec/dummy/tmp/cache/assets/D2C/F80/sprockets%2F399f6d5eb273936af7ff8f35a77c5037 +0 -0
  19. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  20. data/spec/dummy/tmp/cache/assets/D45/320/sprockets%2Fc50ff379a1bdf1dd4d22249058749cf6 +0 -0
  21. data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
  22. data/spec/dummy/tmp/cache/assets/D5D/3E0/sprockets%2F63fea6cc142b5f02da93bf81e70b2116 +0 -0
  23. data/spec/dummy/tmp/cache/assets/D60/030/sprockets%2Ffc9485f617fc5e9b8918755d2e08ecc6 +0 -0
  24. data/spec/dummy/tmp/cache/assets/D64/C50/sprockets%2F22ee6fb2ab1ea9694ac7f0f41a406094 +0 -0
  25. data/spec/dummy/tmp/cache/assets/D74/9A0/sprockets%2F0ca4e6e833c72156fc7e7d5f007d9ce3 +0 -0
  26. data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
  27. data/spec/dummy/tmp/cache/assets/D88/2C0/sprockets%2F452ab3ebb1912cf1c2ba617eec52a718 +0 -0
  28. data/spec/dummy/tmp/cache/assets/DCA/B80/sprockets%2Fb4aad54185f42b1b871997ef2dc2fabb +0 -0
  29. data/spec/dummy/tmp/cache/assets/DCE/E80/sprockets%2Fc71ec62157b9cc7aabfc030955cef87b +0 -0
  30. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  31. data/spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4 +0 -0
  32. data/spec/models/appointment_spec.rb +14 -13
  33. metadata +19 -21
  34. data/spec/dummy/tmp/pids/server.pid +0 -1
@@ -8,7 +8,7 @@ module Medivo
8
8
 
9
9
  def find_appointment
10
10
  data = Medivo::Appointment.find(params[:lab_code], params[:date], params[:am_pm])
11
- render :json=> data
11
+ render :json=> {times: data}
12
12
  rescue => e
13
13
  appointment_error_handler(e)
14
14
  end
@@ -15,7 +15,7 @@ module Medivo
15
15
  # @param date date to seek
16
16
  # @param am_pm optional time of day value ( 'AM' or 'PM' )
17
17
  #
18
- # @return Hash { :times=>['time1', 'time2'] }
18
+ # @return Array of times ['time1', 'time2']
19
19
  #
20
20
  # @throws exception mainly Restclient::Exception types
21
21
  def find(lab_code, date, am_pm='')
@@ -27,7 +27,8 @@ module Medivo
27
27
  data = build_fake_data(date)
28
28
  end
29
29
  # filter the hash before returning
30
- {'times'=> filter_data(data, am_pm)}
30
+ search_date = Time.parse(date)
31
+ filter_data(data, am_pm, search_date)
31
32
  end
32
33
 
33
34
  ##
@@ -69,12 +70,11 @@ module Medivo
69
70
  true unless !Rails.env.test? and @config.real_data == false
70
71
  end
71
72
 
72
- def filter_data(times, am_pm)
73
- now = Time.now
74
- times.collect! { |time| OpenStruct.new(time: (Time.strptime(time, LABCORP_FORMAT) rescue nil), time_str: time) }
75
- times.reject! { |o| !o.time or !o.time_str.match(/#{am_pm}/) or (o.time < now) }
76
- times.sort_by! {|o| o.time }
77
- times.collect! { |o| o.time_str }
73
+ def filter_data(times, am_pm, search_date)
74
+ times.collect { |time| AppointmentTime.new(time) }
75
+ .select { |at| at.match(am_pm, Time.now) }
76
+ .sort_by {|at| at.nearness_to_date(search_date) }
77
+ .collect { |at| at.time_str }
78
78
  end
79
79
 
80
80
  def build_fake_data(date)
@@ -92,3 +92,20 @@ module Medivo
92
92
  end
93
93
  end
94
94
  end
95
+
96
+ class AppointmentTime
97
+ attr_reader :time, :time_str
98
+
99
+ def initialize(time_str)
100
+ @time_str = time_str
101
+ @time = Time.strptime(time_str, Medivo::Appointment::LABCORP_FORMAT) rescue nil
102
+ end
103
+
104
+ def match(am_pm, current_time)
105
+ time and time_str.match(/#{am_pm}/) and (time >= current_time)
106
+ end
107
+
108
+ def nearness_to_date(date)
109
+ (time - date).to_i.abs
110
+ end
111
+ end
@@ -1,3 +1,3 @@
1
1
  module Medivo
2
- VERSION = "0.2.17"
2
+ VERSION = "0.2.18"
3
3
  end
@@ -11,7 +11,6 @@ test:
11
11
  password:
12
12
 
13
13
  development:
14
- # <<: *default
15
14
  href: http://localhost:9000/appointment
16
15
  real_data: true
17
16
 
@@ -21318,3 +21318,142 @@ Started GET "/medivo/labs/find_appointment?utf8=%E2%9C%93&date=11%2F19%2F2011&la
21318
21318
  Processing by Medivo::LabsController#find_appointment as JS
21319
21319
  Parameters: {"utf8"=>"✓", "date"=>"11/19/2011", "lab_code"=>"23021", "commit"=>"Search for appointments"}
21320
21320
  Completed 200 OK in 3537ms (Views: 6.0ms)
21321
+
21322
+
21323
+ Started GET "/medivo/labs/find_appointment?utf8=%E2%9C%93&date=11%2F19%2F2011&lab_code=23021&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-16 07:30:39 -0500
21324
+ Processing by Medivo::LabsController#find_appointment as JS
21325
+ Parameters: {"utf8"=>"✓", "date"=>"11/19/2011", "lab_code"=>"23021", "commit"=>"Search for appointments"}
21326
+ Completed 200 OK in 5184ms (Views: 5.1ms)
21327
+
21328
+
21329
+ Started GET "/medivo/labs/find_appointment?utf8=%E2%9C%93&date=11%2F19%2F2011&lab_code=23021&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-16 07:34:44 -0500
21330
+ Processing by Medivo::LabsController#find_appointment as JS
21331
+ Parameters: {"utf8"=>"✓", "date"=>"11/19/2011", "lab_code"=>"23021", "commit"=>"Search for appointments"}
21332
+ Completed 200 OK in 3635ms (Views: 5.2ms)
21333
+
21334
+
21335
+ Started GET "/labs/lab_search?zip_code=90210" for 127.0.0.1 at 2011-11-16 07:40:44 -0500
21336
+ Processing by LabsController#lab_search as HTML
21337
+ Parameters: {"zip_code"=>"90210"}
21338
+ Rendered labs/search.html.haml within layouts/application (29.1ms)
21339
+ Completed 200 OK in 2974ms (Views: 143.6ms)
21340
+
21341
+
21342
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21343
+ Served asset /application.css - 304 Not Modified (0ms)
21344
+
21345
+
21346
+ Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21347
+ Served asset /jquery_ujs.js - 304 Not Modified (1ms)
21348
+
21349
+
21350
+ Started GET "/assets/medivo/handlebars.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21351
+ Served asset /medivo/handlebars.js - 304 Not Modified (3ms)
21352
+
21353
+
21354
+ Started GET "/assets/medivo/lab_list/models.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21355
+ Served asset /medivo/lab_list/models.js - 304 Not Modified (2ms)
21356
+
21357
+
21358
+ Started GET "/assets/medivo/lab_list/views.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21359
+ Served asset /medivo/lab_list/views.js - 304 Not Modified (2ms)
21360
+
21361
+
21362
+ Started GET "/assets/medivo/views.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21363
+ Served asset /medivo/views.js - 304 Not Modified (2ms)
21364
+
21365
+
21366
+ Started GET "/assets/medivo/lab_list/handlers.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21367
+ Served asset /medivo/lab_list/handlers.js - 304 Not Modified (2ms)
21368
+
21369
+
21370
+ Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21371
+ Served asset /jquery.js - 304 Not Modified (5ms)
21372
+
21373
+
21374
+ Started GET "/assets/medivo/lab_list/application.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21375
+ Served asset /medivo/lab_list/application.js - 304 Not Modified (5ms)
21376
+
21377
+
21378
+ Started GET "/assets/medivo/lab_list/sample/show_labs.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21379
+ Served asset /medivo/lab_list/sample/show_labs.js - 304 Not Modified (2ms)
21380
+
21381
+
21382
+ Started GET "/assets/medivo/date.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21383
+ Served asset /medivo/date.js - 304 Not Modified (4ms)
21384
+
21385
+
21386
+ Started GET "/assets/medivo/lab_appointment/models.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21387
+ Served asset /medivo/lab_appointment/models.js - 304 Not Modified (2ms)
21388
+
21389
+
21390
+ Started GET "/assets/medivo/lab_appointment/views.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21391
+ Served asset /medivo/lab_appointment/views.js - 304 Not Modified (2ms)
21392
+
21393
+
21394
+ Started GET "/assets/medivo/lab_appointment/handlers.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21395
+ Served asset /medivo/lab_appointment/handlers.js - 304 Not Modified (2ms)
21396
+
21397
+
21398
+ Started GET "/assets/medivo/lab_appointment/application.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21399
+ Served asset /medivo/lab_appointment/application.js - 304 Not Modified (3ms)
21400
+
21401
+
21402
+ Started GET "/assets/medivo/helpers.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21403
+ Served asset /medivo/helpers.js - 304 Not Modified (2ms)
21404
+
21405
+
21406
+ Started GET "/assets/medivo/lab_appointment/sample/show_appointments.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21407
+ Served asset /medivo/lab_appointment/sample/show_appointments.js - 304 Not Modified (2ms)
21408
+
21409
+
21410
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21411
+ Served asset /application.js - 304 Not Modified (0ms)
21412
+
21413
+
21414
+ Started GET "/assets/medivo/models.js?body=1" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21415
+ Served asset /medivo/models.js - 304 Not Modified (3ms)
21416
+
21417
+
21418
+ Started GET "/assets/medivo/ajax_waiting.gif" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21419
+ Served asset /medivo/ajax_waiting.gif - 304 Not Modified (2ms)
21420
+
21421
+
21422
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21423
+ Served asset /medivo/markerA.png - 304 Not Modified (2ms)
21424
+
21425
+
21426
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21427
+ Served asset /medivo/markerB.png - 304 Not Modified (1ms)
21428
+
21429
+
21430
+ Started GET "/assets/medivo/markerC.png" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21431
+ Served asset /medivo/markerC.png - 304 Not Modified (2ms)
21432
+
21433
+
21434
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-16 07:40:47 -0500
21435
+ Served asset /medivo/arrow.png - 304 Not Modified (2ms)
21436
+
21437
+
21438
+ Started GET "/medivo/labs?utf8=%E2%9C%93&zip_code=10009&commit=Search" for 127.0.0.1 at 2011-11-16 07:40:55 -0500
21439
+ Processing by Medivo::LabsController#index as JS
21440
+ Parameters: {"utf8"=>"✓", "zip_code"=>"10009", "commit"=>"Search"}
21441
+ Completed 200 OK in 4935ms (Views: 46.2ms)
21442
+
21443
+
21444
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-16 07:41:00 -0500
21445
+ Served asset /medivo/markerA.png - 304 Not Modified (0ms)
21446
+
21447
+
21448
+ Started GET "/assets/medivo/markerC.png" for 127.0.0.1 at 2011-11-16 07:41:00 -0500
21449
+ Served asset /medivo/markerC.png - 304 Not Modified (0ms)
21450
+
21451
+
21452
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-16 07:41:00 -0500
21453
+ Served asset /medivo/markerB.png - 304 Not Modified (0ms)
21454
+
21455
+
21456
+ Started GET "/medivo/labs/find_appointment?utf8=%E2%9C%93&date=11%2F19%2F2011&lab_code=23021&commit=Search+for+appointments" for 127.0.0.1 at 2011-11-16 07:41:06 -0500
21457
+ Processing by Medivo::LabsController#find_appointment as JS
21458
+ Parameters: {"utf8"=>"✓", "date"=>"11/19/2011", "lab_code"=>"23021", "commit"=>"Search for appointments"}
21459
+ Completed 200 OK in 5182ms (Views: 4.8ms)
@@ -3083,3 +3083,156 @@ Started POST "/medivo/labs/make_appointment" for 127.0.0.1 at 2011-11-04 00:00:0
3083
3083
  Processing by Medivo::LabsController#make_appointment as HTML
3084
3084
  Parameters: {"lab_code"=>"20060", "time"=>"2011-11-01 08:30:00 UTC", "user"=>{"first_name"=>"dude", "last_name"=>nil, "date_of_birth"=>"12/28/1980", "email_address"=>"dudeman@dude.com", "phone_number"=>"4155551212"}}
3085
3085
  Completed 200 OK in 0ms (Views: 0.0ms)
3086
+ Processing by OrdersController#download_requisition as HTML
3087
+ Rendered text template (0.0ms)
3088
+ Sent data unitedhealthcare_requisition.pdf (80.3ms)
3089
+ Completed 200 OK in 1562ms (Views: 79.7ms)
3090
+ Processing by OrdersController#download_result as HTML
3091
+ Sent data unitedhealthcare_result.pdf (2.6ms)
3092
+ Completed 200 OK in 776ms (Views: 1.6ms)
3093
+
3094
+
3095
+ Started GET "/medivo/labs?zip_code=90210" for 127.0.0.1 at 2011-11-16 10:26:41 -0500
3096
+ Processing by Medivo::LabsController#index as HTML
3097
+ Parameters: {"zip_code"=>"90210"}
3098
+ Completed 200 OK in 356ms (Views: 2.3ms)
3099
+
3100
+
3101
+ Started GET "/labs/lab_search?zip_code=90210" for 127.0.0.1 at 2011-11-16 10:26:45 -0500
3102
+ Processing by LabsController#lab_search as HTML
3103
+ Parameters: {"zip_code"=>"90210"}
3104
+ Completed 200 OK in 293ms (Views: 53.2ms)
3105
+
3106
+
3107
+ Started GET "/assets/application.css" for 127.0.0.1 at 2011-11-16 10:26:46 -0500
3108
+ Compiled application.css (4ms) (pid 12650)
3109
+ Served asset /application.css - 200 OK (16ms)
3110
+
3111
+
3112
+ Started GET "/assets/application.js" for 127.0.0.1 at 2011-11-16 10:26:46 -0500
3113
+ Compiled application.js (9ms) (pid 12650)
3114
+ Compiled jquery.js (6ms) (pid 12650)
3115
+ Compiled jquery_ujs.js (0ms) (pid 12650)
3116
+ Compiled medivo/lab_list/application.js (8ms) (pid 12650)
3117
+ Compiled medivo/handlebars.js (0ms) (pid 12650)
3118
+ Compiled medivo/helpers.js (230ms) (pid 12650)
3119
+ Compiled medivo/lab_list/models.js (203ms) (pid 12650)
3120
+ Compiled medivo/models.js (181ms) (pid 12650)
3121
+ Compiled medivo/lab_list/views.js (192ms) (pid 12650)
3122
+ Compiled medivo/views.js (242ms) (pid 12650)
3123
+ Compiled medivo/lab_list/handlers.js (169ms) (pid 12650)
3124
+ Compiled medivo/lab_list/sample/show_labs.js (166ms) (pid 12650)
3125
+ Compiled medivo/lab_appointment/application.js (12ms) (pid 12650)
3126
+ Compiled medivo/date.js (0ms) (pid 12650)
3127
+ Compiled medivo/lab_appointment/models.js (174ms) (pid 12650)
3128
+ Compiled medivo/lab_appointment/views.js (173ms) (pid 12650)
3129
+ Compiled medivo/lab_appointment/handlers.js (178ms) (pid 12650)
3130
+ Compiled medivo/lab_appointment/sample/show_appointments.js (175ms) (pid 12650)
3131
+ Served asset /application.js - 200 OK (2225ms)
3132
+
3133
+
3134
+ Started GET "/assets/medivo/ajax_waiting.gif" for 127.0.0.1 at 2011-11-16 10:26:48 -0500
3135
+ Served asset /medivo/ajax_waiting.gif - 200 OK (5ms)
3136
+
3137
+
3138
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-16 10:26:48 -0500
3139
+ Served asset /medivo/markerA.png - 200 OK (7ms)
3140
+
3141
+
3142
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-16 10:26:48 -0500
3143
+ Served asset /medivo/markerB.png - 200 OK (5ms)
3144
+
3145
+
3146
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-16 10:26:48 -0500
3147
+ Served asset /medivo/arrow.png - 200 OK (5ms)
3148
+
3149
+
3150
+ Started GET "/medivo/labs/find_appointment?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-16 10:26:48 -0500
3151
+ Processing by Medivo::LabsController#find_appointment as HTML
3152
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
3153
+ Completed 200 OK in 1ms (Views: 0.6ms)
3154
+
3155
+
3156
+ Started GET "/medivo/labs/find_appointment?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-16 10:26:48 -0500
3157
+ Processing by Medivo::LabsController#find_appointment as HTML
3158
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
3159
+ Completed 200 OK in 1ms (Views: 0.3ms)
3160
+
3161
+
3162
+ Started GET "/medivo/labs/find_appointment?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-16 10:26:48 -0500
3163
+ Processing by Medivo::LabsController#find_appointment as HTML
3164
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
3165
+ Completed 404 Not Found in 1ms (Views: 0.4ms)
3166
+
3167
+
3168
+ Started POST "/medivo/labs/make_appointment" for 127.0.0.1 at 2011-11-16 10:26:49 -0500
3169
+ Processing by Medivo::LabsController#make_appointment as HTML
3170
+ Parameters: {"lab_code"=>"20060", "time"=>"2011-11-01 08:30:00 UTC", "user"=>{"first_name"=>"dude", "last_name"=>nil, "date_of_birth"=>"12/28/1980", "email_address"=>"dudeman@dude.com", "phone_number"=>"4155551212"}}
3171
+ Completed 200 OK in 5ms (Views: 0.3ms)
3172
+ Processing by OrdersController#download_requisition as HTML
3173
+ Rendered text template (0.0ms)
3174
+ Sent data unitedhealthcare_requisition.pdf (94.1ms)
3175
+ Completed 200 OK in 999ms (Views: 93.5ms)
3176
+ Processing by OrdersController#download_result as HTML
3177
+ Sent data unitedhealthcare_result.pdf (2.0ms)
3178
+ Completed 200 OK in 763ms (Views: 1.4ms)
3179
+
3180
+
3181
+ Started GET "/medivo/labs?zip_code=90210" for 127.0.0.1 at 2011-11-16 10:29:34 -0500
3182
+ Processing by Medivo::LabsController#index as HTML
3183
+ Parameters: {"zip_code"=>"90210"}
3184
+ Completed 200 OK in 236ms (Views: 1.9ms)
3185
+
3186
+
3187
+ Started GET "/labs/lab_search?zip_code=90210" for 127.0.0.1 at 2011-11-16 10:29:36 -0500
3188
+ Processing by LabsController#lab_search as HTML
3189
+ Parameters: {"zip_code"=>"90210"}
3190
+ Completed 200 OK in 223ms (Views: 41.3ms)
3191
+
3192
+
3193
+ Started GET "/assets/application.css" for 127.0.0.1 at 2011-11-16 10:29:36 -0500
3194
+ Served asset /application.css - 200 OK (5ms)
3195
+
3196
+
3197
+ Started GET "/assets/application.js" for 127.0.0.1 at 2011-11-16 10:29:36 -0500
3198
+ Served asset /application.js - 200 OK (24ms)
3199
+
3200
+
3201
+ Started GET "/assets/medivo/ajax_waiting.gif" for 127.0.0.1 at 2011-11-16 10:29:36 -0500
3202
+ Served asset /medivo/ajax_waiting.gif - 200 OK (1ms)
3203
+
3204
+
3205
+ Started GET "/assets/medivo/markerA.png" for 127.0.0.1 at 2011-11-16 10:29:36 -0500
3206
+ Served asset /medivo/markerA.png - 200 OK (3ms)
3207
+
3208
+
3209
+ Started GET "/assets/medivo/markerB.png" for 127.0.0.1 at 2011-11-16 10:29:36 -0500
3210
+ Served asset /medivo/markerB.png - 200 OK (1ms)
3211
+
3212
+
3213
+ Started GET "/assets/medivo/arrow.png" for 127.0.0.1 at 2011-11-16 10:29:37 -0500
3214
+ Served asset /medivo/arrow.png - 200 OK (3ms)
3215
+
3216
+
3217
+ Started GET "/medivo/labs/find_appointment?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-16 10:29:37 -0500
3218
+ Processing by Medivo::LabsController#find_appointment as HTML
3219
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
3220
+ Completed 200 OK in 1ms (Views: 0.5ms)
3221
+
3222
+
3223
+ Started GET "/medivo/labs/find_appointment?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-16 10:29:37 -0500
3224
+ Processing by Medivo::LabsController#find_appointment as HTML
3225
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
3226
+ Completed 200 OK in 1ms (Views: 0.4ms)
3227
+
3228
+
3229
+ Started GET "/medivo/labs/find_appointment?date=11%2F01%2F2011&lab_code=20060" for 127.0.0.1 at 2011-11-16 10:29:37 -0500
3230
+ Processing by Medivo::LabsController#find_appointment as HTML
3231
+ Parameters: {"date"=>"11/01/2011", "lab_code"=>"20060"}
3232
+ Completed 404 Not Found in 1ms (Views: 0.3ms)
3233
+
3234
+
3235
+ Started POST "/medivo/labs/make_appointment" for 127.0.0.1 at 2011-11-16 10:29:37 -0500
3236
+ Processing by Medivo::LabsController#make_appointment as HTML
3237
+ Parameters: {"lab_code"=>"20060", "time"=>"2011-11-01 08:30:00 UTC", "user"=>{"first_name"=>"dude", "last_name"=>nil, "date_of_birth"=>"12/28/1980", "email_address"=>"dudeman@dude.com", "phone_number"=>"4155551212"}}
3238
+ Completed 200 OK in 3ms (Views: 0.3ms)
@@ -12,37 +12,38 @@ describe Medivo::Appointment do
12
12
 
13
13
  let(:body) { {'times'=> @all_times} }
14
14
 
15
- def returned_times(date, am_pm)
16
- Timecop.freeze(Time.strptime(date, "%m/%d/%Y"))
15
+ def returned_times(date, am_pm, freeze_date = date)
16
+ Timecop.freeze(Date.parse(freeze_date))
17
17
  stub_appointment_request(lab_code, date, am_pm, body)
18
18
  value = Medivo::Appointment.find(lab_code, date, am_pm)
19
19
  Timecop.return
20
- return value['times']
21
- end
22
-
23
- it "returns times" do
24
- returned_times('11/01/2011', '').should == @all_times.sort
20
+ value
25
21
  end
26
22
 
27
23
  it "filters out past date times" do
28
- returned_times('11/04/2011', '').should == @all_times.slice(1, 2).sort
24
+ returned_times('2011-11-04', '').should_not include "11/03/2011|08:30 AM"
29
25
  end
30
26
 
31
27
  it "filters out past or pm times" do
32
- returned_times('11/04/2011', 'AM').should == ["11/04/2011|08:30 AM"]
28
+ returned_times('2011-11-04', 'AM').should == ["11/04/2011|08:30 AM"]
33
29
  end
34
30
 
35
31
  it "filters out past or am times" do
36
- returned_times('11/04/2011', 'PM').should == ["11/04/2011|08:30 PM"]
32
+ returned_times('2011-11-04', 'PM').should == ["11/04/2011|08:30 PM"]
37
33
  end
38
34
 
39
35
  it "filters out invalid time strings" do
40
36
  @all_times = ["11/02011|08:30 AM", "11/04/2011|11:30 AM"]
41
- returned_times('11/04/2011', '').should == ["11/04/2011|11:30 AM"]
37
+ returned_times('2011-11-04', '').should == ["11/04/2011|11:30 AM"]
38
+ end
39
+
40
+ it "orders the time strings by date" do
41
+ returned_times('2011-11-04', '').should == ["11/04/2011|08:30 AM", "11/04/2011|08:30 PM"]
42
42
  end
43
43
 
44
- it "orders the time strings" do
45
- returned_times('11/04/2011', '').should == ["11/04/2011|08:30 AM", "11/04/2011|08:30 PM"]
44
+ it "orders the time strings by nearness to search date" do
45
+ @all_times = ["11/06/2011|12:30 AM", "11/04/2011|08:30 PM", "11/05/2011|08:30 AM"]
46
+ returned_times('2011-11-06', '', "2011-11-04").should == ["11/06/2011|12:30 AM", "11/05/2011|08:30 AM", "11/04/2011|08:30 PM"]
46
47
  end
47
48
  end
48
49
 
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.2.17
4
+ version: 0.2.18
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: &2169360420 !ruby/object:Gem::Requirement
17
+ requirement: &2152297540 !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: *2169360420
25
+ version_requirements: *2152297540
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: jquery-rails
28
- requirement: &2169360000 !ruby/object:Gem::Requirement
28
+ requirement: &2152297120 !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: *2169360000
36
+ version_requirements: *2152297120
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: coffee-script
39
- requirement: &2169359540 !ruby/object:Gem::Requirement
39
+ requirement: &2152296660 !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: *2169359540
47
+ version_requirements: *2152296660
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: haml-rails
50
- requirement: &2169359120 !ruby/object:Gem::Requirement
50
+ requirement: &2152296240 !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: *2169359120
58
+ version_requirements: *2152296240
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: geocoder
61
- requirement: &2169358700 !ruby/object:Gem::Requirement
61
+ requirement: &2152295820 !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: *2169358700
69
+ version_requirements: *2152295820
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rest-client
72
- requirement: &2169358280 !ruby/object:Gem::Requirement
72
+ requirement: &2152295400 !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: *2169358280
80
+ version_requirements: *2152295400
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: pdfkit
83
- requirement: &2169357860 !ruby/object:Gem::Requirement
83
+ requirement: &2152294980 !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: *2169357860
91
+ version_requirements: *2152294980
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: prawn
94
- requirement: &2169357440 !ruby/object:Gem::Requirement
94
+ requirement: &2152294560 !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: *2169357440
102
+ version_requirements: *2152294560
103
103
  description: Use the medivo platform to find lab locations, make labcorp appointments,
104
104
  place lab orders
105
105
  email:
@@ -269,7 +269,6 @@ files:
269
269
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
270
270
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
271
271
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
272
- - spec/dummy/tmp/pids/server.pid
273
272
  - spec/fixtures/hl7/lc_hga1c_abnormal.hl7
274
273
  - spec/fixtures/hl7/lc_hga1c_normal.hl7
275
274
  - spec/fixtures/images/southeast.jpg
@@ -312,7 +311,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
312
311
  version: '0'
313
312
  segments:
314
313
  - 0
315
- hash: 3829468340519302469
314
+ hash: -280239849762613463
316
315
  required_rubygems_version: !ruby/object:Gem::Requirement
317
316
  none: false
318
317
  requirements:
@@ -321,7 +320,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
321
320
  version: '0'
322
321
  segments:
323
322
  - 0
324
- hash: 3829468340519302469
323
+ hash: -280239849762613463
325
324
  requirements: []
326
325
  rubyforge_project:
327
326
  rubygems_version: 1.6.2
@@ -429,7 +428,6 @@ test_files:
429
428
  - spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4
430
429
  - spec/dummy/tmp/cache/assets/E59/D50/sprockets%2Fbe1cc4d9b0efb617e58baa16dd1dee58
431
430
  - spec/dummy/tmp/image_path_fb5f3a59200b_1320622886.pdf
432
- - spec/dummy/tmp/pids/server.pid
433
431
  - spec/fixtures/hl7/lc_hga1c_abnormal.hl7
434
432
  - spec/fixtures/hl7/lc_hga1c_normal.hl7
435
433
  - spec/fixtures/images/southeast.jpg
@@ -1 +0,0 @@
1
- 11069