Class: ThePlaidApi::PersonalFinanceCategory

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

Overview

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/).

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(primary:, detailed:, confidence_level: SKIP, version: SKIP, additional_properties: nil) ⇒ PersonalFinanceCategory

Returns a new instance of PersonalFinanceCategory.



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/the_plaid_api/models/personal_finance_category.rb', line 77

def initialize(primary:, detailed:, confidence_level: SKIP, version: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @primary = primary
  @detailed = detailed
  @confidence_level = confidence_level unless confidence_level == SKIP
  @version = version unless version == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#confidence_levelString

A description of how confident we are that the provided categories accurately describe the transaction intent. ‘VERY_HIGH`: We are more than 98% confident that this category reflects the intent of the transaction. `HIGH`: We are more than 90% confident that this category reflects the intent of the transaction. `MEDIUM`: We are moderately confident that this category reflects the intent of the transaction. `LOW`: This category may reflect the intent, but there may be other categories that are more accurate. `UNKNOWN`: We don’t know the confidence level for this category.

Returns:

  • (String)


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

def confidence_level
  @confidence_level
end

#detailedString

A granular category conveying the transaction’s intent. This field can also be used as a unique identifier for the category.

Returns:

  • (String)


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

def detailed
  @detailed
end

#primaryString

A high level category that communicates the broad category of the transaction.

Returns:

  • (String)


20
21
22
# File 'lib/the_plaid_api/models/personal_finance_category.rb', line 20

def primary
  @primary
end

#versionPersonalFinanceCategoryVersion

Indicates which version of the personal finance category taxonomy is being used. [View PFCv2 and PFCv1 taxonomies](plaid.com/documents/pfc-taxonomy-all.csv). If you enabled Transactions or Enrich before December 2025 you will receive the ‘v1` taxonomy by default and may request `v2` by explicitly setting this field to `v2` in the request. If you enabled Transactions or Enrich on or after December 2025, you may only receive the `v2` taxonomy.



50
51
52
# File 'lib/the_plaid_api/models/personal_finance_category.rb', line 50

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/the_plaid_api/models/personal_finance_category.rb', line 90

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  primary = hash.key?('primary') ? hash['primary'] : nil
  detailed = hash.key?('detailed') ? hash['detailed'] : nil
  confidence_level =
    hash.key?('confidence_level') ? hash['confidence_level'] : SKIP
  version = hash.key?('version') ? hash['version'] : 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.
  PersonalFinanceCategory.new(primary: primary,
                              detailed: detailed,
                              confidence_level: confidence_level,
                              version: version,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['primary'] = 'primary'
  @_hash['detailed'] = 'detailed'
  @_hash['confidence_level'] = 'confidence_level'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



71
72
73
74
75
# File 'lib/the_plaid_api/models/personal_finance_category.rb', line 71

def self.nullables
  %w[
    confidence_level
  ]
end

.optionalsObject

An array for optional fields



63
64
65
66
67
68
# File 'lib/the_plaid_api/models/personal_finance_category.rb', line 63

def self.optionals
  %w[
    confidence_level
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



124
125
126
127
128
129
# File 'lib/the_plaid_api/models/personal_finance_category.rb', line 124

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} primary: #{@primary.inspect}, detailed: #{@detailed.inspect},"\
  " confidence_level: #{@confidence_level.inspect}, version: #{@version.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



116
117
118
119
120
121
# File 'lib/the_plaid_api/models/personal_finance_category.rb', line 116

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} primary: #{@primary}, detailed: #{@detailed}, confidence_level:"\
  " #{@confidence_level}, version: #{@version}, additional_properties:"\
  " #{@additional_properties}>"
end