Module: FHTTPClient::Cache::HTTPResponseAnalyzer

Defined in:
lib/f_http_client/cache/http_response_analizer.rb

Constant Summary collapse

NOT_CACHEABLE_RESPONSES =
%i[
  server_error?
  gateway_timeout?
  request_timeout?
  unauthorized?
  too_many_requests?
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/f_http_client/cache/http_response_analizer.rb', line 6

def response
  @response
end

Class Method Details

.not_cacheable?(response) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
# File 'lib/f_http_client/cache/http_response_analizer.rb', line 21

def not_cacheable?(response)
  not_cacheable_responses.any? do |not_cacheable_response|
    response.public_send(not_cacheable_response)
  end
end

.not_cacheable_responsesObject



17
18
19
# File 'lib/f_http_client/cache/http_response_analizer.rb', line 17

def not_cacheable_responses
  NOT_CACHEABLE_RESPONSES
end