Class: VerifIP::AssessResponse
- Inherits:
-
Object
- Object
- VerifIP::AssessResponse
- Defined in:
- lib/verifip/models.rb
Overview
Response from a multi-signal risk assessment.
Constant Summary collapse
- FIELDS =
%i[request_id overall_risk ip email phone url].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**kwargs) ⇒ AssessResponse
constructor
A new instance of AssessResponse.
- #inspect ⇒ Object
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ AssessResponse
Returns a new instance of AssessResponse.
327 328 329 330 331 332 333 334 |
# File 'lib/verifip/models.rb', line 327 def initialize(**kwargs) @request_id = kwargs.fetch(:request_id, "") @overall_risk = kwargs.fetch(:overall_risk, 0) @ip = kwargs.fetch(:ip, nil) @email = kwargs.fetch(:email, nil) @phone = kwargs.fetch(:phone, nil) @url = kwargs.fetch(:url, nil) end |
Class Method Details
.from_hash(hash) ⇒ Object
336 337 338 339 340 341 342 343 |
# File 'lib/verifip/models.rb', line 336 def self.from_hash(hash) hash = _symbolize(hash) hash[:ip] = CheckResponse.from_hash(hash[:ip]) if hash[:ip].is_a?(Hash) hash[:email] = EmailResponse.from_hash(hash[:email]) if hash[:email].is_a?(Hash) hash[:phone] = PhoneResponse.from_hash(hash[:phone]) if hash[:phone].is_a?(Hash) hash[:url] = URLResponse.from_hash(hash[:url]) if hash[:url].is_a?(Hash) new(**hash.slice(*FIELDS)) end |
Instance Method Details
#inspect ⇒ Object
350 |
# File 'lib/verifip/models.rb', line 350 def inspect = to_s |
#to_h ⇒ Object
345 346 347 |
# File 'lib/verifip/models.rb', line 345 def to_h FIELDS.each_with_object({}) { |f, h| h[f] = send(f) } end |
#to_s ⇒ Object
349 |
# File 'lib/verifip/models.rb', line 349 def to_s = "AssessResponse(overall_risk=#{@overall_risk})" |