Sha256: 0288d280d1a6c67df7c31198f0db361d320647ecd70d48b75b903a3a2aef23d6

Contents?: true

Size: 675 Bytes

Versions: 2

Compression:

Stored size: 675 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']
          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

2 entries across 2 versions & 1 rubygems

Version Path
finix-1.0.1 lib/finix/resources/payment_instrument.rb
finix-1.0.0 lib/finix/resources/payment_instrument.rb