Skip to content

Commit

Permalink
Add YARD docs to Faker::Invoice (#2022)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielTiringer committed May 28, 2020
1 parent acebadd commit e483f1a
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions lib/faker/default/invoice.rb
Expand Up @@ -5,7 +5,18 @@ class Invoice < Base
flexible :invoice

class << self
# Generate random amount between values with 2 decimals
##
# Produces a random amount between values with 2 decimals
#
# @param from [Integer] Specifies lower limit.
# @param to [Integer] Specifies upper limit.
# @return [Integer]
#
# @example
# Faker::Finance.amount_between #=> 0
# Faker::Finance.amount_between(0, 10) #=> 4.33
#
# @faker.version 1.9.0
def amount_between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 0, to: 0)
warn_for_deprecated_arguments do |keywords|
keywords << :from if legacy_from != NOT_GIVEN
Expand All @@ -15,8 +26,16 @@ def amount_between(legacy_from = NOT_GIVEN, legacy_to = NOT_GIVEN, from: 0, to:
Faker::Base.rand_in_range(from, to).round(2)
end

# International bank slip reference https://en.wikipedia.org/wiki/Creditor_Reference
# ref is optional so that we can create unit tests
##
# Produces a random valid reference accoring to the International bank slip reference https://en.wikipedia.org/wiki/Creditor_Reference
#
# @param ref [String] Specifies reference base.
# @return [String]
#
# @example
# Faker::Invoice.creditor_reference #=> "RF34118592570724925498"
#
# @faker.version 1.9.0
def creditor_reference(legacy_ref = NOT_GIVEN, ref: '')
warn_for_deprecated_arguments do |keywords|
keywords << :ref if legacy_ref != NOT_GIVEN
Expand All @@ -27,8 +46,16 @@ def creditor_reference(legacy_ref = NOT_GIVEN, ref: '')
'RF' + iban_checksum('RF', ref) + ref
end

# Payment references have some rules in certain countries
# ref is optional so that we can create unit tests
##
# Produces a random valid reference.
#
# @param ref [String] Specifies reference base.
# @return [String]
#
# @example
# Faker::Invoice.reference #=> "45656646957845"
#
# @faker.version 1.9.0
def reference(legacy_ref = NOT_GIVEN, ref: '')
warn_for_deprecated_arguments do |keywords|
keywords << :ref if legacy_ref != NOT_GIVEN
Expand Down

0 comments on commit e483f1a

Please sign in to comment.