Class: ThePlaidApi::NegativeBalanceOccurrence

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

Overview

Details about a specific occurrence of a negative balance period, including start and end dates.

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(start_date: SKIP, end_date: SKIP, minimum_balance: SKIP, additional_properties: nil) ⇒ NegativeBalanceOccurrence

Returns a new instance of NegativeBalanceOccurrence.



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

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

  @start_date = start_date unless start_date == SKIP
  @end_date = end_date unless end_date == SKIP
  @minimum_balance = minimum_balance unless minimum_balance == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#end_dateDate

The date of the last transaction that caused the account to have a negative balance. The date will be returned in an ISO 8601 format (YYYY-MM-DD). This date is inclusive, meaning that this was the last date that the account had a negative balance.

Returns:

  • (Date)


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

def end_date
  @end_date
end

#minimum_balanceAmountWithCurrency

A monetary amount with its associated currency information, supporting both official and unofficial currency codes.

Returns:



30
31
32
# File 'lib/the_plaid_api/models/negative_balance_occurrence.rb', line 30

def minimum_balance
  @minimum_balance
end

#start_dateDate

The date of the first transaction that caused the account to have a negative balance. The date will be returned in an ISO 8601 format (YYYY-MM-DD).

Returns:

  • (Date)


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

def start_date
  @start_date
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  start_date = hash.key?('start_date') ? hash['start_date'] : SKIP
  end_date = hash.key?('end_date') ? hash['end_date'] : SKIP
  minimum_balance = AmountWithCurrency.from_hash(hash['minimum_balance']) if
    hash['minimum_balance']

  # 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.
  NegativeBalanceOccurrence.new(start_date: start_date,
                                end_date: end_date,
                                minimum_balance: minimum_balance,
                                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['start_date'] = 'start_date'
  @_hash['end_date'] = 'end_date'
  @_hash['minimum_balance'] = 'minimum_balance'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
54
55
56
57
# File 'lib/the_plaid_api/models/negative_balance_occurrence.rb', line 51

def self.nullables
  %w[
    start_date
    end_date
    minimum_balance
  ]
end

.optionalsObject

An array for optional fields



42
43
44
45
46
47
48
# File 'lib/the_plaid_api/models/negative_balance_occurrence.rb', line 42

def self.optionals
  %w[
    start_date
    end_date
    minimum_balance
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



95
96
97
98
99
# File 'lib/the_plaid_api/models/negative_balance_occurrence.rb', line 95

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