Class: Starling::DirectDebitMandatesResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/starling/models/direct_debit_mandates.rb

Instance Method Summary collapse

Instance Method Details

#cancel(uid:) ⇒ Object

Required scope: mandate:delete



22
23
24
# File 'lib/starling/models/direct_debit_mandates.rb', line 22

def cancel(uid:)
  delete_request("direct-debit/mandates/#{uid}")
end

#listObject

Required scope: mandate:read



5
6
7
8
# File 'lib/starling/models/direct_debit_mandates.rb', line 5

def list
  response = get_request("direct-debit/mandates")
  Collection.from_response(response, type: DirectDebitMandate, key: "mandates")
end

#payments(uid:, since:) ⇒ Object

Required scope: mandate:read



16
17
18
19
# File 'lib/starling/models/direct_debit_mandates.rb', line 16

def payments(uid:, since:)
  response = get_request("direct-debit/mandates/#{uid}/payments", params: {since: since})
  Collection.from_response(response, type: DirectDebitPayment, key: "directDebitPayments")
end

#retrieve(uid:) ⇒ Object

Required scope: mandate:read



11
12
13
# File 'lib/starling/models/direct_debit_mandates.rb', line 11

def retrieve(uid:)
  DirectDebitMandate.new get_request("direct-debit/mandates/#{uid}").body
end