Class: ThePlaidApi::BetaEwaReportV1GetResponse

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

Overview

BetaEwaReportV1GetResponse defines the response schema for ‘/beta/ewa_report/v1/get`

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(request_id: SKIP, ewa_report_id: SKIP, generation_time: SKIP, ewa_scores: SKIP, ewa_attributes: SKIP, additional_properties: nil) ⇒ BetaEwaReportV1GetResponse

Returns a new instance of BetaEwaReportV1GetResponse.



71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 71

def initialize(request_id: SKIP, ewa_report_id: SKIP, generation_time: SKIP,
               ewa_scores: SKIP, ewa_attributes: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @request_id = request_id unless request_id == SKIP
  @ewa_report_id = ewa_report_id unless ewa_report_id == SKIP
  @generation_time = generation_time unless generation_time == SKIP
  @ewa_scores = ewa_scores unless ewa_scores == SKIP
  @ewa_attributes = ewa_attributes unless ewa_attributes == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#ewa_attributesHash[String, Float]

A set of attributes providing context about the factors that contributed to the EWA scores. Each key is the attribute name and the value is its numeric score, or null if the attribute could not be computed.

Returns:

  • (Hash[String, Float])


40
41
42
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 40

def ewa_attributes
  @ewa_attributes
end

#ewa_report_idString

Unique identifier for the generated EWA score group.

Returns:

  • (String)


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

def ewa_report_id
  @ewa_report_id
end

#ewa_scoresArray[EwaScore]

A list of earned wage access (EWA) scoring entries that map potential advance amounts to repayment likelihood scores. The predefined advance amount ranges are ‘[0, 25]`, `[25, 50]`, `[50, 100]`, `[100, 200]`, `[200, 300]`, `[300, 400]`, and `[400, 500]`.

Returns:



34
35
36
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 34

def ewa_scores
  @ewa_scores
end

#generation_timeDateTime

The date and time when ‘ewa_scores` was generated, in ISO 8601 format (e.g. “2018-04-12T03:32:11Z”).

Returns:

  • (DateTime)


27
28
29
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 27

def generation_time
  @generation_time
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)


18
19
20
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 18

def request_id
  @request_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
123
124
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 86

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  request_id = hash.key?('request_id') ? hash['request_id'] : SKIP
  ewa_report_id = hash.key?('ewa_report_id') ? hash['ewa_report_id'] : SKIP
  generation_time = if hash.key?('generation_time')
                      (DateTimeHelper.from_rfc3339(hash['generation_time']) if hash['generation_time'])
                    else
                      SKIP
                    end
  # Parameter is an array, so we need to iterate through it
  ewa_scores = nil
  unless hash['ewa_scores'].nil?
    ewa_scores = []
    hash['ewa_scores'].each do |structure|
      ewa_scores << (EwaScore.from_hash(structure) if structure)
    end
  end

  ewa_scores = SKIP unless hash.key?('ewa_scores')
  ewa_attributes =
    hash.key?('ewa_attributes') ? hash['ewa_attributes'] : 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.
  BetaEwaReportV1GetResponse.new(request_id: request_id,
                                 ewa_report_id: ewa_report_id,
                                 generation_time: generation_time,
                                 ewa_scores: ewa_scores,
                                 ewa_attributes: ewa_attributes,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



43
44
45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 43

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['request_id'] = 'request_id'
  @_hash['ewa_report_id'] = 'ewa_report_id'
  @_hash['generation_time'] = 'generation_time'
  @_hash['ewa_scores'] = 'ewa_scores'
  @_hash['ewa_attributes'] = 'ewa_attributes'
  @_hash
end

.nullablesObject

An array for nullable fields



65
66
67
68
69
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 65

def self.nullables
  %w[
    ewa_attributes
  ]
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 54

def self.optionals
  %w[
    request_id
    ewa_report_id
    generation_time
    ewa_scores
    ewa_attributes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



139
140
141
142
143
144
145
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 139

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id.inspect}, ewa_report_id:"\
  " #{@ewa_report_id.inspect}, generation_time: #{@generation_time.inspect}, ewa_scores:"\
  " #{@ewa_scores.inspect}, ewa_attributes: #{@ewa_attributes.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_generation_timeObject



126
127
128
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 126

def to_custom_generation_time
  DateTimeHelper.to_rfc3339(generation_time)
end

#to_sObject

Provides a human-readable string representation of the object.



131
132
133
134
135
136
# File 'lib/the_plaid_api/models/beta_ewa_report_v1_get_response.rb', line 131

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} request_id: #{@request_id}, ewa_report_id: #{@ewa_report_id},"\
  " generation_time: #{@generation_time}, ewa_scores: #{@ewa_scores}, ewa_attributes:"\
  " #{@ewa_attributes}, additional_properties: #{@additional_properties}>"
end