medivo 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/app/assets/javascripts/medivo/date.js +1078 -0
- data/app/assets/javascripts/medivo/helpers.coffee +31 -0
- data/app/assets/javascripts/medivo/lab_appointment/application.js +6 -0
- data/app/assets/javascripts/medivo/lab_appointment/handlers.coffee +31 -0
- data/app/assets/javascripts/medivo/lab_appointment/models.coffee +16 -0
- data/app/assets/javascripts/medivo/lab_appointment/sample/show_appointments.coffee +13 -0
- data/app/assets/javascripts/medivo/lab_appointment/views.coffee +9 -0
- data/app/assets/javascripts/medivo/lab_list/application.js +2 -1
- data/app/assets/javascripts/medivo/lab_list/{init.coffee → handlers.coffee} +7 -6
- data/app/assets/javascripts/medivo/lab_list/models.coffee +12 -54
- data/app/assets/javascripts/medivo/lab_list/sample/show_labs.coffee +8 -1
- data/app/assets/javascripts/medivo/lab_list/views.coffee +21 -30
- data/app/assets/javascripts/medivo/models.coffee +29 -0
- data/app/assets/javascripts/medivo/views.coffee +16 -0
- data/app/controllers/medivo/labs_controller.rb +10 -0
- data/app/models/medivo/appointment.rb +21 -0
- data/app/models/medivo/appointment_resource.rb +14 -0
- data/app/models/medivo/insurance_order.rb +1 -6
- data/app/models/medivo/lab.rb +11 -9
- data/app/models/medivo/lab_resource.rb +14 -0
- data/app/models/medivo/order.rb +2 -2
- data/app/models/medivo/primary_insurance.rb +6 -4
- data/app/models/medivo/resource_config.rb +16 -0
- data/config/routes.rb +1 -0
- data/lib/generators/medivo/appointments/appointments_generator.rb +15 -0
- data/lib/generators/medivo/labs/labs_generator.rb +33 -0
- data/lib/generators/medivo/templates/appointment_resource.yml +11 -0
- data/lib/generators/medivo/templates/lab_resource.yml +21 -0
- data/lib/generators/medivo/templates/labs_controller.rb +6 -0
- data/lib/generators/medivo/templates/search.html.haml +45 -0
- data/lib/medivo.rb +2 -1
- data/lib/medivo/fdf_generator.rb +36 -0
- data/lib/medivo/version.rb +1 -1
- data/spec/dummy/app/assets/javascripts/application.js +2 -0
- data/spec/dummy/app/controllers/labs_controller.rb +3 -5
- data/spec/dummy/app/views/labs/search.html.haml +31 -1
- data/spec/dummy/config/medivo/appointment_resource.yml +12 -0
- data/spec/dummy/config/medivo/lab_resource.yml +21 -0
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/log/development.log +7782 -0
- data/spec/dummy/log/test.log +243 -0
- data/spec/dummy/tmp/cache/assets/C46/F00/sprockets%2F2281d588b540056c5a7306c32a3761b9 +0 -0
- data/spec/dummy/tmp/cache/assets/C69/500/sprockets%2F140b56780716711c2b6eb1028f042ca6 +0 -0
- data/spec/dummy/tmp/cache/assets/C6C/8D0/sprockets%2F2f423a28516973330a94ad121151f3bf +0 -0
- data/spec/dummy/tmp/cache/assets/C70/AC0/sprockets%2F25232afc7932c662d9d6f032030a2428 +0 -0
- data/spec/dummy/tmp/cache/assets/C81/D00/sprockets%2F64f056bd752d271308a86a6f865b1911 +0 -0
- data/spec/dummy/tmp/cache/assets/CB4/BD0/sprockets%2F3378f27c0d4f5e6d708665b22707a31f +0 -0
- data/spec/dummy/tmp/cache/assets/CC3/EF0/sprockets%2F453b504c1f8f374578636f699eaa455d +0 -0
- data/spec/dummy/tmp/cache/assets/CD8/DA0/sprockets%2F622aa5281d15503829a5f7a0bf56fc29 +0 -0
- data/spec/dummy/tmp/cache/assets/CDD/820/sprockets%2Fb28231960c7ac62eff9048e702a29c70 +0 -0
- data/spec/dummy/tmp/cache/assets/CEC/EF0/sprockets%2F4b24a74018f693c06088bd52f8cc9f86 +0 -0
- data/spec/dummy/tmp/cache/assets/CEE/250/sprockets%2F96688f33f2f8aa261bf6701c1d6d7575 +0 -0
- data/spec/dummy/tmp/cache/assets/D07/6B0/sprockets%2F69a2df619ff14da071309dac4196400e +0 -0
- data/spec/dummy/tmp/cache/assets/D1B/820/sprockets%2F92a83e15913997b3d9ac7ed437b1e44c +0 -0
- data/spec/dummy/tmp/cache/assets/D20/F10/sprockets%2Fb2e907e4faa85fe755f4439e3b229088 +0 -0
- data/spec/dummy/tmp/cache/assets/D29/000/sprockets%2F61a10ddf57f1129c02a1049bfed6e007 +0 -0
- data/spec/dummy/tmp/cache/assets/D2C/F80/sprockets%2F399f6d5eb273936af7ff8f35a77c5037 +0 -0
- data/spec/dummy/tmp/cache/assets/D30/920/sprockets%2Fcc4603fc6441ca421a7d02886a81ab9d +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/D36/870/sprockets%2Fce9e887568de873b133ae43d7c977f68 +0 -0
- data/spec/dummy/tmp/cache/assets/D3A/210/sprockets%2F4f9664dabb00038f85b417cc38bf83a1 +0 -0
- data/spec/dummy/tmp/cache/assets/D41/250/sprockets%2F7b3c4426715dcd1feedc4a95e5444256 +0 -0
- data/spec/dummy/tmp/cache/assets/D45/320/sprockets%2Fc50ff379a1bdf1dd4d22249058749cf6 +0 -0
- data/spec/dummy/tmp/cache/assets/D4C/7A0/sprockets%2Fbc635c7b186d1ef5178f4ed3722d868b +0 -0
- data/spec/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -0
- data/spec/dummy/tmp/cache/assets/D55/ED0/sprockets%2F0f673e42e816c6fe5b66a5c96f896f1a +0 -0
- data/spec/dummy/tmp/cache/assets/D5D/3E0/sprockets%2F63fea6cc142b5f02da93bf81e70b2116 +0 -0
- data/spec/dummy/tmp/cache/assets/D60/030/sprockets%2Ffc9485f617fc5e9b8918755d2e08ecc6 +0 -0
- data/spec/dummy/tmp/cache/assets/D64/C50/sprockets%2F22ee6fb2ab1ea9694ac7f0f41a406094 +0 -0
- data/spec/dummy/tmp/cache/assets/D65/6D0/sprockets%2F3ce07ca1958d7ab3e80c4b3e0d24088c +0 -0
- data/spec/dummy/tmp/cache/assets/D68/AD0/sprockets%2F19727663b4ec901b812dbdabee2526ec +0 -0
- data/spec/dummy/tmp/cache/assets/D69/130/sprockets%2Fbaa4ec50a34ce938c986612c2a47a64e +0 -0
- data/spec/dummy/tmp/cache/assets/D6E/700/sprockets%2Ff39fb8d8a25e4f3fd01a3e506ae31935 +0 -0
- data/spec/dummy/tmp/cache/assets/D74/9A0/sprockets%2F0ca4e6e833c72156fc7e7d5f007d9ce3 +0 -0
- data/spec/dummy/tmp/cache/assets/D76/720/sprockets%2F88d8aa1d2fb41ce79b8ec4150ea74748 +0 -0
- data/spec/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
- data/spec/dummy/tmp/cache/assets/D88/2C0/sprockets%2F452ab3ebb1912cf1c2ba617eec52a718 +0 -0
- data/spec/dummy/tmp/cache/assets/D9C/F50/sprockets%2F224e78bb9e1c414a2d518a3aaffd6f77 +0 -0
- data/spec/dummy/tmp/cache/assets/D9F/260/sprockets%2Fa3e040f83c30e4bbc1c79ffae57909e6 +0 -0
- data/spec/dummy/tmp/cache/assets/DA1/640/sprockets%2F91874cbba5e63cd19d6a7bd3c8362dc4 +0 -0
- data/spec/dummy/tmp/cache/assets/DC1/230/sprockets%2F3a36cd467bdce1914a2b7af4ed4114cf +0 -0
- data/spec/dummy/tmp/cache/assets/DCE/E80/sprockets%2Fc71ec62157b9cc7aabfc030955cef87b +0 -0
- data/spec/dummy/tmp/cache/assets/DD1/FD0/sprockets%2Fa531f33dc9c5852d39d64a9eda44dacf +0 -0
- data/spec/dummy/tmp/cache/assets/DD4/2B0/sprockets%2Fef214a63f29afe7f3cbffc65af943108 +0 -0
- data/spec/dummy/tmp/cache/assets/DFC/420/sprockets%2F502e2c683d1aaad6ac88966ffc4d2ade +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/E32/FC0/sprockets%2Fe55fb2eef11567fe04fdaf7e73af5ba4 +0 -0
- data/spec/dummy/tmp/pids/server.pid +1 -1
- data/spec/models/orders_spec.rb +1 -23
- data/spec/models/primary_insurance_spec.rb +31 -0
- data/spec/requests/labs_spec.rb +0 -1
- data/spec/spec_helper.rb +7 -1
- data/spec/support/blueprints.rb +9 -1
- data/spec/support/helper.rb +9 -0
- metadata +94 -26
- data/app/assets/javascripts/medivo/lab_appointments/application.js +0 -0
- data/app/assets/javascripts/medivo/lab_appointments/models.coffee +0 -0
- data/app/assets/javascripts/medivo/lab_appointments/sample/show_appointments.coffee +0 -0
- data/app/assets/javascripts/medivo/lab_appointments/views.coffee +0 -0
- data/app/models/medivo/resource.rb +0 -24
- data/lib/generators/medivo/install/install_generator.rb +0 -41
- data/lib/generators/medivo/install/templates/medivo_resource.yml +0 -9
- data/spec/dummy/config/medivo_resource.yml +0 -12
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'active_resource'
|
2
|
+
require_relative 'resource_config'
|
3
|
+
|
4
|
+
module Medivo
|
5
|
+
class AppointmentResource < ActiveResource::Base
|
6
|
+
resource = ResourceConfig.find 'appointment_resource.yml'
|
7
|
+
self.include_root_in_json = false
|
8
|
+
self.site = resource.href
|
9
|
+
self.user = resource.user
|
10
|
+
self.password = resource.password
|
11
|
+
self.format = :json
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'resource_config'
|
2
2
|
|
3
3
|
module Medivo
|
4
4
|
class InsuranceOrder < Order
|
@@ -8,11 +8,6 @@ module Medivo
|
|
8
8
|
validates_with Medivo::ArrayValidator, :fields => [:diagnosis_code]
|
9
9
|
validates_with PrimaryInsurance
|
10
10
|
|
11
|
-
def to_xml(options={})
|
12
|
-
options.merge!(:root=>self.class.element_name)
|
13
|
-
@attributes.merge(:primary_insurance=>primary_insurance.to_hash).to_xml(options)
|
14
|
-
end
|
15
|
-
|
16
11
|
# when getting the insurance info from medivo labs
|
17
12
|
def insurance
|
18
13
|
@insurance ||= try(:insurance_information).try(:primary_insurance_info)
|
data/app/models/medivo/lab.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
-
require_relative '
|
1
|
+
require_relative 'lab_resource'
|
2
2
|
|
3
3
|
module Medivo
|
4
|
-
class Lab <
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
4
|
+
class Lab < LabResource
|
5
|
+
unless defined? LAB_CORP_ID
|
6
|
+
LAB_CORP_ID = 129
|
7
|
+
QUEST_ID = 119
|
8
|
+
LAB_CORP_NAME = :lab_corp
|
9
|
+
QUEST_NAME = :quest
|
10
|
+
LAB_ID_TO_NAME = {LAB_CORP_ID => LAB_CORP_NAME, QUEST_ID => QUEST_NAME}
|
11
|
+
LAB_ID_TO_SHORT_NAME = {LAB_CORP_ID => 'LC', QUEST_ID => 'QD'}
|
12
|
+
LAB_ID_TO_PRETTY_NAME = {LAB_CORP_ID => 'Lab Corp', QUEST_ID => 'Quest Diagnostics'}
|
13
|
+
end
|
12
14
|
|
13
15
|
def self.findLabs(zip_code, radius = 15)
|
14
16
|
find(:all, :from => "/find_psc/#{zip_code}", :params=>{:radius=>radius}).sort_by(&:distance)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'active_resource'
|
2
|
+
require_relative 'resource_config'
|
3
|
+
|
4
|
+
module Medivo
|
5
|
+
class LabResource < ActiveResource::Base
|
6
|
+
resource = ResourceConfig.find 'lab_resource.yml'
|
7
|
+
self.include_root_in_json = false
|
8
|
+
self.site = resource.href
|
9
|
+
self.user = resource.user
|
10
|
+
self.password = resource.password
|
11
|
+
self.format = :xml
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
data/app/models/medivo/order.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Medivo
|
2
2
|
class PrimaryInsurance
|
3
3
|
include ActiveModel::Validations
|
4
|
+
include ActiveModel::Serializers::Xml
|
4
5
|
|
5
6
|
validates_presence_of :relationship, :company_name, :policy_number, :group_number
|
6
7
|
validates :relationship, :inclusion => {:in => 1..2}
|
@@ -13,14 +14,15 @@ module Medivo
|
|
13
14
|
@attributes[key]
|
14
15
|
end
|
15
16
|
|
16
|
-
def
|
17
|
-
@attributes
|
17
|
+
def attributes
|
18
|
+
@attributes.stringify_keys
|
18
19
|
end
|
19
20
|
|
21
|
+
# for use by InsuranceOrder to validate its primary insurance
|
20
22
|
def validate(record)
|
21
|
-
primary_insurance = record.attributes[
|
23
|
+
primary_insurance = record.attributes['primary_insurance']
|
22
24
|
record.errors.add(:primary_insurance, "primary_insurance field must be present") and return unless primary_insurance
|
23
|
-
record.errors.add(:primary_insurance, "primary_insurance field must be of PrimaryInsurance class") unless primary_insurance.is_a? PrimaryInsurance
|
25
|
+
record.errors.add(:primary_insurance, "primary_insurance field must be of PrimaryInsurance class") and return unless primary_insurance.is_a? PrimaryInsurance
|
24
26
|
primary_insurance.valid?
|
25
27
|
primary_insurance.errors.messages.each do |field, value|
|
26
28
|
record.errors.add(:"primary_insurance.#{field}", value.first)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'ostruct'
|
3
|
+
|
4
|
+
module Medivo
|
5
|
+
class ResourceConfig
|
6
|
+
|
7
|
+
def self.find resource_file
|
8
|
+
@resources ||= {}
|
9
|
+
return @resources[resource_file] if @resources[resource_file]
|
10
|
+
config_file = File.join(Rails.root.join('config', 'medivo', resource_file))
|
11
|
+
config = YAML.load_file(config_file)
|
12
|
+
@resources[resource_file] = OpenStruct.new config[Rails.env]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
data/config/routes.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Medivo
|
2
|
+
module Generators
|
3
|
+
class AppointmentsGenerator < Rails::Generators::Base
|
4
|
+
desc "This generator installs the medivo appointment_resource.yml file"
|
5
|
+
|
6
|
+
source_root File.expand_path('../../templates', __FILE__)
|
7
|
+
|
8
|
+
def medivo_appointment_resource_file
|
9
|
+
Dir::mkdir('config/medivo') unless File.exists?('config/medivo')
|
10
|
+
copy_file "appointment_resource.yml", "config/medivo/appointment_resource.yml"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Medivo
|
2
|
+
module Generators
|
3
|
+
class LabsGenerator < Rails::Generators::Base
|
4
|
+
desc "This generator installs the medivo lab_resource.yml file"
|
5
|
+
|
6
|
+
source_root File.expand_path('../../templates', __FILE__)
|
7
|
+
|
8
|
+
def lab_resource_file
|
9
|
+
FileUtils.mkdir_p('config/medivo')
|
10
|
+
copy_file "lab_resource.yml", "config/medivo/lab_resource.yml"
|
11
|
+
end
|
12
|
+
|
13
|
+
def lab_controller_sample
|
14
|
+
FileUtils.mkdir_p('app/controllers')
|
15
|
+
copy_file "labs_controller.rb", "app/controllers/labs_controller.rb"
|
16
|
+
end
|
17
|
+
|
18
|
+
def lab_search_view_sample
|
19
|
+
FileUtils.mkdir_p('app/views/labs')
|
20
|
+
copy_file "search.html.haml", "app/views/labs/search.html.haml"
|
21
|
+
end
|
22
|
+
|
23
|
+
def routes
|
24
|
+
medivo_engine_routes = 'mount Medivo::Engine => "/medivo", :as => "medivo"'
|
25
|
+
lab_search_route = 'match "/labs/search" => "labs#search", :via => :get, :as=> :search_labs'
|
26
|
+
line = "application.routes.draw do"
|
27
|
+
gsub_file 'config/routes.rb', /(#{Regexp.escape(line)})/mi do |match|
|
28
|
+
"#{match}\n #{medivo_engine_routes}\n #{lab_search_route}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# adjust these values to use your medivo campaign
|
2
|
+
# the user password are not the login user/pass .. but the api key and token
|
3
|
+
test:
|
4
|
+
href: http://test.medivo.com
|
5
|
+
user: test
|
6
|
+
password: test
|
7
|
+
|
8
|
+
development:
|
9
|
+
href: https://api16-staging.medivo.com
|
10
|
+
user: your.staging.medivo.campaign.api_key
|
11
|
+
password: your.staging.medivo.campaign.api_token
|
12
|
+
|
13
|
+
staging:
|
14
|
+
href: https://api16-staging.medivo.com
|
15
|
+
user: your.staging.medivo.campaign.api_key
|
16
|
+
password: your.staging.medivo.campaign.api_token
|
17
|
+
|
18
|
+
production:
|
19
|
+
href: https://api16.medivo.com
|
20
|
+
user: your.medivo.campaign.api_key
|
21
|
+
password: your.medivo.campaign.api_token
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// sample template for rendering lab info
|
2
|
+
%script{:id=>"lab_item_template", :type=>"text/x-handlebars-template"}
|
3
|
+
%li.lab_info
|
4
|
+
.lab_image
|
5
|
+
%img{:src=>"{{icon}}", :width=>'12px'}
|
6
|
+
%div
|
7
|
+
.lab_name
|
8
|
+
{{data/lab_name}}
|
9
|
+
.address
|
10
|
+
{{address_without_comma}}, {{titleize data/city}}, {{data/state}}
|
11
|
+
.phone
|
12
|
+
Tel: {{data/telephone}}
|
13
|
+
.link
|
14
|
+
// create your own /labs/select via :post method
|
15
|
+
= form_for :lab, :url=>'/select', :method=>'post' do |f|
|
16
|
+
%input{ :type=>:hidden, :name => 'id', :value=>"{{data/id}}" }
|
17
|
+
%input{ :type=>:hidden, :name => 'lab_id', :value=>"{{data/lab_id}}" }
|
18
|
+
%input{ :type=>:hidden, :name => 'lab_info[name]', :value=>"{{data/lab_name}}" }
|
19
|
+
%input{ :type=>:hidden, :name => 'lab_info[address]', :value=>"{{address_without_comma}}" }
|
20
|
+
%input{ :type=>:hidden, :name => 'lab_info[city]', :value=>"{{titleize data/city}}" }
|
21
|
+
%input{ :type=>:hidden, :name => 'lab_info[state]', :value=>"{{data/state}}" }
|
22
|
+
%input{ :type=>:hidden, :name => 'lab_info[zip]', :value=>"{{data/zip}}" }
|
23
|
+
%input{ :type=>:hidden, :name => 'lab_info[telephone]', :value=>"{{data/telephone}}" }
|
24
|
+
= f.submit 'Select location', :class=>'select_location button'
|
25
|
+
|
26
|
+
// map display
|
27
|
+
#map_canvas_container
|
28
|
+
#map_canvas{:style => "width:500px; height:350px"}
|
29
|
+
|
30
|
+
// lab list display .. using ul/li style but you can change that
|
31
|
+
#lab_list_container{ 'data-labs'=>@lab_data.to_json }
|
32
|
+
%ul#lab_list
|
33
|
+
|
34
|
+
%p{:style => 'padding-left:50px;'}
|
35
|
+
= link_to 'View more locations', '#', :id => 'more_labs_list_toggler'
|
36
|
+
|
37
|
+
// form for ajax lab searches ..the code to handle return data is in app/assets/medivo/labs/handle_ajax.coffee
|
38
|
+
= form_tag(medivo.data_labs_path, :method=>:get, :id=>'lab_data_search', :remote=>true) do
|
39
|
+
%div
|
40
|
+
Enter a new Zip Code
|
41
|
+
.error_message
|
42
|
+
|
43
|
+
= text_field_tag :zip_code, params[:zip_code]
|
44
|
+
%p
|
45
|
+
= submit_tag "Search", :id=> :find_labs, :class=>'button'
|
data/lib/medivo.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
module Medivo
|
2
|
+
module FdfGenerator
|
3
|
+
def self.file(info)
|
4
|
+
afile = Tempfile.new('fdf', :encoding => 'ascii-8bit')
|
5
|
+
afile.write "%FDF-1.2\x0d%\xe2\xe3\xcf\xd3\x0d\x0a"; # header
|
6
|
+
afile.write "1 0 obj\x0d<< " # open the Root dictionary
|
7
|
+
afile.write "\x0d/FDF << " # open the FDF dictionary
|
8
|
+
afile.write "/Fields [ " # open the form Fields array
|
9
|
+
|
10
|
+
info.each { |key, value|
|
11
|
+
if value.class == Hash
|
12
|
+
value.each { |sub_key, sub_value|
|
13
|
+
afile.write '<< /T (' + key.to_s + '_' + sub_key.to_s + ') /V '
|
14
|
+
afile.write '(' + escape_data(sub_value) + ') /ClrF 2 /ClrFf 1 >> '
|
15
|
+
}
|
16
|
+
else
|
17
|
+
afile.write '<< /T (' + key.to_s + ') /V (' + escape_data(value) + ') /ClrF 2 /ClrFf 1 >> '
|
18
|
+
end
|
19
|
+
}
|
20
|
+
|
21
|
+
afile.write "] \x0d" # close the Fields array
|
22
|
+
afile.write ">> \x0d" # close the FDF dictionary
|
23
|
+
afile.write ">> \x0dendobj\x0d" # close the Root dictionary
|
24
|
+
|
25
|
+
# trailer note the "1 0 R" reference to "1 0 obj" above
|
26
|
+
afile.write "trailer\x0d<<\x0d/Root 1 0 R \x0d\x0d>>\x0d"
|
27
|
+
afile.write "%%EOF\x0d\x0a"
|
28
|
+
afile.close
|
29
|
+
afile
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.escape_data(value)
|
33
|
+
value.to_s.strip.gsub(/[\(]/, '\\(').gsub(/[\)]/, '\\)')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/medivo/version.rb
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
= form_for :lab, :url=>'/select', :method=>'post' do |f|
|
16
16
|
%input{ :type=>:hidden, :name => 'id', :value=>"{{data/id}}" }
|
17
17
|
%input{ :type=>:hidden, :name => 'lab_id', :value=>"{{data/lab_id}}" }
|
18
|
+
%input{ :type=>:hidden, :name => 'lab_code', :value=>"{{data/code}}" }
|
18
19
|
%input{ :type=>:hidden, :name => 'lab_info[name]', :value=>"{{data/lab_name}}" }
|
19
20
|
%input{ :type=>:hidden, :name => 'lab_info[address]', :value=>"{{address_without_comma}}" }
|
20
21
|
%input{ :type=>:hidden, :name => 'lab_info[city]', :value=>"{{titleize data/city}}" }
|
@@ -31,7 +32,10 @@
|
|
31
32
|
#lab_list_container{ 'data-labs'=>@lab_data.to_json }
|
32
33
|
%ul#lab_list
|
33
34
|
|
34
|
-
|
35
|
+
%p{:style => 'padding-left:50px;'}
|
36
|
+
= link_to 'View more locations', '#', :id => 'more_labs_list_toggler'
|
37
|
+
|
38
|
+
// form for ajax lab searches ..the code to handle return data is in app/assets/medivo/labs/handle_ajax.coffee
|
35
39
|
= form_tag(medivo.data_labs_path, :method=>:get, :id=>'lab_data_search', :remote=>true) do
|
36
40
|
%div
|
37
41
|
Enter a new Zip Code
|
@@ -40,3 +44,29 @@
|
|
40
44
|
= text_field_tag :zip_code, params[:zip_code]
|
41
45
|
%p
|
42
46
|
= submit_tag "Search", :id=> :find_labs, :class=>'button'
|
47
|
+
|
48
|
+
|
49
|
+
// sample template for rendering appointment info
|
50
|
+
%script{:id=>"appointment_item_template", :type=>"text/x-handlebars-template"}
|
51
|
+
%br
|
52
|
+
%input{ :type=>'radio', :name=>"appointment_time", :value=>"{{data}}"} {{formattedDate}}
|
53
|
+
|
54
|
+
Search for appointment times
|
55
|
+
|
56
|
+
// appointment list display
|
57
|
+
#appointment_list_container
|
58
|
+
%ul#appointment_list
|
59
|
+
|
60
|
+
%p{:style => 'display:none;padding-left:50px;'}
|
61
|
+
= link_to 'View more times', '#', :id => 'more_appointment_list_toggler'
|
62
|
+
|
63
|
+
// form for ajax appointment searches ..the code to handle return data is in app/assets/medivo/lab_appointments/handlers.coffee
|
64
|
+
= form_tag(medivo.data_appointments_path, :method=>:get, :id=>'appointment_data_search', :remote=>true) do
|
65
|
+
%div
|
66
|
+
Enter a Date
|
67
|
+
.error_message
|
68
|
+
|
69
|
+
= text_field_tag :date, (Date.today+3.days).strftime("%m/%d/%Y")
|
70
|
+
= hidden_field_tag :lab_code, '' # you have to fill this in dynamically with a lab_code
|
71
|
+
%p
|
72
|
+
= submit_tag "Search", :id=> :find_appointments, :class=>'button'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# adjust these values to use your medivo campaign
|
2
|
+
# the user password are not the login user/pass .. but the api key and token
|
3
|
+
test:
|
4
|
+
href: http://test.medivo.com
|
5
|
+
user: test
|
6
|
+
password: test
|
7
|
+
|
8
|
+
development:
|
9
|
+
href: https://api16-staging.medivo.com
|
10
|
+
user: uhcc
|
11
|
+
password: uhctoken1
|
12
|
+
|
13
|
+
staging:
|
14
|
+
href: https://api16-staging.medivo.com
|
15
|
+
user: uhcc
|
16
|
+
password: uhctoken1
|
17
|
+
|
18
|
+
production:
|
19
|
+
href: https://api16.medivo.com
|
20
|
+
user: your.medivo.campaign.api_key
|
21
|
+
password: your.medivo.campaign.api_token
|
data/spec/dummy/config/routes.rb
CHANGED