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



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gocardless_pro/resources/mandate.rb', line 24

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

  @authorisation_source = object['authorisation_source']
  @consent_parameters = object['consent_parameters']
  @consent_type = object['consent_type']
  @created_at = object['created_at']
  @funds_settlement = object['funds_settlement']
  @id = object['id']
  @links = object['links']
  @metadata = object['metadata']
  @next_possible_charge_date = object['next_possible_charge_date']
  @next_possible_standard_ach_charge_date = object['next_possible_standard_ach_charge_date']
  @payments_require_approval = object['payments_require_approval']
  @reference = object['reference']
  @scheme = object['scheme']
  @status = object['status']
  @verified_at = object['verified_at']
  @response = response
end

Instance Attribute Details

#authorisation_sourceObject (readonly)

Returns the value of attribute authorisation_source.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def authorisation_source
  @authorisation_source
end

Returns the value of attribute consent_parameters.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def consent_parameters
  @consent_parameters
end

Returns the value of attribute consent_type.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def consent_type
  @consent_type
end

#created_atObject (readonly)

Returns the value of attribute created_at.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def created_at
  @created_at
end

#funds_settlementObject (readonly)

Returns the value of attribute funds_settlement.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def funds_settlement
  @funds_settlement
end

#idObject (readonly)

Returns the value of attribute id.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def 
  @metadata
end

#next_possible_charge_dateObject (readonly)

Returns the value of attribute next_possible_charge_date.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def next_possible_charge_date
  @next_possible_charge_date
end

#next_possible_standard_ach_charge_dateObject (readonly)

Returns the value of attribute next_possible_standard_ach_charge_date.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def next_possible_standard_ach_charge_date
  @next_possible_standard_ach_charge_date
end

#payments_require_approvalObject (readonly)

Returns the value of attribute payments_require_approval.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def payments_require_approval
  @payments_require_approval
end

#referenceObject (readonly)

Returns the value of attribute reference.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def reference
  @reference
end

#schemeObject (readonly)

Returns the value of attribute scheme.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def scheme
  @scheme
end

#statusObject (readonly)

Returns the value of attribute status.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def status
  @status
end

#verified_atObject (readonly)

Returns the value of attribute verified_at.



19
20
21
# File 'lib/gocardless_pro/resources/mandate.rb', line 19

def verified_at
  @verified_at
end

Instance Method Details

#api_responseObject



45
46
47
# File 'lib/gocardless_pro/resources/mandate.rb', line 45

def api_response
  ApiResponse.new(@response)
end

Return the links that the resource has



50
51
52
# File 'lib/gocardless_pro/resources/mandate.rb', line 50

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

#to_hObject

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



55
56
57
# File 'lib/gocardless_pro/resources/mandate.rb', line 55

def to_h
  @object
end