team-umlaut/umlaut

View on GitHub
app/service_adaptors/txt_holding_export.rb

Summary

Maintainability
A
0 mins
Test Coverage
# Since this relies on finding holdings that exist, you need to run it in
# a service wave AFTER anything that might generate holdings. 
class TxtHoldingExport < AjaxExport

  def initialize(config)
    @display_text = 'Send to phone'
    @display_text_i18n = "display_text"
    @form_controller = "export_email"
    @form_action = "txt"
    # providers is a hash of:
    # user-presentable-string => hostname for email to txt service. 
    @providers = {
     "AT&T" => "txt.att.net",
     "Nextel" => "messaging.nextel.com",     
     "Sprint" => "messaging.sprintpcs.com",
     "T-Mobile"=> "tmomail.net",
     "Verizon"=> "vtext.com",
     "Virgin"=> "vmobl.com"
    }
    super(config)
  end

  def handle(request)
    
    holdings = request.get_service_type('holding', { :refresh => true })
    unless holdings.nil? or holdings.empty?
      super(request)
    else
      return request.dispatched(self, true)
    end
  end
  
end