Class: EnvatoOptimiser::ImageResponseStatusCodeCheck

Inherits:
Checks
  • Object
show all
Defined in:
lib/envato_optimiser/checks/image_response_status_code_check.rb

Instance Method Summary collapse

Constructor Details

#initialize(image_urls) ⇒ Nothing

Initialize an image response status code check.

Parameters:

  • image_urls (Array)

    Image URLs that you would like to check the HTTP response status codes for.



9
10
11
12
13
14
15
16
# File 'lib/envato_optimiser/checks/image_response_status_code_check.rb', line 9

def initialize(image_urls)
  @redirects    = []
  @not_found    = []
  @forbidden    = []
  @server_error = []

  fetch_image_responses(image_urls)
end

Instance Method Details

#to_hHash

Format the image response status code results into a usable Hash.

Returns:

  • (Hash)


21
22
23
24
25
26
27
28
# File 'lib/envato_optimiser/checks/image_response_status_code_check.rb', line 21

def to_h
  {
    :image_redirect_count     => redirect_count,
    :image_not_found_count    => not_found_count,
    :image_forbidden_count    => forbidden_count,
    :image_server_error_count => server_error_count,
  }
end