Class: Synthra::Types::FinanceBanking::DunsNumber

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/finance_banking/identifiers.rb

Overview

DunsNumber type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



83
84
85
# File 'lib/synthra/types/finance_banking/identifiers.rb', line 83

def generate_edge(rng, context, args)
  ["000000000", "999999999", "123456789"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



87
88
89
# File 'lib/synthra/types/finance_banking/identifiers.rb', line 87

def generate_invalid(rng, context, args)
  [nil, "not a duns", [], {}, "12345678"].sample(random: rng.instance_variable_get(:@random))
end

#generate_random(rng, context, args) ⇒ Object



78
79
80
81
# File 'lib/synthra/types/finance_banking/identifiers.rb', line 78

def generate_random(rng, context, args)
  # DUNS numbers are 9 digits, often formatted with dashes
  format("%09d", rng.int(100000000, 999999999))
end