Class: AbacatePay::Enums::Pix::KeyTypes

Inherits:
Object
  • Object
show all
Defined in:
lib/abacate_pay/enums/pix/key_types.rb

Constant Summary collapse

CPF =
"CPF"
CNPJ =
"CNPJ"
PHONE =
"PHONE"
EMAIL =
"EMAIL"
RANDOM =
"RANDOM"
BR_CODE =
"BR_CODE"

Class Method Summary collapse

Class Method Details

.valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/abacate_pay/enums/pix/key_types.rb', line 18

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

.validate!(value) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
26
# File 'lib/abacate_pay/enums/pix/key_types.rb', line 22

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

  value
end

.valuesObject



14
15
16
# File 'lib/abacate_pay/enums/pix/key_types.rb', line 14

def self.values
  [CPF, CNPJ, PHONE, EMAIL, RANDOM, BR_CODE]
end