Class: Fdg22

Inherits:
Object
  • Object
show all
Defined in:
lib/fdg22.rb

Instance Method Summary collapse

Constructor Details

#initialize(locale: 'en-GB', email_api: nil) ⇒ Fdg22

Returns a new instance of Fdg22.



16
17
18
19
20
21
# File 'lib/fdg22.rb', line 16

def initialize(locale: 'en-GB', email_api: nil)

  @email_api = email_api
  @qf = QuickFaker.new locale

end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (private)



73
74
75
# File 'lib/fdg22.rb', line 73

def method_missing(method_name, *args)
  lookup(method_name, *args)
end

Instance Method Details

#emailObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/fdg22.rb', line 23

def email()

  if @email_api then
    tm = TempMail44.new(apikey: @email_api)
    @email ||= tm.create
  else
    @email = @qf.email
  end

end

#first_nameObject



34
35
36
# File 'lib/fdg22.rb', line 34

def first_name()
  @qf.first_name
end

#last_nameObject



38
39
40
# File 'lib/fdg22.rb', line 38

def last_name()
  @qf.last_name
end

#lookup(method_name, context = nil) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/fdg22.rb', line 42

def lookup(method_name, context=nil)

  s = method_name.to_sym

  if self.respond_to? s then
    self.method(s).call()
  else
    @qf.lookup(method_name, context)
  end
end

#passwordObject



53
54
55
# File 'lib/fdg22.rb', line 53

def password()
  @password ||= LeetPassword.easygen
end

#postcodeObject



57
58
59
# File 'lib/fdg22.rb', line 57

def postcode()
  @qf.postcode
end

#telephoneObject Also known as: sms



61
62
63
# File 'lib/fdg22.rb', line 61

def telephone()
  @telephone ||= TempSMS22.new.number
end

#titleObject



67
68
69
# File 'lib/fdg22.rb', line 67

def title()
  @qf.prefix
end