Sha256: 1562163fa9161b9429f375f94f9ca9a2a59796ee55381c2cfaf8d14e6e7ae3a6
Contents?: true
Size: 599 Bytes
Versions: 5
Compression:
Stored size: 599 Bytes
Contents
# frozen_string_literal: true module CleanArchitecture module Queries class HttpSuccessCode def initialize(http_method) @http_method = http_method end def to_sym code = HTTP_METHOD_TO_SUCCESS_CODE[@http_method] if code.nil? raise NotImplementedError, "cannot determine success code for HTTP method #{@http_method}" end code end private HTTP_METHOD_TO_SUCCESS_CODE = { 'GET' => :ok, 'POST' => :created, 'PUT' => :accepted, 'DELETE' => :ok }.freeze end end end
Version data entries
5 entries across 5 versions & 1 rubygems