Class: HttpClientGenerator::Plugs::UnderscoreResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/http_client_generator/plugs/underscore_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(_) ⇒ UnderscoreResponse

Returns a new instance of UnderscoreResponse.



8
# File 'lib/http_client_generator/plugs/underscore_response.rb', line 8

def initialize(_); end

Instance Method Details

#call(req) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/http_client_generator/plugs/underscore_response.rb', line 10

def call(req)
  return req unless req.response_body.is_a?(Hash)

  req.response_body = req.response_body.deep_transform_keys(&:underscore)

  req
end