Class: Pragma::Operation::Response::ServiceUnavailable

Inherits:
Pragma::Operation::Response show all
Defined in:
lib/pragma/operation/response/service_unavailable.rb

Overview

Represents the 503 Service Unavailable HTTP response.

Constant Summary

Constants inherited from Pragma::Operation::Response

STATUSES

Instance Attribute Summary

Attributes inherited from Pragma::Operation::Response

#entity, #headers, #status

Instance Method Summary collapse

Methods inherited from Pragma::Operation::Response

#decorate_with, #failure?, #success?

Constructor Details

#initialize(entity: Error.new( error_type: :service_unavailable, error_message: 'This resource is not available right now. Try later.' ), headers: {}) ⇒ ServiceUnavailable

Initializes the response.

Parameters:

  • entity (Object) (defaults to: Error.new( error_type: :service_unavailable, error_message: 'This resource is not available right now. Try later.' ))

    the response’s entity

  • headers (Hash) (defaults to: {})

    the response’s headers



12
13
14
15
16
17
18
19
20
# File 'lib/pragma/operation/response/service_unavailable.rb', line 12

def initialize(
  entity: Error.new(
    error_type: :service_unavailable,
    error_message: 'This resource is not available right now. Try later.'
  ),
  headers: {}
)
  super(status: 503, entity: entity, headers: headers)
end