Class: ThePlaidApi::CraCheckReportReadyWebhook

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

Overview

Fired when the Check Report are ready to be retrieved. Once this webhook has fired, the report will be available to retrieve for 24 hours.

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:, user_id:, environment:, successful_products: SKIP, failed_products: SKIP, item_ids: SKIP, additional_properties: nil) ⇒ CraCheckReportReadyWebhook

Returns a new instance of CraCheckReportReadyWebhook.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 76

def initialize(webhook_type:, webhook_code:, user_id:, environment:,
               successful_products: SKIP, failed_products: SKIP,
               item_ids: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @webhook_type = webhook_type
  @webhook_code = webhook_code
  @user_id = user_id
  @successful_products = successful_products unless successful_products == SKIP
  @failed_products = failed_products unless failed_products == SKIP
  @item_ids = item_ids unless item_ids == SKIP
  @environment = environment
  @additional_properties = additional_properties
end

Instance Attribute Details

#environmentWebhookEnvironmentValues

The Plaid environment the webhook was sent from



43
44
45
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 43

def environment
  @environment
end

#failed_productsArray[Products]

Specifies a list of products that have failed to generate for the report. Additional detail on what caused the failure can be found by calling the product /get endpoint.

Returns:



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

def failed_products
  @failed_products
end

#item_idsArray[String]

A list of ‘item_ids` included in the Check Report. Access to this field is in closed beta.

Returns:

  • (Array[String])


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

def item_ids
  @item_ids
end

#successful_productsArray[Products]

Specifies a list of products that have successfully been generated for the report.

Returns:



28
29
30
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 28

def successful_products
  @successful_products
end

#user_idString

The ‘user_id` corresponding to the user the webhook has fired for.

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 23

def user_id
  @user_id
end

#webhook_codeString

‘CHECK_REPORT_READY`

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 19

def webhook_code
  @webhook_code
end

#webhook_typeString

‘CHECK_REPORT`

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 15

def webhook_type
  @webhook_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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
  user_id = hash.key?('user_id') ? hash['user_id'] : nil
  environment = hash.key?('environment') ? hash['environment'] : nil
  successful_products =
    hash.key?('successful_products') ? hash['successful_products'] : SKIP
  failed_products =
    hash.key?('failed_products') ? hash['failed_products'] : SKIP
  item_ids = hash.key?('item_ids') ? hash['item_ids'] : 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.
  CraCheckReportReadyWebhook.new(webhook_type: webhook_type,
                                 webhook_code: webhook_code,
                                 user_id: user_id,
                                 environment: environment,
                                 successful_products: successful_products,
                                 failed_products: failed_products,
                                 item_ids: item_ids,
                                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['webhook_type'] = 'webhook_type'
  @_hash['webhook_code'] = 'webhook_code'
  @_hash['user_id'] = 'user_id'
  @_hash['successful_products'] = 'successful_products'
  @_hash['failed_products'] = 'failed_products'
  @_hash['item_ids'] = 'item_ids'
  @_hash['environment'] = 'environment'
  @_hash
end

.nullablesObject

An array for nullable fields



68
69
70
71
72
73
74
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 68

def self.nullables
  %w[
    successful_products
    failed_products
    item_ids
  ]
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 59

def self.optionals
  %w[
    successful_products
    failed_products
    item_ids
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type.inspect}, webhook_code:"\
  " #{@webhook_code.inspect}, user_id: #{@user_id.inspect}, successful_products:"\
  " #{@successful_products.inspect}, failed_products: #{@failed_products.inspect}, item_ids:"\
  " #{@item_ids.inspect}, environment: #{@environment.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



126
127
128
129
130
131
132
# File 'lib/the_plaid_api/models/cra_check_report_ready_webhook.rb', line 126

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type}, webhook_code: #{@webhook_code}, user_id:"\
  " #{@user_id}, successful_products: #{@successful_products}, failed_products:"\
  " #{@failed_products}, item_ids: #{@item_ids}, environment: #{@environment},"\
  " additional_properties: #{@additional_properties}>"
end