Class: ParallelBatchApi::ErrorResponse
- Inherits:
-
Object
- Object
- ParallelBatchApi::ErrorResponse
- Defined in:
- lib/parallel_batch_api/error_response.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #body ⇒ Object
- #execute ⇒ Object
-
#initialize(error) ⇒ ErrorResponse
constructor
A new instance of ErrorResponse.
Constructor Details
#initialize(error) ⇒ ErrorResponse
Returns a new instance of ErrorResponse.
5 6 7 8 |
# File 'lib/parallel_batch_api/error_response.rb', line 5 def initialize(error) @error = error @code = @error.status_code if @error.respond_to?(:status_code) end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/parallel_batch_api/error_response.rb', line 3 def code @code end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
3 4 5 |
# File 'lib/parallel_batch_api/error_response.rb', line 3 def error @error end |
Instance Method Details
#body ⇒ Object
14 15 16 |
# File 'lib/parallel_batch_api/error_response.rb', line 14 def body { message: error. } end |
#execute ⇒ Object
10 11 12 |
# File 'lib/parallel_batch_api/error_response.rb', line 10 def execute [code, { 'Content-Type' => 'application/json' }, [body.to_json]] end |