Class: ThePlaidApi::TransactionStream
- Defined in:
- lib/the_plaid_api/models/transaction_stream.rb
Overview
A grouping of related transactions
Instance Attribute Summary collapse
-
#account_id ⇒ String
The ID of the account to which the stream belongs.
-
#average_amount ⇒ TransactionStreamAmount
Object with data pertaining to an amount on the transaction stream.
-
#category ⇒ Array[String]
A hierarchical array of the categories to which this transaction belongs.
-
#category_id ⇒ String
The ID of the category to which this transaction belongs.
-
#description ⇒ String
A description of the transaction stream.
-
#first_date ⇒ Date
The posted date of the earliest transaction in the stream.
-
#frequency ⇒ RecurringTransactionFrequency
Describes the frequency of the transaction stream.
-
#is_active ⇒ TrueClass | FalseClass
Indicates whether the transaction stream is still live.
-
#is_user_modified ⇒ TrueClass | FalseClass
As the ability to modify transactions streams has been discontinued, this field will always be ‘false`.
-
#last_amount ⇒ TransactionStreamAmount
Object with data pertaining to an amount on the transaction stream.
-
#last_date ⇒ Date
The posted date of the latest transaction in the stream.
-
#last_user_modified_datetime ⇒ DateTime
The date and time of the most recent user modification.
-
#merchant_name ⇒ String
The merchant associated with the transaction stream.
-
#personal_finance_category ⇒ PersonalFinanceCategory
Information describing the intent of the transaction.
-
#predicted_next_date ⇒ Date
The predicted date of the next payment.
-
#status ⇒ TransactionStreamStatus
The current status of the transaction stream.
-
#stream_id ⇒ String
A unique id for the stream.
-
#transaction_ids ⇒ Array[String]
An array of Plaid transaction IDs belonging to the stream, sorted by posted date.
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(account_id:, stream_id:, category:, category_id:, description:, merchant_name:, first_date:, last_date:, frequency:, transaction_ids:, average_amount:, last_amount:, is_active:, status:, is_user_modified:, predicted_next_date: SKIP, personal_finance_category: SKIP, last_user_modified_datetime: SKIP, additional_properties: nil) ⇒ TransactionStream
constructor
A new instance of TransactionStream.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_last_user_modified_datetime ⇒ Object
-
#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(account_id:, stream_id:, category:, category_id:, description:, merchant_name:, first_date:, last_date:, frequency:, transaction_ids:, average_amount:, last_amount:, is_active:, status:, is_user_modified:, predicted_next_date: SKIP, personal_finance_category: SKIP, last_user_modified_datetime: SKIP, additional_properties: nil) ⇒ TransactionStream
Returns a new instance of TransactionStream.
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 176 def initialize(account_id:, stream_id:, category:, category_id:, description:, merchant_name:, first_date:, last_date:, frequency:, transaction_ids:, average_amount:, last_amount:, is_active:, status:, is_user_modified:, predicted_next_date: SKIP, personal_finance_category: SKIP, last_user_modified_datetime: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account_id = account_id @stream_id = stream_id @category = category @category_id = category_id @description = description @merchant_name = merchant_name @first_date = first_date @last_date = last_date @predicted_next_date = predicted_next_date unless predicted_next_date == SKIP @frequency = frequency @transaction_ids = transaction_ids @average_amount = average_amount @last_amount = last_amount @is_active = is_active @status = status unless personal_finance_category == SKIP @personal_finance_category = personal_finance_category end @is_user_modified = is_user_modified unless last_user_modified_datetime == SKIP @last_user_modified_datetime = last_user_modified_datetime end @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
The ID of the account to which the stream belongs
15 16 17 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 15 def account_id @account_id end |
#average_amount ⇒ TransactionStreamAmount
Object with data pertaining to an amount on the transaction stream.
87 88 89 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 87 def average_amount @average_amount end |
#category ⇒ Array[String]
A hierarchical array of the categories to which this transaction belongs. See [Categories](plaid.com/docs/api/products/transactions/#categoriesg et). All implementations are encouraged to use the new ‘personal_finance_category` instead of `category`. `personal_finance_category` provides more meaningful categorization and greater accuracy.
30 31 32 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 30 def category @category end |
#category_id ⇒ String
The ID of the category to which this transaction belongs. See [Categories](plaid.com/docs/api/products/transactions/#categoriesg et). All implementations are encouraged to use the new ‘personal_finance_category` instead of `category`. `personal_finance_category` provides more meaningful categorization and greater accuracy.
40 41 42 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 40 def category_id @category_id end |
#description ⇒ String
A description of the transaction stream.
44 45 46 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 44 def description @description end |
#first_date ⇒ Date
The posted date of the earliest transaction in the stream.
52 53 54 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 52 def first_date @first_date end |
#frequency ⇒ RecurringTransactionFrequency
Describes the frequency of the transaction stream. ‘WEEKLY`: Assigned to a transaction stream that occurs approximately every week. `BIWEEKLY`: Assigned to a transaction stream that occurs approximately every 2 weeks. `SEMI_MONTHLY`: Assigned to a transaction stream that occurs approximately twice per month. This frequency is typically seen for inflow transaction streams. `MONTHLY`: Assigned to a transaction stream that occurs approximately every month. `ANNUALLY`: Assigned to a transaction stream that occurs approximately every year. `UNKNOWN`: Assigned to a transaction stream that does not fit any of the pre-defined frequencies.
78 79 80 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 78 def frequency @frequency end |
#is_active ⇒ TrueClass | FalseClass
Indicates whether the transaction stream is still live.
95 96 97 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 95 def is_active @is_active end |
#is_user_modified ⇒ TrueClass | FalseClass
As the ability to modify transactions streams has been discontinued, this field will always be ‘false`.
125 126 127 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 125 def is_user_modified @is_user_modified end |
#last_amount ⇒ TransactionStreamAmount
Object with data pertaining to an amount on the transaction stream.
91 92 93 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 91 def last_amount @last_amount end |
#last_date ⇒ Date
The posted date of the latest transaction in the stream.
56 57 58 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 56 def last_date @last_date end |
#last_user_modified_datetime ⇒ DateTime
The date and time of the most recent user modification. This will only be set if ‘is_user_modified` is `true`.
130 131 132 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 130 def last_user_modified_datetime @last_user_modified_datetime end |
#merchant_name ⇒ String
The merchant associated with the transaction stream.
48 49 50 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 48 def merchant_name @merchant_name end |
#personal_finance_category ⇒ PersonalFinanceCategory
Information describing the intent of the transaction. Most relevant for personal finance use cases, but not limited to such use cases. See the [taxonomy CSV file](plaid.com/documents/pfc-taxonomy-all.csv) for a full list of personal finance categories. If you are migrating to personal finance categories from the legacy categories, also refer to the [migration guide](plaid.com/docs/transactions/pfc-migration/).
120 121 122 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 120 def personal_finance_category @personal_finance_category end |
#predicted_next_date ⇒ Date
The predicted date of the next payment. This will only be set if the next payment date can be predicted.
61 62 63 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 61 def predicted_next_date @predicted_next_date end |
#status ⇒ TransactionStreamStatus
The current status of the transaction stream. ‘MATURE`: A `MATURE` recurring stream should have at least 3 transactions and happen on a regular cadence (For Annual recurring stream, we will mark it `MATURE` after 2 instances). `EARLY_DETECTION`: When a recurring transaction first appears in the transaction history and before it fulfills the requirement of a mature stream, the status will be `EARLY_DETECTION`. `TOMBSTONED`: A stream that was previously in the `EARLY_DETECTION` status will move to the `TOMBSTONED` status when no further transactions were found at the next expected date. `UNKNOWN`: A stream is assigned an `UNKNOWN` status when none of the other statuses are applicable.
110 111 112 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 110 def status @status end |
#stream_id ⇒ String
A unique id for the stream
19 20 21 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 19 def stream_id @stream_id end |
#transaction_ids ⇒ Array[String]
An array of Plaid transaction IDs belonging to the stream, sorted by posted date.
83 84 85 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 83 def transaction_ids @transaction_ids end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 214 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_id = hash.key?('account_id') ? hash['account_id'] : nil stream_id = hash.key?('stream_id') ? hash['stream_id'] : nil category = hash.key?('category') ? hash['category'] : nil category_id = hash.key?('category_id') ? hash['category_id'] : nil description = hash.key?('description') ? hash['description'] : nil merchant_name = hash.key?('merchant_name') ? hash['merchant_name'] : nil first_date = hash.key?('first_date') ? hash['first_date'] : nil last_date = hash.key?('last_date') ? hash['last_date'] : nil frequency = hash.key?('frequency') ? hash['frequency'] : nil transaction_ids = hash.key?('transaction_ids') ? hash['transaction_ids'] : nil average_amount = TransactionStreamAmount.from_hash(hash['average_amount']) if hash['average_amount'] last_amount = TransactionStreamAmount.from_hash(hash['last_amount']) if hash['last_amount'] is_active = hash.key?('is_active') ? hash['is_active'] : nil status = hash.key?('status') ? hash['status'] : nil is_user_modified = hash.key?('is_user_modified') ? hash['is_user_modified'] : nil predicted_next_date = hash.key?('predicted_next_date') ? hash['predicted_next_date'] : SKIP if hash['personal_finance_category'] personal_finance_category = PersonalFinanceCategory.from_hash(hash['personal_finance_category']) end last_user_modified_datetime = if hash.key?('last_user_modified_datetime') (DateTimeHelper.from_rfc3339(hash['last_user_modified_datetime']) if hash['last_user_modified_datetime']) else SKIP end # 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. TransactionStream.new(account_id: account_id, stream_id: stream_id, category: category, category_id: category_id, description: description, merchant_name: merchant_name, first_date: first_date, last_date: last_date, frequency: frequency, transaction_ids: transaction_ids, average_amount: average_amount, last_amount: last_amount, is_active: is_active, status: status, is_user_modified: is_user_modified, predicted_next_date: predicted_next_date, personal_finance_category: personal_finance_category, last_user_modified_datetime: last_user_modified_datetime, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 133 def self.names @_hash = {} if @_hash.nil? @_hash['account_id'] = 'account_id' @_hash['stream_id'] = 'stream_id' @_hash['category'] = 'category' @_hash['category_id'] = 'category_id' @_hash['description'] = 'description' @_hash['merchant_name'] = 'merchant_name' @_hash['first_date'] = 'first_date' @_hash['last_date'] = 'last_date' @_hash['predicted_next_date'] = 'predicted_next_date' @_hash['frequency'] = 'frequency' @_hash['transaction_ids'] = 'transaction_ids' @_hash['average_amount'] = 'average_amount' @_hash['last_amount'] = 'last_amount' @_hash['is_active'] = 'is_active' @_hash['status'] = 'status' @_hash['personal_finance_category'] = 'personal_finance_category' @_hash['is_user_modified'] = 'is_user_modified' @_hash['last_user_modified_datetime'] = 'last_user_modified_datetime' @_hash end |
.nullables ⇒ Object
An array for nullable fields
166 167 168 169 170 171 172 173 174 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 166 def self.nullables %w[ category category_id merchant_name predicted_next_date personal_finance_category ] end |
.optionals ⇒ Object
An array for optional fields
157 158 159 160 161 162 163 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 157 def self.optionals %w[ predicted_next_date personal_finance_category last_user_modified_datetime ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 295 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_id: #{@account_id.inspect}, stream_id: #{@stream_id.inspect},"\ " category: #{@category.inspect}, category_id: #{@category_id.inspect}, description:"\ " #{@description.inspect}, merchant_name: #{@merchant_name.inspect}, first_date:"\ " #{@first_date.inspect}, last_date: #{@last_date.inspect}, predicted_next_date:"\ " #{@predicted_next_date.inspect}, frequency: #{@frequency.inspect}, transaction_ids:"\ " #{@transaction_ids.inspect}, average_amount: #{@average_amount.inspect}, last_amount:"\ " #{@last_amount.inspect}, is_active: #{@is_active.inspect}, status: #{@status.inspect},"\ " personal_finance_category: #{@personal_finance_category.inspect}, is_user_modified:"\ " #{@is_user_modified.inspect}, last_user_modified_datetime:"\ " #{@last_user_modified_datetime.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_last_user_modified_datetime ⇒ Object
276 277 278 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 276 def to_custom_last_user_modified_datetime DateTimeHelper.to_rfc3339(last_user_modified_datetime) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/the_plaid_api/models/transaction_stream.rb', line 281 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_id: #{@account_id}, stream_id: #{@stream_id}, category:"\ " #{@category}, category_id: #{@category_id}, description: #{@description}, merchant_name:"\ " #{@merchant_name}, first_date: #{@first_date}, last_date: #{@last_date},"\ " predicted_next_date: #{@predicted_next_date}, frequency: #{@frequency}, transaction_ids:"\ " #{@transaction_ids}, average_amount: #{@average_amount}, last_amount: #{@last_amount},"\ " is_active: #{@is_active}, status: #{@status}, personal_finance_category:"\ " #{@personal_finance_category}, is_user_modified: #{@is_user_modified},"\ " last_user_modified_datetime: #{@last_user_modified_datetime}, additional_properties:"\ " #{@additional_properties}>" end |