Sha256: c8b5b6ac43f9771efbdc5a8922774ae6eec9c3f032baeeed42584b0d93b29326
Contents?: true
Size: 792 Bytes
Versions: 2
Compression:
Stored size: 792 Bytes
Contents
# typed: strict # frozen_string_literal: true module CleanArchitecture module Queries class HttpSuccessCode extend T::Sig sig { params(http_method: String).void } def initialize(http_method) @http_method = http_method end sig { returns(Symbol) } def to_sym code = HTTP_METHOD_TO_SUCCESS_CODE[@http_method.to_s.upcase] if code.nil? raise NotImplementedError, "cannot determine success code for HTTP method #{@http_method}" end code end private HTTP_METHOD_TO_SUCCESS_CODE = T.let( { 'GET' => :ok, 'POST' => :created, 'PUT' => :accepted, 'DELETE' => :ok }.freeze, T::Hash[String, Symbol] ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
clean-architecture-6.1.0 | lib/clean_architecture/queries/http_success_code.rb |
clean-architecture-6.0.0 | lib/clean_architecture/queries/http_success_code.rb |