Sha256: a800c4e56e6b7f69fd5526ca6bf0e56ebcd63590ee79e9db3708ca04a58c9682

Contents?: true

Size: 601 Bytes

Versions: 10

Compression:

Stored size: 601 Bytes

Contents

module Bankserv
  
  class Request < ActiveRecord::Base
    serialize :data
    
    self.inheritance_column = :_type_disabled
    
    after_create :delegate!
    
    def self.process!
      self.where(:processed => false).each{|request| request.process!}
    end
    
    def delegate!
      case type
      when 'ahv'
        AccountHolderVerification.build! data.merge(bankserv_request_id: self.id)
      when 'debit'
        Debit.build! data.merge(bankserv_request_id: self.id)
      when 'credit'
        Credit.build! data.merge(bankserv_request_id: self.id)
      end
    end
  
  end
  
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
bankserv-0.2.3 lib/bankserv/request.rb
bankserv-0.2.2 lib/bankserv/request.rb
bankserv-0.2.1 lib/bankserv/request.rb
bankserv-0.1.9 lib/bankserv/request.rb
bankserv-0.1.8 lib/bankserv/request.rb
bankserv-0.1.7 lib/bankserv/request.rb
bankserv-0.1.6 lib/bankserv/request.rb
bankserv-0.1.5 lib/bankserv/request.rb
bankserv-0.1.4 lib/bankserv/request.rb
bankserv-0.1.3 lib/bankserv/request.rb