Sha256: 3721fff58a52b5d8a5482c5ceb594191b6023f930fa57c2afc64c724aa68aa28

Contents?: true

Size: 823 Bytes

Versions: 4

Compression:

Stored size: 823 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(page = 1, count = 10)
      raise RequestError.new('Invalid page count') if page < 1 or count < 1
      PagarMe::BulkAnticipation.all id, page, count
    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

4 entries across 4 versions & 1 rubygems

Version Path
pagarme-2.1.3 lib/pagarme/resources/recipient.rb
pagarme-2.1.2 lib/pagarme/resources/recipient.rb
pagarme-2.1.1 lib/pagarme/resources/recipient.rb
pagarme-2.1.0 lib/pagarme/resources/recipient.rb