module Faker::InternetSE
Constants
- BYTE
- DISPOSABLE_HOSTS
- DOMAIN_SUFFIXES
- HOSTS
Public Instance Methods
company_name_single_word()
click to toggle source
# File lib/ffakerer/internet_se.rb, line 81 def company_name_single_word CompanySE.name.split(' ').first end
disposable_email(name = nil)
click to toggle source
Returns an email address of an online disposable email service (like tempinbox.com). you can really send an email to these addresses an access it by going to the service web pages.
# File lib/ffakerer/internet_se.rb, line 19 def disposable_email(name = nil) "#{user_name(name)}@#{DISPOSABLE_HOSTS.rand}" end
domain_name()
click to toggle source
# File lib/ffakerer/internet_se.rb, line 70 def domain_name "#{domain_word}.#{domain_suffix}" end
domain_suffix()
click to toggle source
# File lib/ffakerer/internet_se.rb, line 85 def domain_suffix DOMAIN_SUFFIXES.rand end
domain_word()
click to toggle source
# File lib/ffakerer/internet_se.rb, line 74 def domain_word company_name_single_word.tap { |dw| dw.gsub!(/\W/, '') dw.downcase! } end
email(name = nil)
click to toggle source
# File lib/ffakerer/internet_se.rb, line 12 def email(name = nil) "#{user_name(name)}@#{domain_name}" end
free_email(name = nil)
click to toggle source
# File lib/ffakerer/internet_se.rb, line 23 def free_email(name = nil) "#{user_name(name)}@#{HOSTS.rand}" end
http_url()
click to toggle source
# File lib/ffakerer/internet_se.rb, line 93 def http_url uri("http") end
ip_v4_address()
click to toggle source
# File lib/ffakerer/internet_se.rb, line 97 def ip_v4_address (1..4).map { BYTE.random_pick(1) }.join(".") end
join_to_user_name(array_parts)
click to toggle source
# File lib/ffakerer/internet_se.rb, line 64 def join_to_user_name(array_parts) join_char = ArrayUtils.rand(%w(. _)) array_parts.map!(&:downcase) array_parts.join(join_char) end
login_user_name()
click to toggle source
Used to fake login names were dot is not allowed
# File lib/ffakerer/internet_se.rb, line 28 def login_user_name user_name.gsub('.','') end
uri(protocol)
click to toggle source
# File lib/ffakerer/internet_se.rb, line 89 def uri(protocol) "#{protocol}://#{domain_name}" end
user_name(name = nil)
click to toggle source
Mostly used for email creation
# File lib/ffakerer/internet_se.rb, line 33 def user_name(name = nil) return user_name_from_name(name) if name user_name_random end
user_name_from_name(name)
click to toggle source
# File lib/ffakerer/internet_se.rb, line 59 def user_name_from_name(name) array_parts = ArrayUtils.shuffle(name.scan(/\w+/)) join_to_user_name(array_parts) end
user_name_random()
click to toggle source
# File lib/ffakerer/internet_se.rb, line 38 def user_name_random variant = rand(2) case variant when 0 then user_name_variant_short when 1 then user_name_variant_long else user_name_variant_short end end
user_name_variant_long()
click to toggle source
# File lib/ffakerer/internet_se.rb, line 47 def user_name_variant_long array_parts = [ NameSE.first_name, NameSE.last_name ] array_parts.map!{ |word| word.gsub(/\W/, '') } join_to_user_name(array_parts) end
user_name_variant_short()
click to toggle source
# File lib/ffakerer/internet_se.rb, line 53 def user_name_variant_short array_parts = [ NameSE.first_name ] array_parts.map!{ |word| word.gsub(/\W/, '') } join_to_user_name(array_parts) end