Class: ThePlaidApi::RuleDetails

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

Overview

Rules are run in numerical order. The first rule with a logic match is triggered. These are the details of that rule.

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(internal_note: SKIP, custom_action_key: SKIP, additional_properties: nil) ⇒ RuleDetails

Returns a new instance of RuleDetails.



46
47
48
49
50
51
52
53
54
# File 'lib/the_plaid_api/models/rule_details.rb', line 46

def initialize(internal_note: SKIP, custom_action_key: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @internal_note = internal_note unless internal_note == SKIP
  @custom_action_key = custom_action_key unless custom_action_key == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#custom_action_keyString

A string key, defined within the Dashboard, used to trigger programmatic behavior for a certain result. For instance, you could optionally choose to define a “3-day-hold” ‘custom_action_key` for an ACCEPT result.

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/rule_details.rb', line 23

def custom_action_key
  @custom_action_key
end

#internal_noteString

An optional message attached to the triggered rule, defined within the Dashboard, for your internal use. Useful for debugging, such as “Account appears to be closed.”

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/rule_details.rb', line 17

def internal_note
  @internal_note
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/the_plaid_api/models/rule_details.rb', line 57

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  internal_note = hash.key?('internal_note') ? hash['internal_note'] : SKIP
  custom_action_key =
    hash.key?('custom_action_key') ? hash['custom_action_key'] : 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.
  RuleDetails.new(internal_note: internal_note,
                  custom_action_key: custom_action_key,
                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
# File 'lib/the_plaid_api/models/rule_details.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['internal_note'] = 'internal_note'
  @_hash['custom_action_key'] = 'custom_action_key'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/the_plaid_api/models/rule_details.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
# File 'lib/the_plaid_api/models/rule_details.rb', line 34

def self.optionals
  %w[
    internal_note
    custom_action_key
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



86
87
88
89
90
# File 'lib/the_plaid_api/models/rule_details.rb', line 86

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

#to_sObject

Provides a human-readable string representation of the object.



79
80
81
82
83
# File 'lib/the_plaid_api/models/rule_details.rb', line 79

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