class MediTAF::Utils::MediTAFFaker

TimeStamp: a class that provides the current date time format

Public Class Methods

address() click to toggle source

using Faker address

# File lib/MediTAF/utils/meditaf_faker.rb, line 33
def address
  Faker::Address
end
code() click to toggle source

using Faker code

# File lib/MediTAF/utils/meditaf_faker.rb, line 43
def code
  Faker::Code
end
medidata_date_format() click to toggle source

Default representation of the current date format

# File lib/MediTAF/utils/meditaf_faker.rb, line 63
def medidata_date_format
  DateTime.now.strftime("%d-%b-%Y")
end
name() click to toggle source

using Faker name

# File lib/MediTAF/utils/meditaf_faker.rb, line 38
def name
  Faker::Name
end
number() click to toggle source

using Faker number

# File lib/MediTAF/utils/meditaf_faker.rb, line 48
def number
  Faker::Number
end
phone_number() click to toggle source

using Faker phone_number

# File lib/MediTAF/utils/meditaf_faker.rb, line 53
def phone_number
  Faker::PhoneNumber
end
random() click to toggle source

Random: a class that displays a random string in the MD5 format based on DateTime as string

# File lib/MediTAF/utils/meditaf_faker.rb, line 83
def random
  random_generator.to_s
end
timestamp() click to toggle source

Default representation of the current date format

# File lib/MediTAF/utils/meditaf_faker.rb, line 58
def timestamp
  DateTime.now.strftime()
end
timestamp_complete() click to toggle source

Complete representation of the current date format including picosecons

# File lib/MediTAF/utils/meditaf_faker.rb, line 78
def timestamp_complete
  DateTime.now.strftime("%m-%d-%Y:%H%M%S.%12N")
end
timestamp_long() click to toggle source

Long representation of the current date format - Missing Year

# File lib/MediTAF/utils/meditaf_faker.rb, line 68
def timestamp_long
  DateTime.now.strftime("%m%d%H%M%S%6N")
end
timestamp_short() click to toggle source

Short representation of the current date format with minutes, seconds and micro seconds

# File lib/MediTAF/utils/meditaf_faker.rb, line 73
def timestamp_short
  DateTime.now.strftime("%M%S%6N")
end
uid() click to toggle source

UID: a class that displays a random string in the MD5 format based on DateTime as string

# File lib/MediTAF/utils/meditaf_faker.rb, line 88
def uid
  Digest::MD5.hexdigest(DateTime.now.strftime("%m-%d-%Y:%H%M%S.%12N")).to_s
end
uid_md5(no_dash=true) click to toggle source

Code: a class that inherits from Faker:Code. It provides UID (32/40-bit length).

# File lib/MediTAF/utils/meditaf_faker.rb, line 93
def uid_md5(no_dash=true)
  no_dash ? generate_32_bit_checkmateUID_without_dash : generate_32_bit_checkmateUID_with_dash
end
uid_sha1(no_dash=true) click to toggle source
# File lib/MediTAF/utils/meditaf_faker.rb, line 97
def uid_sha1(no_dash=true)
  no_dash ? generate_40_bit_checkmateUID_without_dash : generate_40_bit_checkmateUID_with_dash
end

Private Class Methods

generate_32_bit_checkmateUID_with_dash() click to toggle source
# File lib/MediTAF/utils/meditaf_faker.rb, line 103
def generate_32_bit_checkmateUID_with_dash
  regexify(/[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}/)
end
generate_32_bit_checkmateUID_without_dash() click to toggle source
# File lib/MediTAF/utils/meditaf_faker.rb, line 107
def generate_32_bit_checkmateUID_without_dash
  regexify(/[a-f0-9]{32}/)
end
generate_40_bit_checkmateUID_with_dash() click to toggle source
# File lib/MediTAF/utils/meditaf_faker.rb, line 111
def generate_40_bit_checkmateUID_with_dash
  regexify(/[a-f0-9]{12}-([a-f0-9]{4}-){4}[a-f0-9]{12}/)
end
generate_40_bit_checkmateUID_without_dash() click to toggle source
# File lib/MediTAF/utils/meditaf_faker.rb, line 115
def generate_40_bit_checkmateUID_without_dash
  regexify(/[a-f0-9]{40}/)
end