Class: ThePlaidApi::PaystubDetails

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

Overview

An object representing details that can be found on the paystub.

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(pay_period_start_date: SKIP, pay_period_end_date: SKIP, pay_date: SKIP, paystub_provider: SKIP, pay_frequency: SKIP, additional_properties: nil) ⇒ PaystubDetails

Returns a new instance of PaystubDetails.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/the_plaid_api/models/paystub_details.rb', line 67

def initialize(pay_period_start_date: SKIP, pay_period_end_date: SKIP,
               pay_date: SKIP, paystub_provider: SKIP, pay_frequency: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @pay_period_start_date = pay_period_start_date unless pay_period_start_date == SKIP
  @pay_period_end_date = pay_period_end_date unless pay_period_end_date == SKIP
  @pay_date = pay_date unless pay_date == SKIP
  @paystub_provider = paystub_provider unless paystub_provider == SKIP
  @pay_frequency = pay_frequency unless pay_frequency == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#pay_dateDate

Pay date on the paystub in the ‘YYYY-MM-DD’ format.

Returns:

  • (Date)


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

def pay_date
  @pay_date
end

#pay_frequencyPaystubPayFrequency

The frequency at which the employee is paid. Possible values: ‘MONTHLY`, `BI-WEEKLY`, `WEEKLY`, `SEMI-MONTHLY`.

Returns:



32
33
34
# File 'lib/the_plaid_api/models/paystub_details.rb', line 32

def pay_frequency
  @pay_frequency
end

#pay_period_end_dateDate

Ending date of the pay period on the paystub in the ‘YYYY-MM-DD’ format.

Returns:

  • (Date)


19
20
21
# File 'lib/the_plaid_api/models/paystub_details.rb', line 19

def pay_period_end_date
  @pay_period_end_date
end

#pay_period_start_dateDate

Beginning date of the pay period on the paystub in the ‘YYYY-MM-DD’ format.

Returns:

  • (Date)


15
16
17
# File 'lib/the_plaid_api/models/paystub_details.rb', line 15

def pay_period_start_date
  @pay_period_start_date
end

#paystub_providerString

The name of the payroll provider that generated the paystub, e.g. ADP

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/paystub_details.rb', line 27

def paystub_provider
  @paystub_provider
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/the_plaid_api/models/paystub_details.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  pay_period_start_date =
    hash.key?('pay_period_start_date') ? hash['pay_period_start_date'] : SKIP
  pay_period_end_date =
    hash.key?('pay_period_end_date') ? hash['pay_period_end_date'] : SKIP
  pay_date = hash.key?('pay_date') ? hash['pay_date'] : SKIP
  paystub_provider =
    hash.key?('paystub_provider') ? hash['paystub_provider'] : SKIP
  pay_frequency = hash.key?('pay_frequency') ? hash['pay_frequency'] : 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.
  PaystubDetails.new(pay_period_start_date: pay_period_start_date,
                     pay_period_end_date: pay_period_end_date,
                     pay_date: pay_date,
                     paystub_provider: paystub_provider,
                     pay_frequency: pay_frequency,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/the_plaid_api/models/paystub_details.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['pay_period_start_date'] = 'pay_period_start_date'
  @_hash['pay_period_end_date'] = 'pay_period_end_date'
  @_hash['pay_date'] = 'pay_date'
  @_hash['paystub_provider'] = 'paystub_provider'
  @_hash['pay_frequency'] = 'pay_frequency'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
60
61
62
63
64
65
# File 'lib/the_plaid_api/models/paystub_details.rb', line 57

def self.nullables
  %w[
    pay_period_start_date
    pay_period_end_date
    pay_date
    paystub_provider
    pay_frequency
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    pay_period_start_date
    pay_period_end_date
    pay_date
    paystub_provider
    pay_frequency
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



120
121
122
123
124
125
126
# File 'lib/the_plaid_api/models/paystub_details.rb', line 120

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} pay_period_start_date: #{@pay_period_start_date.inspect},"\
  " pay_period_end_date: #{@pay_period_end_date.inspect}, pay_date: #{@pay_date.inspect},"\
  " paystub_provider: #{@paystub_provider.inspect}, pay_frequency: #{@pay_frequency.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



112
113
114
115
116
117
# File 'lib/the_plaid_api/models/paystub_details.rb', line 112

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} pay_period_start_date: #{@pay_period_start_date}, pay_period_end_date:"\
  " #{@pay_period_end_date}, pay_date: #{@pay_date}, paystub_provider: #{@paystub_provider},"\
  " pay_frequency: #{@pay_frequency}, additional_properties: #{@additional_properties}>"
end