Class: ThePlaidApi::BusinessFinanceCategory

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

Overview

Information describing the intent of the transaction. Most relevant for business finance use cases, but not limited to such use cases.

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, additional_properties: nil) ⇒ BusinessFinanceCategory

Returns a new instance of BusinessFinanceCategory.



60
61
62
63
64
65
66
67
68
69
# File 'lib/the_plaid_api/models/business_finance_category.rb', line 60

def initialize(primary:, detailed:, confidence_level: 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
  @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)


35
36
37
# File 'lib/the_plaid_api/models/business_finance_category.rb', line 35

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)


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

def detailed
  @detailed
end

#primaryString

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

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/business_finance_category.rb', line 16

def primary
  @primary
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/the_plaid_api/models/business_finance_category.rb', line 72

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

  # 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.
  BusinessFinanceCategory.new(primary: primary,
                              detailed: detailed,
                              confidence_level: confidence_level,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
# File 'lib/the_plaid_api/models/business_finance_category.rb', line 38

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

.nullablesObject

An array for nullable fields



54
55
56
57
58
# File 'lib/the_plaid_api/models/business_finance_category.rb', line 54

def self.nullables
  %w[
    confidence_level
  ]
end

.optionalsObject

An array for optional fields



47
48
49
50
51
# File 'lib/the_plaid_api/models/business_finance_category.rb', line 47

def self.optionals
  %w[
    confidence_level
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



103
104
105
106
107
108
# File 'lib/the_plaid_api/models/business_finance_category.rb', line 103

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

#to_sObject

Provides a human-readable string representation of the object.



96
97
98
99
100
# File 'lib/the_plaid_api/models/business_finance_category.rb', line 96

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