Sha256: 8ca47799caaf1d6dda10b5d847535f4a38db05424f24f685a8428d2ed95a3c5b
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
module PagarMe class BalanceOperation < PagarMeObject def method_missing(name, *args, &block) if @attributes['movement_object'] && @attributes['movement_object'].respond_to?(name) return movement_object.public_send(name, *args, &block) end super name, *args, &block end class << self def url(recipient_id = nil) if recipient_id "/recipients/#{recipient_id}/balance/operations" else '/balance/operations' end end def balance_operations(*args, **params) params = PagarMe::Model.extract_page_count_or_params(*args, **params) raise RequestError.new('Invalid page count') if params[:page] < 1 or params[:count] < 1 PagarMe::Request.get(url, params: params).call end def find_by_recipient_id(recipient_id, *args, **params) params = PagarMe::Model.extract_page_count_or_params(*args, **params) raise RequestError.new('Invalid page count') if params[:page] < 1 or params[:count] < 1 raise RequestError.new('Invalid ID') unless recipient_id.present? PagarMe::Request.get(url(recipient_id), params: params).call end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pagarme-2.2.0 | lib/pagarme/resources/balance_operation.rb |
pagarme-2.1.4 | lib/pagarme/resources/balance_operation.rb |