Class: ThePlaidApi::TransferRecurringSchedule

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/transfer_recurring_schedule.rb

Overview

The schedule that the recurring transfer will be executed on.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(interval_unit:, interval_count:, interval_execution_day:, start_date:, end_date: SKIP, additional_properties: nil) ⇒ TransferRecurringSchedule

Returns a new instance of TransferRecurringSchedule.



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 85

def initialize(interval_unit:, interval_count:, interval_execution_day:,
               start_date:, end_date: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @interval_unit = interval_unit
  @interval_count = interval_count
  @interval_execution_day = interval_execution_day
  @start_date = start_date
  @end_date = end_date unless end_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#end_dateDate

A date in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD). The recurring transfer will end on the last ‘interval_execution_day` on or before the `end_date`. If the `interval_execution_day` between the start date and the end date (inclusive) is also the same day that `/transfer/recurring/create` was called, the bank may make a payment on that day, but it is not guaranteed to do so.

Returns:

  • (Date)


58
59
60
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 58

def end_date
  @end_date
end

#interval_countInteger

The number of recurring ‘interval_units` between originations. The recurring interval (before holiday adjustment) is calculated by multiplying `interval_unit` and `interval_count`. For example, to schedule a recurring transfer which originates once every two weeks, set `interval_unit` = `week` and `interval_count` = 2.

Returns:

  • (Integer)


22
23
24
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 22

def interval_count
  @interval_count
end

#interval_execution_dayInteger

The day of the interval on which to schedule the transfer. If the ‘interval_unit` is `week`, `interval_execution_day` should be an integer from 1 (Monday) to 5 (Friday). If the `interval_unit` is `month`, `interval_execution_day` should be an integer indicating which day of the month to make the transfer on. Integers from 1 to 28 can be used to make a transfer on that day of the month. Negative integers from -1 to -5 can be used to make a transfer relative to the end of the month. To make a transfer on the last day of the month, use -1; to make the transfer on the second-to-last day, use -2, and so on. The transfer will be originated on the next available banking day if the designated day is a non banking day.

Returns:

  • (Integer)


37
38
39
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 37

def interval_execution_day
  @interval_execution_day
end

#interval_unitTransferScheduleIntervalUnit

The unit of the recurring interval.



14
15
16
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 14

def interval_unit
  @interval_unit
end

#start_dateDate

A date in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD). The recurring transfer will begin on the first ‘interval_execution_day` on or after the `start_date`. For `rtp` recurring transfers, `start_date` must be in the future. Otherwise, if the first `interval_execution_day` on or after the start date is also the same day that `/transfer/recurring/create` was called, the bank may make the first payment on that day, but it is not guaranteed to do so.

Returns:

  • (Date)


48
49
50
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 48

def start_date
  @start_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  interval_unit = hash.key?('interval_unit') ? hash['interval_unit'] : nil
  interval_count =
    hash.key?('interval_count') ? hash['interval_count'] : nil
  interval_execution_day =
    hash.key?('interval_execution_day') ? hash['interval_execution_day'] : nil
  start_date = hash.key?('start_date') ? hash['start_date'] : nil
  end_date = hash.key?('end_date') ? hash['end_date'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  TransferRecurringSchedule.new(interval_unit: interval_unit,
                                interval_count: interval_count,
                                interval_execution_day: interval_execution_day,
                                start_date: start_date,
                                end_date: end_date,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



61
62
63
64
65
66
67
68
69
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 61

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['interval_unit'] = 'interval_unit'
  @_hash['interval_count'] = 'interval_count'
  @_hash['interval_execution_day'] = 'interval_execution_day'
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash
end

.nullablesObject

An array for nullable fields



79
80
81
82
83
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 79

def self.nullables
  %w[
    end_date
  ]
end

.optionalsObject

An array for optional fields



72
73
74
75
76
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 72

def self.optionals
  %w[
    end_date
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



136
137
138
139
140
141
142
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 136

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} interval_unit: #{@interval_unit.inspect}, interval_count:"\
  " #{@interval_count.inspect}, interval_execution_day: #{@interval_execution_day.inspect},"\
  " start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



128
129
130
131
132
133
# File 'lib/the_plaid_api/models/transfer_recurring_schedule.rb', line 128

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} interval_unit: #{@interval_unit}, interval_count: #{@interval_count},"\
  " interval_execution_day: #{@interval_execution_day}, start_date: #{@start_date}, end_date:"\
  " #{@end_date}, additional_properties: #{@additional_properties}>"
end