Created
          April 5, 2012 19:16 
        
      - 
      
- 
        Save GrooveStomp/2313353 to your computer and use it in GitHub Desktop. 
    Integration Code Organization
  
        
  
    
      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
    
  
  
    
  | module AuthenticatesExternally | |
| extend ActiveSupport::Concern | |
| included do | |
| include AASM | |
| aasm_column :state | |
| aasm_initial_state :unconfigured | |
| aasm_state :auth_new | |
| aasm_state :auth_validate | |
| aasm_state :configured | |
| aasm_event :unconfigure do | |
| transitions :to => :unconfigured, :from => [:configured, :unconfigured, :auth_new, :auth_validate] | |
| end | |
| aasm_event :configure do | |
| transitions :to => :configured, | |
| :from => [:unconfigured, :configured, :auth_new, :auth_validate] | |
| end | |
| aasm_event :auth_new do | |
| transitions :to => :auth_new, :from => [:unconfigured, :auth_validate, :auth_new] | |
| end | |
| aasm_event :auth_validate do | |
| transitions :to => :auth_validate, :from => [:auth_new, :auth_validate] | |
| end | |
| end | |
| end | |
| module HandlesFormSubmissions | |
| def self.handle_form_submission(form_submission_id, handler_id) | |
| ... | |
| end | |
| def self.log_form_submission(handler, fs) | |
| .. | |
| end | |
| ... | |
| end | |
| class MailChimp < Integration | |
| include AuthenticatesExternally | |
| include HandlesFormSubmissions | |
| ... | |
| # MailChimp specific methods here | |
| ... | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment