Sha256: bd0d8c8f154c5746a0e9960fcc796f02a49901b52f9dd972bf602a416bedf50e
Contents?: true
Size: 1.24 KB
Versions: 5
Compression:
Stored size: 1.24 KB
Contents
module PagarMe class BalanceOperation < PagarMeObject def method_missing(name, *args, &block) super name, *args, &block rescue NameError if @attributes['movement_object'] && @attributes['movement_object'].respond_to?(name) return @attributes['movement_object'].public_send(name, *args, &block) end raise $! 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
5 entries across 5 versions & 1 rubygems