Class: ThePlaidApi::PaystubYtdDetails

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

Overview

The amount of income earned year to date, as based on paystub data.

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(gross_earnings: SKIP, net_earnings: SKIP, additional_properties: nil) ⇒ PaystubYtdDetails

Returns a new instance of PaystubYtdDetails.



44
45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/paystub_ytd_details.rb', line 44

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

  @gross_earnings = gross_earnings unless gross_earnings == SKIP
  @net_earnings = net_earnings unless net_earnings == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#gross_earningsFloat

Year-to-date gross earnings.

Returns:

  • (Float)


14
15
16
# File 'lib/the_plaid_api/models/paystub_ytd_details.rb', line 14

def gross_earnings
  @gross_earnings
end

#net_earningsFloat

Year-to-date net (take home) earnings.

Returns:

  • (Float)


18
19
20
# File 'lib/the_plaid_api/models/paystub_ytd_details.rb', line 18

def net_earnings
  @net_earnings
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
26
# File 'lib/the_plaid_api/models/paystub_ytd_details.rb', line 21

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

.nullablesObject

An array for nullable fields



37
38
39
40
41
42
# File 'lib/the_plaid_api/models/paystub_ytd_details.rb', line 37

def self.nullables
  %w[
    gross_earnings
    net_earnings
  ]
end

.optionalsObject

An array for optional fields



29
30
31
32
33
34
# File 'lib/the_plaid_api/models/paystub_ytd_details.rb', line 29

def self.optionals
  %w[
    gross_earnings
    net_earnings
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



84
85
86
87
88
# File 'lib/the_plaid_api/models/paystub_ytd_details.rb', line 84

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

#to_sObject

Provides a human-readable string representation of the object.



77
78
79
80
81
# File 'lib/the_plaid_api/models/paystub_ytd_details.rb', line 77

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