Class: Plaid::Income

Inherits:
Object
  • Object
show all
Defined in:
lib/plaid/income.rb

Overview

Public: Representation of Income data.

Defined Under Namespace

Classes: Stream

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ Income

Returns a new instance of Income.



82
83
84
85
86
87
88
89
90
# File 'lib/plaid/income.rb', line 82

def initialize(fields)
  @income_streams = fields['income_streams'].map { |is| Stream.new(is) }

  %w(last_year_income last_year_income_before_tax projected_yearly_income
     projected_yearly_income_before_tax number_of_income_streams
     max_number_of_overlapping_income_streams).each do |field|
    instance_variable_set "@#{field}", fields[field]
  end
end

Instance Attribute Details

#income_streamsObject (readonly)

Public: The Array of Stream.



50
51
52
# File 'lib/plaid/income.rb', line 50

def income_streams
  @income_streams
end

#last_year_incomeObject (readonly)

Public: The Numeric sum of user’s income over the past 365 days. If Plaid has less than 365 days of data this will be less than a full year income. E.g. 67000.



55
56
57
# File 'lib/plaid/income.rb', line 55

def last_year_income
  @last_year_income
end

#last_year_income_before_taxObject (readonly)

Public: The last_year_income interpolated to value before taxes. This is the minimum pre-tax salary that assumes a filing status of single with zero dependents. E.g. 73700.



60
61
62
# File 'lib/plaid/income.rb', line 60

def last_year_income_before_tax
  @last_year_income_before_tax
end

#max_number_of_overlapping_income_streamsObject (readonly)

Public: The Integer max number of income streams present at the same time over the past 365 days. E.g. 314.



76
77
78
# File 'lib/plaid/income.rb', line 76

def max_number_of_overlapping_income_streams
  @max_number_of_overlapping_income_streams
end

#number_of_income_streamsObject (readonly)

Public: The Integer total number of distinct income streams received over the past 365 days. E.g. 2.



80
81
82
# File 'lib/plaid/income.rb', line 80

def number_of_income_streams
  @number_of_income_streams
end

#projected_yearly_incomeObject (readonly)

Public: The Numeric user’s income extrapolated over a year based on current, active income streams. Income streams become inactive if they have not recurred for more than two cycles. For example, if a weekly paycheck hasn’t been seen for the past two weeks, it is no longer active. E.g. 69800.



67
68
69
# File 'lib/plaid/income.rb', line 67

def projected_yearly_income
  @projected_yearly_income
end

#projected_yearly_income_before_taxObject (readonly)

Public: The projected_yearly_income interpolated to value before taxes. This is the minimum pre-tax salary that assumes a filing status of single with zero dependents. E.g. 75600.



72
73
74
# File 'lib/plaid/income.rb', line 72

def projected_yearly_income_before_tax
  @projected_yearly_income_before_tax
end

Instance Method Details

#inspectObject Also known as: to_s

Public: Get a String representation of Income.

Returns a String.



95
96
97
98
99
# File 'lib/plaid/income.rb', line 95

def inspect
  "#<Plaid::Income last_year_income=#{last_year_income.inspect}, " \
    "projected_yearly_income=#{projected_yearly_income.inspect}, " \
    "number_of_income_streams=#{number_of_income_streams.inspect}, ...>"
end