Class: PagarMe::Balance

Inherits:
PagarMeObject show all
Defined in:
lib/pagarme/resources/balance.rb

Constant Summary

Constants inherited from PagarMeObject

PagarMeObject::RESOURCES

Instance Attribute Summary

Attributes inherited from PagarMeObject

#attributes

Class Method Summary collapse

Methods inherited from PagarMeObject

#==, #[]=, convert, #empty?, #initialize, #respond_to?, #to_hash, #to_s, #unsaved_attributes

Constructor Details

This class inherits a constructor from PagarMe::PagarMeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class PagarMe::PagarMeObject

Class Method Details

.balanceObject



13
14
15
# File 'lib/pagarme/resources/balance.rb', line 13

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

.find_by_recipient_id(recipient_id = nil) ⇒ Object

Raises:



17
18
19
20
# File 'lib/pagarme/resources/balance.rb', line 17

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

.url(recipient_id = nil) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/pagarme/resources/balance.rb', line 5

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