Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add YARD docs to Faker::Finance #1998

Merged
merged 1 commit into from May 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions lib/faker/default/finance.rb
Expand Up @@ -7,6 +7,18 @@ class Finance < Base
maestro forbrugsforeningen laser].freeze

class << self
##
# Produces a random credit card number.
#
# @param card_type [String] Specific credit card type.
# @return [String]
#
# @example
# Faker::Finance.credit_card #=> "3018-348979-1853"
# Faker::Finance.credit_card(:mastercard) #=> "6771-8921-2291-6236"
# Faker::Finance.credit_card(:mastercard, :visa) #=> "4448-8934-1277-7195"
#
# @faker.version 1.2.0
def credit_card(*types)
types = CREDIT_CARD_TYPES if types.empty?
type = sample(types)
Expand All @@ -26,6 +38,18 @@ def credit_card(*types)
template.gsub('L', luhn_digit.to_s)
end

##
# Produces a random vat number.
#
# @param country [String] Two capital letter country code to use for the vat number.
# @return [String]
#
# @example
# Faker::Finance.vat_number #=> "BR38.395.329/2471-83"
# Faker::Finance.vat_number('DE') #=> "DE593306671"
# Faker::Finance.vat_number('ZA') #=> "ZA79494416181"
#
# @faker.version 1.9.2
def vat_number(legacy_country = NOT_GIVEN, country: 'BR')
warn_for_deprecated_arguments do |keywords|
keywords << :country if legacy_country != NOT_GIVEN
Expand Down