Class: GoCardlessPro::Resources::Mandate

Inherits:
Object
  • Object
show all
Defined in:
lib/gocardless_pro/resources/mandate.rb

Overview

Mandates represent the Direct Debit mandate with a [customer](#core-endpoints-customers).

GoCardless will notify you via a [webhook](#appendix-webhooks) whenever the status of a mandate changes.

Defined Under Namespace

Classes: Links

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, response = nil) ⇒ Mandate

Initialize a mandate resource instance

Parameters:

  • object (Hash)

    an object returned from the API



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/gocardless_pro/resources/mandate.rb', line 32

def initialize(object, response = nil)
  @object = object

  @created_at = object['created_at']
  @id = object['id']
  @links = object['links']
  @metadata = object['metadata']
  @next_possible_charge_date = object['next_possible_charge_date']
  @payments_require_approval = object['payments_require_approval']
  @reference = object['reference']
  @scheme = object['scheme']
  @status = object['status']
  @response = response
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



21
22
23
# File 'lib/gocardless_pro/resources/mandate.rb', line 21

def created_at
  @created_at
end

#idObject (readonly)

Returns the value of attribute id.



22
23
24
# File 'lib/gocardless_pro/resources/mandate.rb', line 22

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



23
24
25
# File 'lib/gocardless_pro/resources/mandate.rb', line 23

def 
  @metadata
end

#next_possible_charge_dateObject (readonly)

Returns the value of attribute next_possible_charge_date.



24
25
26
# File 'lib/gocardless_pro/resources/mandate.rb', line 24

def next_possible_charge_date
  @next_possible_charge_date
end

#payments_require_approvalObject (readonly)

Returns the value of attribute payments_require_approval.



25
26
27
# File 'lib/gocardless_pro/resources/mandate.rb', line 25

def payments_require_approval
  @payments_require_approval
end

#referenceObject (readonly)

Returns the value of attribute reference.



26
27
28
# File 'lib/gocardless_pro/resources/mandate.rb', line 26

def reference
  @reference
end

#schemeObject (readonly)

Returns the value of attribute scheme.



27
28
29
# File 'lib/gocardless_pro/resources/mandate.rb', line 27

def scheme
  @scheme
end

#statusObject (readonly)

Returns the value of attribute status.



28
29
30
# File 'lib/gocardless_pro/resources/mandate.rb', line 28

def status
  @status
end

Instance Method Details

#api_responseObject



47
48
49
# File 'lib/gocardless_pro/resources/mandate.rb', line 47

def api_response
  ApiResponse.new(@response)
end

Return the links that the resource has



52
53
54
# File 'lib/gocardless_pro/resources/mandate.rb', line 52

def links
  @mandate_links ||= Links.new(@links)
end

#to_hObject

Provides the mandate resource as a hash of all its readable attributes



57
58
59
# File 'lib/gocardless_pro/resources/mandate.rb', line 57

def to_h
  @object
end