Class: AbacatePay::Enums::Billings::Frequencies

Inherits:
Object
  • Object
show all
Defined in:
lib/abacate_pay/enums/billings/frequencies.rb

Overview

Enumeration defining billing frequencies.

This enumeration is used to categorize different payment or billing frequencies.

Constant Summary collapse

ONE_TIME =

One-time billing.

Returns:

  • (String)

    Represents a billing that occurs only once

"ONE_TIME"
WEEKLY =
"WEEKLY"
MONTHLY =
"MONTHLY"
SEMIANNUALLY =
"SEMIANNUALLY"
ANNUALLY =
"ANNUALLY"
MULTIPLE_PAYMENTS =
"MULTIPLE_PAYMENTS"

Class Method Summary collapse

Class Method Details

.valid?(value) ⇒ Boolean

Validates if a given value is a valid frequency

Parameters:

  • value (String)

    The value to validate

Returns:

  • (Boolean)

    true if valid, false otherwise



28
29
30
# File 'lib/abacate_pay/enums/billings/frequencies.rb', line 28

def self.valid?(value)
  values.include?(value)
end

.validate!(value) ⇒ String

Validates and returns the value if valid

Parameters:

  • value (String)

    The value to validate

Returns:

  • (String)

    The validated value

Raises:

  • (ArgumentError)

    if value is invalid



36
37
38
39
40
# File 'lib/abacate_pay/enums/billings/frequencies.rb', line 36

def self.validate!(value)
  raise ArgumentError, "Invalid frequency: #{value}" unless valid?(value)

  value
end

.valuesArray<String>

Gets all valid frequency values

Returns:

  • (Array<String>)

    List of all valid frequencies



21
22
23
# File 'lib/abacate_pay/enums/billings/frequencies.rb', line 21

def self.values
  [ONE_TIME, WEEKLY, MONTHLY, SEMIANNUALLY, ANNUALLY, MULTIPLE_PAYMENTS]
end