Class: ThePlaidApi::AssetsProductReadyWebhook

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

Overview

Fired when the Asset Report has been generated and ‘/asset_report/get` is ready to be called. If you attempt to retrieve an Asset Report before this webhook has fired, you’ll receive a response with the HTTP status code 400 and a Plaid error code of `PRODUCT_NOT_READY`.

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:, asset_report_id:, environment:, user_id: SKIP, report_type: SKIP, additional_properties: nil) ⇒ AssetsProductReadyWebhook

Returns a new instance of AssetsProductReadyWebhook.



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

def initialize(webhook_type:, webhook_code:, asset_report_id:, environment:,
               user_id: SKIP, report_type: 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
  @asset_report_id = asset_report_id
  @user_id = user_id unless user_id == SKIP
  @report_type = report_type unless report_type == SKIP
  @environment = environment
  @additional_properties = additional_properties
end

Instance Attribute Details

#asset_report_idString

The ‘asset_report_id` corresponding to the Asset Report the webhook has fired for.

Returns:

  • (String)


26
27
28
# File 'lib/the_plaid_api/models/assets_product_ready_webhook.rb', line 26

def asset_report_id
  @asset_report_id
end

#environmentWebhookEnvironmentValues

The Plaid environment the webhook was sent from



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

def environment
  @environment
end

#report_typeAssetReportType

Indicates either a Fast Asset Report, which will contain only current identity and balance information, or a Full Asset Report, which will also contain historical balance information and transaction data.

Returns:



36
37
38
# File 'lib/the_plaid_api/models/assets_product_ready_webhook.rb', line 36

def report_type
  @report_type
end

#user_idString

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

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/assets_product_ready_webhook.rb', line 30

def user_id
  @user_id
end

#webhook_codeString

‘PRODUCT_READY`

Returns:

  • (String)


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

def webhook_code
  @webhook_code
end

#webhook_typeString

‘ASSETS`

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/assets_product_ready_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.



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

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
  asset_report_id =
    hash.key?('asset_report_id') ? hash['asset_report_id'] : nil
  environment = hash.key?('environment') ? hash['environment'] : nil
  user_id = hash.key?('user_id') ? hash['user_id'] : SKIP
  report_type = hash.key?('report_type') ? hash['report_type'] : 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.
  AssetsProductReadyWebhook.new(webhook_type: webhook_type,
                                webhook_code: webhook_code,
                                asset_report_id: asset_report_id,
                                environment: environment,
                                user_id: user_id,
                                report_type: report_type,
                                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
52
# File 'lib/the_plaid_api/models/assets_product_ready_webhook.rb', line 43

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

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/the_plaid_api/models/assets_product_ready_webhook.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



55
56
57
58
59
60
# File 'lib/the_plaid_api/models/assets_product_ready_webhook.rb', line 55

def self.optionals
  %w[
    user_id
    report_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



120
121
122
123
124
125
126
# File 'lib/the_plaid_api/models/assets_product_ready_webhook.rb', line 120

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

#to_sObject

Provides a human-readable string representation of the object.



112
113
114
115
116
117
# File 'lib/the_plaid_api/models/assets_product_ready_webhook.rb', line 112

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