Class: GoCardlessPro::Resources::InstalmentSchedule

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

Overview

Instalment schedules are objects which represent a collection of related payments, with the intention to collect the total_amount specified. The API supports both schedule-based creation (similar to subscriptions) as well as explicit selection of differing payment amounts and charge dates.

Unlike subscriptions, the payments are created immediately, so the instalment schedule cannot be modified once submitted and instead can only be cancelled (which will cancel any of the payments which have not yet been submitted).

Customers will receive a single notification about the complete schedule of collection.

Defined Under Namespace

Classes: Links

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, response = nil) ⇒ InstalmentSchedule

Initialize a instalment_schedule resource instance

Parameters:

  • object (Hash)

    an object returned from the API



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 41

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

  @created_at = object['created_at']
  @currency = object['currency']
  @id = object['id']
  @links = object['links']
  @metadata = object['metadata']
  @name = object['name']
  @payment_errors = object['payment_errors']
  @status = object['status']
  @total_amount = object['total_amount']
  @response = response
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



30
31
32
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 30

def created_at
  @created_at
end

#currencyObject (readonly)

Returns the value of attribute currency.



31
32
33
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 31

def currency
  @currency
end

#idObject (readonly)

Returns the value of attribute id.



32
33
34
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 32

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



33
34
35
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 33

def 
  @metadata
end

#nameObject (readonly)

Returns the value of attribute name.



34
35
36
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 34

def name
  @name
end

#payment_errorsObject (readonly)

Returns the value of attribute payment_errors.



35
36
37
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 35

def payment_errors
  @payment_errors
end

#statusObject (readonly)

Returns the value of attribute status.



36
37
38
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 36

def status
  @status
end

#total_amountObject (readonly)

Returns the value of attribute total_amount.



37
38
39
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 37

def total_amount
  @total_amount
end

Instance Method Details

#api_responseObject



56
57
58
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 56

def api_response
  ApiResponse.new(@response)
end

Return the links that the resource has



61
62
63
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 61

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

#to_hObject

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



66
67
68
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 66

def to_h
  @object
end