Class: PagSeguro::PaymentReleases

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Enumerable, Extensions::EnsureType
Defined in:
lib/pagseguro/payment_releases.rb

Instance Method Summary collapse

Methods included from Extensions::EnsureType

#ensure_type

Constructor Details

#initializePaymentReleases

Returns a new instance of PaymentReleases.



9
10
11
# File 'lib/pagseguro/payment_releases.rb', line 9

def initialize
  @payments = []
end

Instance Method Details

#<<(payment) ⇒ Object

Adds payment to payment list.



14
15
16
17
18
# File 'lib/pagseguro/payment_releases.rb', line 14

def <<(payment)
  payment = ensure_type(PaymentRelease, payment)

  @payments << payment unless @payments.include? payment
end

#include?(payment) ⇒ Boolean

Verify if a payment is already included to payment list. Returns Boolean.

Returns:

  • (Boolean)


22
23
24
25
26
# File 'lib/pagseguro/payment_releases.rb', line 22

def include?(payment)
  self.find do |included_payment|
    included_payment.installment == ensure_type(PaymentRelease, payment).installment
  end
end