Sha256: 29a289f95f15e367a3180bb5cd7a5ce28aa026e63326a49d7ebd2bd2d2e3ceb4
Contents?: true
Size: 840 Bytes
Versions: 6
Compression:
Stored size: 840 Bytes
Contents
# typed: true # frozen_string_literal: true module CleanArchitecture module Queries class HttpFailureCode def initialize(failure_details_type) @failure_details_type = failure_details_type end def to_sym code = FAILURE_DETAILS_TYPE_TO_STATUS_CODE[@failure_details_type.to_s.downcase] if code.nil? raise NotImplementedError, "cannot determine failure code for failure details type #{@failure_details_type}" end code end private FAILURE_DETAILS_TYPE_TO_STATUS_CODE = { 'error' => :internal_server_error, 'expectation_failed' => :expectation_failed, 'not_found' => :not_found, 'unauthorized' => :unauthorized, 'unprocessable_entity' => :unprocessable_entity }.freeze end end end
Version data entries
6 entries across 6 versions & 1 rubygems