Class: DataGenerator::Gen::User

Inherits:
Object
  • Object
show all
Defined in:
lib/howitzer/utils/data_generator/gen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ User

Returns a new instance of User.



110
111
112
113
114
115
116
117
118
119
# File 'lib/howitzer/utils/data_generator/gen.rb', line 110

def initialize(params={})
  @email = params.delete(:email)
  @email_name, @domain = @email.to_s.split('@')
  @login = params.delete(:login) || @email_name
  @password = params.delete(:password)
  @first_name = params.delete(:first_name)
  @last_name = params.delete(:last_name)
  @full_name = "#@first_name #@last_name"
  @mailbox = params.delete(:mailbox)
end

Instance Attribute Details

#domainObject (readonly)

Returns the value of attribute domain.



108
109
110
# File 'lib/howitzer/utils/data_generator/gen.rb', line 108

def domain
  @domain
end

#emailObject (readonly)

Returns the value of attribute email.



108
109
110
# File 'lib/howitzer/utils/data_generator/gen.rb', line 108

def email
  @email
end

#first_nameObject (readonly)

Returns the value of attribute first_name.



108
109
110
# File 'lib/howitzer/utils/data_generator/gen.rb', line 108

def first_name
  @first_name
end

#full_nameObject (readonly)

Returns the value of attribute full_name.



108
109
110
# File 'lib/howitzer/utils/data_generator/gen.rb', line 108

def full_name
  @full_name
end

#last_nameObject (readonly)

Returns the value of attribute last_name.



108
109
110
# File 'lib/howitzer/utils/data_generator/gen.rb', line 108

def last_name
  @last_name
end

#loginObject (readonly)

Returns the value of attribute login.



108
109
110
# File 'lib/howitzer/utils/data_generator/gen.rb', line 108

def 
  @login
end

#mailboxObject (readonly)

Returns the value of attribute mailbox.



108
109
110
# File 'lib/howitzer/utils/data_generator/gen.rb', line 108

def mailbox
  @mailbox
end

#passwordObject (readonly)

Returns the value of attribute password.



108
109
110
# File 'lib/howitzer/utils/data_generator/gen.rb', line 108

def password
  @password
end

Instance Method Details

#create_mailboxObject



121
122
123
124
# File 'lib/howitzer/utils/data_generator/gen.rb', line 121

def create_mailbox
  @mailbox = MailClient.create_mailbox(@email_name) if settings.mail_pop3_domain == @domain
  self
end

#delete_mailboxObject



126
127
128
# File 'lib/howitzer/utils/data_generator/gen.rb', line 126

def delete_mailbox
  MailClient.delete_mailbox(@mailbox) unless @mailbox.nil?
end