This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/usr/bin/env ruby | |
| require File.dirname(__FILE__) + "/../ad_server_dependencies.rb" | |
| class StatKeyFix | |
| # This fixes ad stats that were incorrectly keyed in redis | |
| # according to ContentCacheAdvertisement#id instead of the | |
| # expected ContentInstance#id. The issue only affected ads | |
| # with a ContentCacheAdvertisement.id greater than 100,000 | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | require 'mime/types' | |
| require 'RMagick' | |
| class Photo < ActiveRecord::Base | |
| establish_connection 'portal' | |
| set_table_name 'photos' | |
| belongs_to :kase | |
| belongs_to :doctor | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | require 'mms2r' | |
| class IncomingMailHandler < ActionMailer::Base | |
| # Receive and process emails | |
| def receive(email) | |
| mms = MMS2R::Media.new(email) | |
| photos = get_images_from_email(mms) | |
| pemail = PhotoEmail.create_from_mail_handler(email, mms) | |
| logit "Processing email from #{pemail.sender} with subject #{pemail.subject} " | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class PhotoEmail < ActiveRecord::Base | |
| belongs_to :doctor | |
| belongs_to :kase | |
| belongs_to :photo_email_status | |
| has_many :photos | |
| # Creates a new PhotoEmail from and incoming email | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | require 'lockfile' | |
| def timestamp | |
| Time.now.strftime('%x %X') | |
| end | |
| begin | |
| Lockfile.new('cron_mail_fetcher.lock', :retries => 0) do | |
| config = YAML.load_file("#{RAILS_ROOT}/config/mailer_daemon.yml") | |
| config = config[RAILS_ENV].to_options | 
NewerOlder