Class: RestPack::Service::Response::Status
- Inherits:
-
Object
- Object
- RestPack::Service::Response::Status
- Defined in:
- lib/restpack_service/response.rb
Constant Summary collapse
- @@map =
{ 200 => :ok, 401 => :unauthorized, 403 => :forbidden, 404 => :not_found, 422 => :unprocessable_entity, 500 => :internal_service_error }
Class Method Summary collapse
Class Method Details
.from_code(code) ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/restpack_service/response.rb', line 49 def self.from_code(code) if @@map.has_key?(code) @@map[code] else raise "Invalid Status Code: #{code}" end end |
.from_status(status) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/restpack_service/response.rb', line 57 def self.from_status(status) if @@map.has_value?(status) @@map.key(status) else raise "Invalid Status: #{status}" end end |