Class: Plaid::PayPeriodDetails
- Defined in:
- lib/plaid/models/pay_period_details.rb
Overview
Details about the pay period.
Instance Attribute Summary collapse
-
#check_amount ⇒ Float
The net amount of the paycheck.
-
#end_date ⇒ Date
The pay period end date, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format: “yyyy-mm-dd”.
-
#gross_earnings ⇒ Float
Total earnings before tax.
-
#pay_day ⇒ Date
The date on which the paystub was issued, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (“yyyy-mm-dd”).
-
#start_date ⇒ Date
The pay period start date, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format: “yyyy-mm-dd”.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(start_date:, end_date:, pay_day:, gross_earnings:, check_amount:, additional_properties: nil) ⇒ PayPeriodDetails
constructor
A new instance of PayPeriodDetails.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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:, end_date:, pay_day:, gross_earnings:, check_amount:, additional_properties: nil) ⇒ PayPeriodDetails
Returns a new instance of PayPeriodDetails.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/plaid/models/pay_period_details.rb', line 62 def initialize(start_date:, end_date:, pay_day:, gross_earnings:, check_amount:, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @start_date = start_date @end_date = end_date @pay_day = pay_day @gross_earnings = gross_earnings @check_amount = check_amount @additional_properties = additional_properties end |
Instance Attribute Details
#check_amount ⇒ Float
The net amount of the paycheck.
33 34 35 |
# File 'lib/plaid/models/pay_period_details.rb', line 33 def check_amount @check_amount end |
#end_date ⇒ Date
The pay period end date, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format: “yyyy-mm-dd”.
20 21 22 |
# File 'lib/plaid/models/pay_period_details.rb', line 20 def end_date @end_date end |
#gross_earnings ⇒ Float
Total earnings before tax.
29 30 31 |
# File 'lib/plaid/models/pay_period_details.rb', line 29 def gross_earnings @gross_earnings end |
#pay_day ⇒ Date
The date on which the paystub was issued, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (“yyyy-mm-dd”).
25 26 27 |
# File 'lib/plaid/models/pay_period_details.rb', line 25 def pay_day @pay_day end |
#start_date ⇒ Date
The pay period start date, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format: “yyyy-mm-dd”.
15 16 17 |
# File 'lib/plaid/models/pay_period_details.rb', line 15 def start_date @start_date end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/plaid/models/pay_period_details.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. start_date = hash.key?('start_date') ? hash['start_date'] : nil end_date = hash.key?('end_date') ? hash['end_date'] : nil pay_day = hash.key?('pay_day') ? hash['pay_day'] : nil gross_earnings = hash.key?('gross_earnings') ? hash['gross_earnings'] : nil check_amount = hash.key?('check_amount') ? hash['check_amount'] : nil # 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. PayPeriodDetails.new(start_date: start_date, end_date: end_date, pay_day: pay_day, gross_earnings: gross_earnings, check_amount: check_amount, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 44 |
# File 'lib/plaid/models/pay_period_details.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['start_date'] = 'start_date' @_hash['end_date'] = 'end_date' @_hash['pay_day'] = 'pay_day' @_hash['gross_earnings'] = 'gross_earnings' @_hash['check_amount'] = 'check_amount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
52 53 54 55 56 57 58 59 60 |
# File 'lib/plaid/models/pay_period_details.rb', line 52 def self.nullables %w[ start_date end_date pay_day gross_earnings check_amount ] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 |
# File 'lib/plaid/models/pay_period_details.rb', line 47 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
112 113 114 115 116 117 |
# File 'lib/plaid/models/pay_period_details.rb', line 112 def inspect class_name = self.class.name.split('::').last "<#{class_name} start_date: #{@start_date.inspect}, end_date: #{@end_date.inspect},"\ " pay_day: #{@pay_day.inspect}, gross_earnings: #{@gross_earnings.inspect}, check_amount:"\ " #{@check_amount.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
104 105 106 107 108 109 |
# File 'lib/plaid/models/pay_period_details.rb', line 104 def to_s class_name = self.class.name.split('::').last "<#{class_name} start_date: #{@start_date}, end_date: #{@end_date}, pay_day: #{@pay_day},"\ " gross_earnings: #{@gross_earnings}, check_amount: #{@check_amount}, additional_properties:"\ " #{@additional_properties}>" end |