Class: ThePlaidApi::SignalScheduleResponse

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

Overview

SignalScheduleResponse defines the response schema for ‘/signal/schedule`

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(optimal_date:, recommendations:, warnings:, request_id:, additional_properties: nil) ⇒ SignalScheduleResponse

Returns a new instance of SignalScheduleResponse.



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 69

def initialize(optimal_date:, recommendations:, warnings:, request_id:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @optimal_date = optimal_date
  @recommendations = recommendations
  @warnings = warnings
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#optimal_dateDate

The recommended optimal date to submit the debit entry, formatted in ISO 8601 “YYYY-MM-DD” (e.g., “2024-03-30”). The ‘optimal_date` is derived from the date with rank = 1 in the following recommendations array. NOTE: The `default_payment_method` field specified in the request will affect the recommendation, since we’re accounting for debit settlement time. The debit scheduling evaluation starts from the day the /signal/schedule request is submitted (Day 0) or the next banking day if the submission day is not a banking day, and extends through the following five banking days (Day 1 to Day 5). If no date within this period is considered likely to result in a successful debit attempt, ‘null` will be returned for the `optimal_date`.

Returns:

  • (Date)


25
26
27
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 25

def optimal_date
  @optimal_date
end

#recommendationsArray[SignalScheduleRecommendation]

This array provides a date-by-date evaluation of debit submission recommendations within the five banking day evaluation period. Each object in the array represents a retry recommendation for a specific date.

Returns:



31
32
33
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 31

def recommendations
  @recommendations
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


45
46
47
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 45

def request_id
  @request_id
end

#warningsArray[SignalWarning]

If bank information was not available to be used in the Signal Transaction Scores model, this array contains warnings describing why bank data is missing. If you want to receive an API error instead of scores in the case of missing bank data, file a support ticket or contact your Plaid account manager.

Returns:



39
40
41
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 39

def warnings
  @warnings
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  optimal_date = hash.key?('optimal_date') ? hash['optimal_date'] : nil
  # Parameter is an array, so we need to iterate through it
  recommendations = nil
  unless hash['recommendations'].nil?
    recommendations = []
    hash['recommendations'].each do |structure|
      recommendations << (SignalScheduleRecommendation.from_hash(structure) if structure)
    end
  end

  recommendations = nil unless hash.key?('recommendations')
  # Parameter is an array, so we need to iterate through it
  warnings = nil
  unless hash['warnings'].nil?
    warnings = []
    hash['warnings'].each do |structure|
      warnings << (SignalWarning.from_hash(structure) if structure)
    end
  end

  warnings = nil unless hash.key?('warnings')
  request_id = hash.key?('request_id') ? hash['request_id'] : nil

  # 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.
  SignalScheduleResponse.new(optimal_date: optimal_date,
                             recommendations: recommendations,
                             warnings: warnings,
                             request_id: request_id,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



48
49
50
51
52
53
54
55
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 48

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['optimal_date'] = 'optimal_date'
  @_hash['recommendations'] = 'recommendations'
  @_hash['warnings'] = 'warnings'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
66
67
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 63

def self.nullables
  %w[
    optimal_date
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



133
134
135
136
137
138
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 133

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} optimal_date: #{@optimal_date.inspect}, recommendations:"\
  " #{@recommendations.inspect}, warnings: #{@warnings.inspect}, request_id:"\
  " #{@request_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



125
126
127
128
129
130
# File 'lib/the_plaid_api/models/signal_schedule_response.rb', line 125

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} optimal_date: #{@optimal_date}, recommendations: #{@recommendations},"\
  " warnings: #{@warnings}, request_id: #{@request_id}, additional_properties:"\
  " #{@additional_properties}>"
end