module Finix class Identity include Finix::Resource include Finix::HypermediaRegistry include Finix::Verifiable define_hypermedia_types [:identities] def provision_merchant_on(attrs={}) self.merchants.create(attrs) end def create_payment_instrument(attrs={}) if attrs.is_a?(Finix::Resource) attrs.identity = self.id attrs = attrs.attributes else attrs['identity'] = self.id # TODO might be error here end if attrs['type'] == 'PAYMENT_CARD' self.payment_instruments.resource_class = Finix::PaymentCard elsif attrs['type'] == 'BANK_ACCOUNT' self.payment_instruments.resource_class = Finix::BankAccount end self.payment_instruments.create(attrs) end def create_settlement(attrs={}) attrs = attrs.attributes if attrs.is_a?(Finix::Resource) self.settlements.create(attrs) end end end