Class: VerifIP::EmailResponse
- Inherits:
-
Object
- Object
- VerifIP::EmailResponse
- Defined in:
- lib/verifip/models.rb
Overview
Response from an email risk check.
Constant Summary collapse
- FIELDS =
%i[ request_id email risk_score valid_syntax mx_found is_disposable is_free_provider is_role_based domain_age_days domain signal_breakdown error ].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ EmailResponse
constructor
A new instance of EmailResponse.
- #inspect ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ EmailResponse
Returns a new instance of EmailResponse.
128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/verifip/models.rb', line 128 def initialize(**kwargs) @request_id = kwargs.fetch(:request_id, "") @email = kwargs.fetch(:email, "") @risk_score = kwargs.fetch(:risk_score, 0) @valid_syntax = kwargs.fetch(:valid_syntax, false) @mx_found = kwargs.fetch(:mx_found, false) @is_disposable = kwargs.fetch(:is_disposable, false) @is_free_provider = kwargs.fetch(:is_free_provider, false) @is_role_based = kwargs.fetch(:is_role_based, false) @domain_age_days = kwargs.fetch(:domain_age_days, 0) @domain = kwargs.fetch(:domain, "") @signal_breakdown = kwargs.fetch(:signal_breakdown, {}) @error = kwargs.fetch(:error, nil) end |
Class Method Details
.from_hash(hash) ⇒ Object
143 144 145 146 |
# File 'lib/verifip/models.rb', line 143 def self.from_hash(hash) hash = _symbolize(hash) new(**hash.slice(*FIELDS)) end |
Instance Method Details
#inspect ⇒ Object
153 |
# File 'lib/verifip/models.rb', line 153 def inspect = to_s |
#to_h ⇒ Object
148 149 150 |
# File 'lib/verifip/models.rb', line 148 def to_h FIELDS.each_with_object({}) { |f, h| h[f] = send(f) } end |
#to_s ⇒ Object
152 |
# File 'lib/verifip/models.rb', line 152 def to_s = "EmailResponse(email=#{@email}, risk_score=#{@risk_score})" |