Class: ThePlaidApi::IssueResolvedWebhook

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

Overview

Webhook notifications are sent only when a subscribed issue is marked as resolved. The payload contains details about the issue at the time of its resolution, focusing on the most essential information.

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(webhook_type:, webhook_code:, issue_id:, issue_description:, issue_resolved_at:, institution_id:, institution_name:, additional_properties: nil) ⇒ IssueResolvedWebhook

Returns a new instance of IssueResolvedWebhook.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 66

def initialize(webhook_type:, webhook_code:, issue_id:, issue_description:,
               issue_resolved_at:, institution_id:, institution_name:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @webhook_type = webhook_type
  @webhook_code = webhook_code
  @issue_id = issue_id
  @issue_description = issue_description
  @issue_resolved_at = issue_resolved_at
  @institution_id = institution_id
  @institution_name = institution_name
  @additional_properties = additional_properties
end

Instance Attribute Details

#institution_idString

The unique identifier of the financial institution involved.

Returns:

  • (String)


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

def institution_id
  @institution_id
end

#institution_nameString

The name of the financial institution involved.

Returns:

  • (String)


41
42
43
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 41

def institution_name
  @institution_name
end

#issue_descriptionString

A simple description of the error for the end user.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 29

def issue_description
  @issue_description
end

#issue_idString

The unique identifier of the connectivity issue.

Returns:

  • (String)


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

def issue_id
  @issue_id
end

#issue_resolved_atDateTime

The time when the issue was marked as resolved.

Returns:

  • (DateTime)


33
34
35
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 33

def issue_resolved_at
  @issue_resolved_at
end

#webhook_codeString

‘ISSUE_RESOLVED`

Returns:

  • (String)


21
22
23
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 21

def webhook_code
  @webhook_code
end

#webhook_typeString

‘ISSUES`

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 17

def webhook_type
  @webhook_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  webhook_type = hash.key?('webhook_type') ? hash['webhook_type'] : nil
  webhook_code = hash.key?('webhook_code') ? hash['webhook_code'] : nil
  issue_id = hash.key?('issue_id') ? hash['issue_id'] : nil
  issue_description =
    hash.key?('issue_description') ? hash['issue_description'] : nil
  issue_resolved_at = if hash.key?('issue_resolved_at')
                        (DateTimeHelper.from_rfc3339(hash['issue_resolved_at']) if hash['issue_resolved_at'])
                      end
  institution_id =
    hash.key?('institution_id') ? hash['institution_id'] : nil
  institution_name =
    hash.key?('institution_name') ? hash['institution_name'] : 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.
  IssueResolvedWebhook.new(webhook_type: webhook_type,
                           webhook_code: webhook_code,
                           issue_id: issue_id,
                           issue_description: issue_description,
                           issue_resolved_at: issue_resolved_at,
                           institution_id: institution_id,
                           institution_name: institution_name,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['webhook_type'] = 'webhook_type'
  @_hash['webhook_code'] = 'webhook_code'
  @_hash['issue_id'] = 'issue_id'
  @_hash['issue_description'] = 'issue_description'
  @_hash['issue_resolved_at'] = 'issue_resolved_at'
  @_hash['institution_id'] = 'institution_id'
  @_hash['institution_name'] = 'institution_name'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 62

def self.nullables
  []
end

.optionalsObject

An array for optional fields



57
58
59
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 57

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type.inspect}, webhook_code:"\
  " #{@webhook_code.inspect}, issue_id: #{@issue_id.inspect}, issue_description:"\
  " #{@issue_description.inspect}, issue_resolved_at: #{@issue_resolved_at.inspect},"\
  " institution_id: #{@institution_id.inspect}, institution_name:"\
  " #{@institution_name.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_issue_resolved_atObject



118
119
120
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 118

def to_custom_issue_resolved_at
  DateTimeHelper.to_rfc3339(issue_resolved_at)
end

#to_sObject

Provides a human-readable string representation of the object.



123
124
125
126
127
128
129
# File 'lib/the_plaid_api/models/issue_resolved_webhook.rb', line 123

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type}, webhook_code: #{@webhook_code}, issue_id:"\
  " #{@issue_id}, issue_description: #{@issue_description}, issue_resolved_at:"\
  " #{@issue_resolved_at}, institution_id: #{@institution_id}, institution_name:"\
  " #{@institution_name}, additional_properties: #{@additional_properties}>"
end