Class: ThePlaidApi::TransactionsSyncResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::TransactionsSyncResponse
- Defined in:
- lib/the_plaid_api/models/transactions_sync_response.rb
Overview
TransactionsSyncResponse defines the response schema for ‘/transactions/sync`
Instance Attribute Summary collapse
-
#accounts ⇒ Array[Account]
An array of accounts at a financial institution associated with the transactions in this response.
-
#added ⇒ Array[Transaction]
Transactions that have been added to the Item since ‘cursor` ordered by ascending last modified time.
-
#has_more ⇒ TrueClass | FalseClass
Represents if more than requested count of transaction updates exist.
-
#modified ⇒ Array[Transaction]
Transactions that have been modified on the Item since ‘cursor` ordered by ascending last modified time.
-
#next_cursor ⇒ String
Cursor used for fetching any future updates after the latest update provided in this response.
-
#removed ⇒ Array[RemovedTransaction]
Transactions that have been removed from the Item since ‘cursor` ordered by ascending last modified time.
-
#request_id ⇒ String
A unique identifier for the request, which can be used for troubleshooting.
-
#transactions_update_status ⇒ TransactionsUpdateStatus
A description of the update status for transaction pulls of an Item.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(transactions_update_status:, accounts:, added:, modified:, removed:, next_cursor:, has_more:, request_id:, additional_properties: nil) ⇒ TransactionsSyncResponse
constructor
A new instance of TransactionsSyncResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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:, accounts:, added:, modified:, removed:, next_cursor:, has_more:, request_id:, additional_properties: nil) ⇒ TransactionsSyncResponse
Returns a new instance of TransactionsSyncResponse.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 97 def initialize(transactions_update_status:, accounts:, 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 @accounts = accounts @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
#accounts ⇒ Array[Account]
An array of accounts at a financial institution associated with the transactions in this response. Only accounts that have associated transactions will be shown. For example, ‘investment`-type accounts will be omitted.
32 33 34 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 32 def accounts @accounts end |
#added ⇒ Array[Transaction]
Transactions that have been added to the Item since ‘cursor` ordered by ascending last modified time.
37 38 39 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 37 def added @added end |
#has_more ⇒ TrueClass | 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.
65 66 67 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 65 def has_more @has_more end |
#modified ⇒ Array[Transaction]
Transactions that have been modified on the Item since ‘cursor` ordered by ascending last modified time.
42 43 44 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 42 def modified @modified end |
#next_cursor ⇒ String
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. If `account_id` is included in the request, the returned cursor will reflect updates for that specific account.
57 58 59 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 57 def next_cursor @next_cursor end |
#removed ⇒ Array[RemovedTransaction]
Transactions that have been removed from the Item since ‘cursor` ordered by ascending last modified time.
47 48 49 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 47 def removed @removed end |
#request_id ⇒ String
A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.
71 72 73 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 71 def request_id @request_id end |
#transactions_update_status ⇒ TransactionsUpdateStatus
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/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.
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 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 115 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 # Parameter is an array, so we need to iterate through it accounts = nil unless hash['accounts'].nil? accounts = [] hash['accounts'].each do |structure| accounts << (Account.from_hash(structure) if structure) end end accounts = nil unless hash.key?('accounts') # 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. TransactionsSyncResponse.new(transactions_update_status: transactions_update_status, accounts: accounts, added: added, modified: modified, removed: removed, next_cursor: next_cursor, has_more: has_more, request_id: request_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 74 def self.names @_hash = {} if @_hash.nil? @_hash['transactions_update_status'] = 'transactions_update_status' @_hash['accounts'] = 'accounts' @_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 |
.nullables ⇒ Object
An array for nullable fields
93 94 95 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 93 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
88 89 90 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 88 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
194 195 196 197 198 199 200 201 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 194 def inspect class_name = self.class.name.split('::').last "<#{class_name} transactions_update_status: #{@transactions_update_status.inspect},"\ " accounts: #{@accounts.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_s ⇒ Object
Provides a human-readable string representation of the object.
185 186 187 188 189 190 191 |
# File 'lib/the_plaid_api/models/transactions_sync_response.rb', line 185 def to_s class_name = self.class.name.split('::').last "<#{class_name} transactions_update_status: #{@transactions_update_status}, accounts:"\ " #{@accounts}, added: #{@added}, modified: #{@modified}, removed: #{@removed}, next_cursor:"\ " #{@next_cursor}, has_more: #{@has_more}, request_id: #{@request_id},"\ " additional_properties: #{@additional_properties}>" end |