Class: Visor::Image::GetImages
- Inherits:
-
Goliath::API
- Object
- Goliath::API
- Visor::Image::GetImages
- Includes:
- Common::Exception, Common::Util
- Defined in:
- lib/image/routes/get_images.rb
Overview
Get brief information about all public images.
Instance Method Summary collapse
-
#exit_error(code, message) ⇒ Array
Produce an HTTP response with an error code and message.
-
#on_headers(env, headers) ⇒ Object
Pre-process headers as they arrive and load them into a environment variable.
-
#response(env) ⇒ Array
Query database to retrieve public images brief meta and return it in request body.
Instance Method Details
#exit_error(code, message) ⇒ Array
Produce an HTTP response with an error code and message.
50 51 52 53 |
# File 'lib/image/routes/get_images.rb', line 50 def exit_error(code, ) logger.error [code, {}, {code: code, message: }] end |
#on_headers(env, headers) ⇒ Object
Pre-process headers as they arrive and load them into a environment variable.
18 19 20 21 |
# File 'lib/image/routes/get_images.rb', line 18 def on_headers(env, headers) logger.debug "Received headers: #{headers.inspect}" env['headers'] = headers end |
#response(env) ⇒ Array
Query database to retrieve public images brief meta and return it in request body.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/image/routes/get_images.rb', line 30 def response(env) access_key = (env, vas) = vms.get_images(params, access_key) env.params.delete('format') [200, {}, {images: }] rescue Forbidden => e exit_error(403, e.) rescue NotFound => e exit_error(404, e.) rescue InternalError => e exit_error(503, e.) end |