Class: VerifIP::ReportResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/verifip/models.rb

Overview

Response from a fraud report submission.

Constant Summary collapse

FIELDS =
%i[request_id status message].freeze

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ ReportResponse

Returns a new instance of ReportResponse.



297
298
299
300
301
# File 'lib/verifip/models.rb', line 297

def initialize(**kwargs)
  @request_id = kwargs.fetch(:request_id, "")
  @status     = kwargs.fetch(:status, "")
  @message    = kwargs.fetch(:message, "")
end

Class Method Details

.from_hash(hash) ⇒ Object



303
304
305
306
# File 'lib/verifip/models.rb', line 303

def self.from_hash(hash)
  hash = _symbolize(hash)
  new(**hash.slice(*FIELDS))
end

Instance Method Details

#inspectObject



313
# File 'lib/verifip/models.rb', line 313

def inspect = to_s

#to_hObject



308
309
310
# File 'lib/verifip/models.rb', line 308

def to_h
  FIELDS.each_with_object({}) { |f, h| h[f] = send(f) }
end

#to_sObject



312
# File 'lib/verifip/models.rb', line 312

def to_s = "ReportResponse(status=#{@status}, message=#{@message})"