Class: ThePlaidApi::ProcessorTransactionsSyncResponse

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

Overview

ProcessorTransactionsSyncResponse defines the response schema for ‘/processor/transactions/sync`

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(transactions_update_status:, account:, added:, modified:, removed:, next_cursor:, has_more:, request_id:, additional_properties: nil) ⇒ ProcessorTransactionsSyncResponse

Returns a new instance of ProcessorTransactionsSyncResponse.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 94

def initialize(transactions_update_status:, account:, added:, modified:,
               removed:, next_cursor:, has_more:, request_id:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @transactions_update_status = transactions_update_status
  @account = 
  @added = added
  @modified = modified
  @removed = removed
  @next_cursor = next_cursor
  @has_more = has_more
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#accountAccountNullable

A single account at a financial institution.

Returns:



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

def 
  @account
end

#addedArray[Transaction]

Transactions that have been added to the Item since ‘cursor` ordered by ascending last modified time.

Returns:



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

def added
  @added
end

#has_moreTrueClass | FalseClass

Represents if more than requested count of transaction updates exist. If true, the additional updates can be fetched by making an additional request with ‘cursor` set to `next_cursor`. If `has_more` is true, it’s important to pull all available pages, to make it less likely for underlying data changes to conflict with pagination.

Returns:

  • (TrueClass | FalseClass)


60
61
62
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 60

def has_more
  @has_more
end

#modifiedArray[Transaction]

Transactions that have been modified on the Item since ‘cursor` ordered by ascending last modified time.

Returns:



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

def modified
  @modified
end

#next_cursorString

Cursor used for fetching any future updates after the latest update provided in this response. The cursor obtained after all pages have been pulled (indicated by ‘has_more` being `false`) will be valid for at least 1 year. This cursor should be persisted for later calls. If transactions are not yet available, this will be an empty string.

Returns:

  • (String)


52
53
54
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 52

def next_cursor
  @next_cursor
end

#removedArray[RemovedTransaction]

Transactions that have been removed from the Item since ‘cursor` ordered by ascending last modified time.

Returns:



44
45
46
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 44

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


66
67
68
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 66

def request_id
  @request_id
end

#transactions_update_statusTransactionsUpdateStatus

A description of the update status for transaction pulls of an Item. This field contains the same information provided by transactions webhooks, and may be helpful for webhook troubleshooting or when recovering from missed webhooks. ‘TRANSACTIONS_UPDATE_STATUS_UNKNOWN`: Unable to fetch transactions update status for Item. `NOT_READY`: The Item is pending transaction pull. `INITIAL_UPDATE_COMPLETE`: Initial pull for the Item is complete, historical pull is pending. `HISTORICAL_UPDATE_COMPLETE`: Both initial and historical pull for Item are complete.



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

def transactions_update_status
  @transactions_update_status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 112

def self.from_hash(hash)
  return nil unless hash

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

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

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

  removed = nil unless hash.key?('removed')
  next_cursor = hash.key?('next_cursor') ? hash['next_cursor'] : nil
  has_more = hash.key?('has_more') ? hash['has_more'] : nil
  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.
  ProcessorTransactionsSyncResponse.new(transactions_update_status: transactions_update_status,
                                        account: ,
                                        added: added,
                                        modified: modified,
                                        removed: removed,
                                        next_cursor: next_cursor,
                                        has_more: has_more,
                                        request_id: request_id,
                                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['transactions_update_status'] = 'transactions_update_status'
  @_hash['account'] = 'account'
  @_hash['added'] = 'added'
  @_hash['modified'] = 'modified'
  @_hash['removed'] = 'removed'
  @_hash['next_cursor'] = 'next_cursor'
  @_hash['has_more'] = 'has_more'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



88
89
90
91
92
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 88

def self.nullables
  %w[
    account
  ]
end

.optionalsObject

An array for optional fields



83
84
85
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 83

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



182
183
184
185
186
187
188
189
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 182

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} transactions_update_status: #{@transactions_update_status.inspect},"\
  " account: #{@account.inspect}, added: #{@added.inspect}, modified: #{@modified.inspect},"\
  " removed: #{@removed.inspect}, next_cursor: #{@next_cursor.inspect}, has_more:"\
  " #{@has_more.inspect}, request_id: #{@request_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



173
174
175
176
177
178
179
# File 'lib/the_plaid_api/models/processor_transactions_sync_response.rb', line 173

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} transactions_update_status: #{@transactions_update_status}, account:"\
  " #{@account}, added: #{@added}, modified: #{@modified}, removed: #{@removed}, next_cursor:"\
  " #{@next_cursor}, has_more: #{@has_more}, request_id: #{@request_id},"\
  " additional_properties: #{@additional_properties}>"
end