Class: CleanArchitecture::Queries::HttpFailureCode

Inherits:
Object
  • Object
show all
Defined in:
lib/clean_architecture/queries/http_failure_code.rb

Instance Method Summary collapse

Constructor Details

#initialize(failure_details_type) ⇒ HttpFailureCode

Returns a new instance of HttpFailureCode.



7
8
9
# File 'lib/clean_architecture/queries/http_failure_code.rb', line 7

def initialize(failure_details_type)
  @failure_details_type = failure_details_type
end

Instance Method Details

#to_symObject



11
12
13
14
15
16
17
18
19
# File 'lib/clean_architecture/queries/http_failure_code.rb', line 11

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