Class: ThePlaidApi::PaystubPayFrequency

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

Overview

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

Constant Summary collapse

PAYSTUB_PAY_FREQUENCY =
[
  # TODO: Write general description for MONTHLY
  MONTHLY = 'MONTHLY'.freeze,

  # TODO: Write general description for BIWEEKLY
  BIWEEKLY = 'BI-WEEKLY'.freeze,

  # TODO: Write general description for WEEKLY
  WEEKLY = 'WEEKLY'.freeze,

  # TODO: Write general description for SEMIMONTHLY
  SEMIMONTHLY = 'SEMI-MONTHLY'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = MONTHLY) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/the_plaid_api/models/paystub_pay_frequency.rb', line 30

def self.from_value(value, default_value = MONTHLY)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'monthly' then MONTHLY
  when 'biweekly' then BIWEEKLY
  when 'weekly' then WEEKLY
  when 'semimonthly' then SEMIMONTHLY
  else
    default_value
  end
end

.validate(value) ⇒ Object



24
25
26
27
28
# File 'lib/the_plaid_api/models/paystub_pay_frequency.rb', line 24

def self.validate(value)
  return false if value.nil?

  PAYSTUB_PAY_FREQUENCY.include?(value)
end