Sha256: 035d2752fa528df4616fd8d1566abeb4a8536a894d2a041c3e92d8b60c0ea851

Contents?: true

Size: 900 Bytes

Versions: 11

Compression:

Stored size: 900 Bytes

Contents

module StarkitBanking
  module API
    class Factory
      
      def self.get_client(model, action = nil)
        klass = model.class.name.demodulize
        case klass
        when 'Payment'
          if action.nil?
            svc = model.transfer_type == 'IMT' ? 'IMT' : 'FT2'
            return "StarkitBanking::#{model.payment_account.bank_name}::Payment::By#{svc}".constantize.new(model.transfer_type)
          else
            return "StarkitBanking::#{model.payment_account.bank_name}::Payment::#{action}".constantize.new(action)
          end
        when 'PaymentAccount'
          return "StarkitBanking::#{model.bank_name}::Account::#{action}".constantize.new(action)
        when 'BankBeneficiary'
          return "StarkitBanking::#{model.bank_name}::Beneficiary::#{model.transfer_type}::#{action}".constantize.new(action)          
        end        
      end
  
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
starkit_banking-0.1.11 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.10 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.9 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.8 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.7 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.6 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.5 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.4 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.3 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.2 lib/starkit_banking/api/factory.rb
starkit_banking-0.1.1 lib/starkit_banking/api/factory.rb