Class: AbacatePay::Enums::Billing::Methods

Inherits:
Object
  • Object
show all
Defined in:
lib/abacatepay/enums/billing/methods.rb

Overview

Enumeration defining billing methods.

This enumeration is used to represent different payment methods available for billing.

Constant Summary collapse

PIX =

PIX payment method.

Returns:

  • (String)

    Represents the PIX payment method, a popular instant payment system in Brazil

"PIX"

Class Method Summary collapse

Class Method Details

.valid?(value) ⇒ Boolean

Validates if a given value is a valid method

Parameters:

  • value (String)

    The value to validate

Returns:

  • (Boolean)

    true if valid, false otherwise



23
24
25
# File 'lib/abacatepay/enums/billing/methods.rb', line 23

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



31
32
33
34
# File 'lib/abacatepay/enums/billing/methods.rb', line 31

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

.valuesArray<String>

Gets all valid method values

Returns:

  • (Array<String>)

    List of all valid payment methods



16
17
18
# File 'lib/abacatepay/enums/billing/methods.rb', line 16

def self.values
  [PIX]
end