Class: ParallelBatchApi::Response
- Inherits:
-
Object
- Object
- ParallelBatchApi::Response
- Defined in:
- lib/parallel_batch_api/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(res, url, params) ⇒ Response
constructor
A new instance of Response.
- #key ⇒ Object
Constructor Details
#initialize(res, url, params) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 |
# File 'lib/parallel_batch_api/response.rb', line 5 def initialize(res, url, params) @status, @header, @body = res @url = url @params = params end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/parallel_batch_api/response.rb', line 3 def body @body end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
3 4 5 |
# File 'lib/parallel_batch_api/response.rb', line 3 def header @header end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/parallel_batch_api/response.rb', line 3 def params @params end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/parallel_batch_api/response.rb', line 3 def status @status end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/parallel_batch_api/response.rb', line 3 def url @url end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 |
# File 'lib/parallel_batch_api/response.rb', line 11 def execute base_body = '' body.each { |str| base_body << str } { status: status, header: header, body: JSON.parse(base_body), url: url, key: key } end |
#key ⇒ Object
17 18 19 |
# File 'lib/parallel_batch_api/response.rb', line 17 def key "#{params[:controller]}##{params[:action]}" end |