Sha256: 9c6ed3b688a4b5b560a8900724531ca28e962a0833b779d972dc8b30f91f2b65

Contents?: true

Size: 903 Bytes

Versions: 7

Compression:

Stored size: 903 Bytes

Contents

module PagarMe
  class Recipient < Model
    def bulk_anticipations_limits(params = Hash.new)
      PagarMe::BulkAnticipation.bulk_anticipations_limits id, params
    end

    def bulk_anticipations(*args, **params)
      params = self.class.extract_page_count_or_params(*args, **params)
      raise RequestError.new('Invalid page count') if params[:page] < 1 or params[:count] < 1
      PagarMe::BulkAnticipation.all id, params
    end

    def bulk_anticipate(params = Hash.new)
      PagarMe::BulkAnticipation.create params.merge(parent_id: id)
    end

    def balance
      PagarMe::Balance.find_by_recipient_id id
    end

    def balance_operations(*args)
      PagarMe::BalanceOperation.find_by_recipient_id id, *args
    end

    def receive(amount)
      PagarMe::Transfer.create recipient_id: id, amount: amount
    end

    def self.default
      Company.default_recipient
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pagarme-2.4.0 lib/pagarme/resources/recipient.rb
pagarme-2.3.0 lib/pagarme/resources/recipient.rb
pagarme-2.2.3 lib/pagarme/resources/recipient.rb
pagarme-2.2.2 lib/pagarme/resources/recipient.rb
pagarme-2.2.1 lib/pagarme/resources/recipient.rb
pagarme-2.2.0 lib/pagarme/resources/recipient.rb
pagarme-2.1.4 lib/pagarme/resources/recipient.rb