Class: Minfraud::HTTPService::Response
- Inherits:
-
Object
- Object
- Minfraud::HTTPService::Response
- Defined in:
- lib/minfraud/http_service/response.rb
Overview
Response class for HTTP requests.
Instance Attribute Summary collapse
-
#body ⇒ Minfraud::Model::Score, ...
readonly
HTTP response model.
-
#headers ⇒ Hash?
readonly
HTTP response headers.
-
#status ⇒ Integer?
readonly
HTTP response status.
Instance Method Summary collapse
-
#code ⇒ Symbol?
Return the minFraud-specific response code.
-
#initialize(params = {}) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(params = {}) ⇒ Response
Returns a new instance of Response.
30 31 32 33 34 35 36 37 38 |
# File 'lib/minfraud/http_service/response.rb', line 30 def initialize(params = {}) @status = params[:status] @body = make_body( params[:endpoint], params[:body], params[:locales] ) @headers = params[:headers] end |
Instance Attribute Details
#body ⇒ Minfraud::Model::Score, ... (readonly)
HTTP response model.
21 22 23 |
# File 'lib/minfraud/http_service/response.rb', line 21 def body @body end |
#headers ⇒ Hash? (readonly)
HTTP response headers.
26 27 28 |
# File 'lib/minfraud/http_service/response.rb', line 26 def headers @headers end |
#status ⇒ Integer? (readonly)
HTTP response status.
15 16 17 |
# File 'lib/minfraud/http_service/response.rb', line 15 def status @status end |
Instance Method Details
#code ⇒ Symbol?
Return the minFraud-specific response code.
43 44 45 46 47 |
# File 'lib/minfraud/http_service/response.rb', line 43 def code return nil if body.nil? body.code.intern if body.respond_to?(:code) && body.code end |