Sha256: bed8fb4aa178a5e5c2087d00fc9fbc2609826c7a9087bfb0113ad6351beeae94
Contents?: true
Size: 1 KB
Versions: 12
Compression:
Stored size: 1 KB
Contents
require 'restclient' module Medivo class Appointment def self.find(lab_code, date) if real_data? resource.get :params=>{:labcorp_id=>lab_code, :appointment_date=>date} else build_fake_data(date) end end private def self.resource @resource ||= begin @config = ResourceConfig.find 'appointment_resource.yml' RestClient::Resource.new @config.href, :timeout => (@config.timeout || 12) rescue => e p e end end def self.real_data? resource # to init the resource and config file true unless (Rails.env.development? and @config.real_data == false) end def self.build_fake_data(date) {:times=>[]} "{\"times\":[\"11/03/2011|08:30 AM\",\"11/04/2011|08:30 AM\", \"11/02/2011|09:00 AM\",\"11/01/2011|09:30 AM\",\"11/02/2011|09:30 AM\", \"11/03/2011|09:30 AM\",\"11/04/2011|09:30 AM\",\"10/31/2011|10:00 AM\", \"11/02/2011|04:00 PM\",\"11/03/2011|04:00 PM\",\"11/04/2011|04:00 PM\"]}" end end end
Version data entries
12 entries across 12 versions & 1 rubygems