Class: ModernTreasury::ContentType
- Inherits:
-
Object
- Object
- ModernTreasury::ContentType
- Defined in:
- lib/modern_treasury/models/content_type.rb
Overview
Content-Type.
Constant Summary collapse
- CONTENT_TYPE =
[ # TODO: Write general description for ENUM_APPLICATIONJSON ENUM_APPLICATIONJSON = 'application/json'.freeze, # TODO: Write general description for ENUM_MULTIPARTFORMDATA ENUM_MULTIPARTFORMDATA = 'multipart/form-data'.freeze ].freeze
Class Method Summary collapse
Class Method Details
.from_value(value, default_value = ENUM_APPLICATIONJSON) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/modern_treasury/models/content_type.rb', line 23 def self.from_value(value, default_value = ENUM_APPLICATIONJSON) return default_value if value.nil? str = value.to_s.strip case str.downcase when 'enum_applicationjson' then ENUM_APPLICATIONJSON when 'enum_multipartformdata' then ENUM_MULTIPARTFORMDATA else default_value end end |
.validate(value) ⇒ Object
17 18 19 20 21 |
# File 'lib/modern_treasury/models/content_type.rb', line 17 def self.validate(value) return false if value.nil? CONTENT_TYPE.include?(value) end |