Class: ParallelBatchApi::ErrorResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/parallel_batch_api/error_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/parallel_batch_api/error_response.rb', line 3

def code
  @code
end

#errorObject (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

#bodyObject



14
15
16
# File 'lib/parallel_batch_api/error_response.rb', line 14

def body
  { message: error.message }
end

#executeObject



10
11
12
# File 'lib/parallel_batch_api/error_response.rb', line 10

def execute
  [code,  { 'Content-Type' => 'application/json' }, [body.to_json]]
end