Class: Faker::Business

Inherits:
Base
  • Object
show all
Defined in:
lib/faker/default/business.rb

Constant Summary

Constants inherited from Base

Faker::Base::LLetters, Faker::Base::Letters, Faker::Base::NOT_GIVEN, Faker::Base::Numbers, Faker::Base::ULetters

Class Method Summary collapse

Methods inherited from Base

bothify, disable_enforce_available_locales, fetch, fetch_all, flexible, generate, letterify, method_missing, numerify, parse, rand, rand_in_range, regexify, resolve, respond_to_missing?, sample, shuffle, shuffle!, translate, unique, with_locale

Class Method Details

.credit_card_expiry_dateDate

Produces a credit card expiration date.

Examples:

Faker::Business.credit_card_expiry_date #=> <Date: 2015-11-11 ((2457338j,0s,0n),+0s,2299161j)>

Returns:



32
33
34
# File 'lib/faker/default/business.rb', line 32

def credit_card_expiry_date
  ::Date.today + (365 * rand(1..4))
end

.credit_card_numberString

Produces a credit card number.

Examples:

Faker::Business.credit_card_number #=> "1228-1221-1221-1431"

Returns:



19
20
21
# File 'lib/faker/default/business.rb', line 19

def credit_card_number
  fetch('business.credit_card_numbers')
end

.credit_card_typeString

Produces a type of credit card.

Examples:

Faker::Business.credit_card_type #=> "visa"

Returns:



45
46
47
# File 'lib/faker/default/business.rb', line 45

def credit_card_type
  fetch('business.credit_card_types')
end