Class: EmailInquire::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email:) ⇒ Response

Returns a new instance of Response.



9
10
11
# File 'lib/email_inquire/response.rb', line 9

def initialize(email:)
  @email = email
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



6
7
8
# File 'lib/email_inquire/response.rb', line 6

def email
  @email
end

#replacementObject

Returns the value of attribute replacement.



7
8
9
# File 'lib/email_inquire/response.rb', line 7

def replacement
  @replacement
end

#statusObject

Returns the value of attribute status.



7
8
9
# File 'lib/email_inquire/response.rb', line 7

def status
  @status
end

Instance Method Details

#hint!(domain:) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/email_inquire/response.rb', line 13

def hint!(domain:)
  self.status = :hint

  old_name, _old_domain = email.split("@")
  self.replacement = "#{old_name}@#{domain}"

  self
end

#hint?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/email_inquire/response.rb', line 22

def hint?
  status.equal?(:hint)
end

#invalid!Object



26
27
28
29
30
# File 'lib/email_inquire/response.rb', line 26

def invalid!
  self.status = :invalid

  self
end

#invalid?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/email_inquire/response.rb', line 32

def invalid?
  status.equal?(:invalid)
end

#status?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/email_inquire/response.rb', line 36

def status?
  !status.nil?
end

#valid!Object



40
41
42
43
44
# File 'lib/email_inquire/response.rb', line 40

def valid!
  self.status = :valid

  self
end

#valid?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/email_inquire/response.rb', line 46

def valid?
  status.equal?(:valid)
end