Sha256: 56aac4e647ce50ebc5f8cd5c0dce04226db7e232d53102c238adbde335256298

Contents?: true

Size: 503 Bytes

Versions: 11

Compression:

Stored size: 503 Bytes

Contents

module PagarMe
  class Balance < PagarMeObject

    class << self
      def url(recipient_id = nil)
        if recipient_id
          "/recipients/#{recipient_id}/balance"
        else
          '/balance'
        end
      end

      def balance
        PagarMe::Request.get(url).call
      end

      def find_by_recipient_id(recipient_id = nil)
        raise RequestError.new('Invalid ID') unless recipient_id.present?
        PagarMe::Request.get(url recipient_id).call
      end
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pagarme-2.4.0 lib/pagarme/resources/balance.rb
pagarme-2.3.0 lib/pagarme/resources/balance.rb
pagarme-2.2.3 lib/pagarme/resources/balance.rb
pagarme-2.2.2 lib/pagarme/resources/balance.rb
pagarme-2.2.1 lib/pagarme/resources/balance.rb
pagarme-2.2.0 lib/pagarme/resources/balance.rb
pagarme-2.1.4 lib/pagarme/resources/balance.rb
pagarme-2.1.3 lib/pagarme/resources/balance.rb
pagarme-2.1.2 lib/pagarme/resources/balance.rb
pagarme-2.1.1 lib/pagarme/resources/balance.rb
pagarme-2.1.0 lib/pagarme/resources/balance.rb