Class: Truelist::Result
- Inherits:
-
Object
- Object
- Truelist::Result
- Defined in:
- lib/truelist/result.rb
Instance Attribute Summary collapse
-
#canonical ⇒ Object
readonly
Returns the value of attribute canonical.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#mx_record ⇒ Object
readonly
Returns the value of attribute mx_record.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#sub_state ⇒ Object
readonly
Returns the value of attribute sub_state.
-
#suggestion ⇒ Object
readonly
Returns the value of attribute suggestion.
-
#verified_at ⇒ Object
readonly
Returns the value of attribute verified_at.
Instance Method Summary collapse
- #accept_all? ⇒ Boolean
- #disposable? ⇒ Boolean
- #error? ⇒ Boolean
-
#initialize(email:, state:, sub_state: nil, suggestion: nil, domain: nil, canonical: nil, mx_record: nil, first_name: nil, last_name: nil, verified_at: nil, error: false) ⇒ Result
constructor
A new instance of Result.
- #invalid? ⇒ Boolean
- #role? ⇒ Boolean
- #unknown? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(email:, state:, sub_state: nil, suggestion: nil, domain: nil, canonical: nil, mx_record: nil, first_name: nil, last_name: nil, verified_at: nil, error: false) ⇒ Result
Returns a new instance of Result.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/truelist/result.rb', line 8 def initialize(email:, state:, sub_state: nil, suggestion: nil, domain: nil, canonical: nil, mx_record: nil, first_name: nil, last_name: nil, verified_at: nil, error: false) @email = email @state = state.to_s @sub_state = sub_state&.to_s @suggestion = suggestion @domain = domain @canonical = canonical @mx_record = mx_record @first_name = first_name @last_name = last_name @verified_at = verified_at @error = error end |
Instance Attribute Details
#canonical ⇒ Object (readonly)
Returns the value of attribute canonical.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def canonical @canonical end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def domain @domain end |
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def email @email end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def error @error end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def first_name @first_name end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def last_name @last_name end |
#mx_record ⇒ Object (readonly)
Returns the value of attribute mx_record.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def mx_record @mx_record end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def state @state end |
#sub_state ⇒ Object (readonly)
Returns the value of attribute sub_state.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def sub_state @sub_state end |
#suggestion ⇒ Object (readonly)
Returns the value of attribute suggestion.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def suggestion @suggestion end |
#verified_at ⇒ Object (readonly)
Returns the value of attribute verified_at.
5 6 7 |
# File 'lib/truelist/result.rb', line 5 def verified_at @verified_at end |
Instance Method Details
#accept_all? ⇒ Boolean
31 32 33 |
# File 'lib/truelist/result.rb', line 31 def accept_all? state == 'accept_all' end |
#disposable? ⇒ Boolean
39 40 41 |
# File 'lib/truelist/result.rb', line 39 def disposable? sub_state == 'is_disposable' end |
#error? ⇒ Boolean
47 48 49 |
# File 'lib/truelist/result.rb', line 47 def error? @error end |
#invalid? ⇒ Boolean
27 28 29 |
# File 'lib/truelist/result.rb', line 27 def invalid? state == 'email_invalid' end |
#role? ⇒ Boolean
43 44 45 |
# File 'lib/truelist/result.rb', line 43 def role? sub_state == 'is_role' end |
#unknown? ⇒ Boolean
35 36 37 |
# File 'lib/truelist/result.rb', line 35 def unknown? state == 'unknown' end |
#valid? ⇒ Boolean
23 24 25 |
# File 'lib/truelist/result.rb', line 23 def valid? state == 'ok' || (state == 'accept_all' && Truelist.configuration.allow_risky) end |