Sha256: 915c1d8c0c2225f6990dedeb64ae5c35db9426bc19a278bfe0a50a56bb09b937

Contents?: true

Size: 745 Bytes

Versions: 3

Compression:

Stored size: 745 Bytes

Contents

module Finix
  class PaymentInstrument
    include Finix::Resource
    include Finix::HypermediaRegistry
    include Finix::Verifiable

    define_hypermedia_types [:payment_instruments]

    class << self
      def hypermedia_subtype(response)
        unless response.nil?
          type = response['instrument_type'] || response['type']
          name = self.name.sub! 'PaymentInstrument', 'PaymentCard'
          if type == 'PAYMENT_CARD'
            name = self.name.sub! 'PaymentInstrument', 'PaymentCard'
          elsif type == 'BANK_ACCOUNT'
            name = self.name.sub! 'PaymentInstrument', 'BankAccount'
          end

          return self.instance_eval name unless name.nil?
        end
        self
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
finix-0.14 lib/finix/resources/payment_instrument.rb
finix-0.13 lib/finix/resources/payment_instrument.rb
finix-0.12 lib/finix/resources/payment_instrument.rb