Class: ElephantInTheRoom::TheOneApiSdk::Pipeline::ResponseBody

Inherits:
Object
  • Object
show all
Defined in:
lib/elephant_in_the_room/the_one_api_sdk/pipeline/response_body.rb

Overview

Pipeline stage to get body content from HTTP response

Instance Method Summary collapse

Constructor Details

#initialize(next_pipeline_stage) ⇒ ResponseBody

Returns a new instance of ResponseBody.



7
8
9
# File 'lib/elephant_in_the_room/the_one_api_sdk/pipeline/response_body.rb', line 7

def initialize(next_pipeline_stage)
  @next_pipeline_stage = next_pipeline_stage
end

Instance Method Details

#execute_http_request(request_details) ⇒ Object



11
12
13
# File 'lib/elephant_in_the_room/the_one_api_sdk/pipeline/response_body.rb', line 11

def execute_http_request(request_details)
  @next_pipeline_stage.execute_http_request(request_details)
end

#http_bodyObject



15
16
17
18
19
20
# File 'lib/elephant_in_the_room/the_one_api_sdk/pipeline/response_body.rb', line 15

def http_body
  body = @next_pipeline_stage.http_response.body
  raise ElephantInTheRoom::TheOneApiSdk::Errors::NoContentError, "Server response was empty" if body.empty?

  body
end