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



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/gocardless_pro/resources/instalment_schedule.rb', line 35

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.



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

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.



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

def id
  @id
end

#metadataObject (readonly)

Returns the value of attribute metadata.



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

def 
  @metadata
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#payment_errorsObject (readonly)

Returns the value of attribute payment_errors.



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

def payment_errors
  @payment_errors
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

#total_amountObject (readonly)

Returns the value of attribute total_amount.



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

def total_amount
  @total_amount
end

Instance Method Details

#api_responseObject



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

def api_response
  ApiResponse.new(@response)
end

Return the links that the resource has



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

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

#to_hObject

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



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

def to_h
  @object
end