Class: Finix::PaymentInstrument

Inherits:
Object
  • Object
show all
Includes:
HypermediaRegistry, Resource, Verifiable
Defined in:
lib/finix/resources/payment_instrument.rb

Direct Known Subclasses

BankAccount, PaymentCard

Instance Attribute Summary

Attributes included from HalResource

#attributes, #hyperlinks

Class Method Summary collapse

Methods included from Verifiable

#verify

Methods included from HypermediaRegistry

included

Methods included from Resource

#copy_from, #fetch, #hydrate, included, #initialize, #refresh, #sanitize, #save, #to_s

Methods included from HalResource

#load_page_from_response!, #method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Finix::HalResource

Class Method Details

.hypermedia_subtype(response) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/finix/resources/payment_instrument.rb', line 10

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