Module: Core::Endpoint::BasicHandler::Associations::HasFile
- Included in:
- Core::Endpoint::BasicHandler
- Defined in:
- app/api/core/endpoint/basic_handler/associations/has_file.rb
Instance Method Summary collapse
- #content_type(content_type) ⇒ Object
- #file_through(content_types) ⇒ Object
- #has_file(options) ⇒ Object
Instance Method Details
#content_type(content_type) ⇒ Object
9 10 11 12 13 |
# File 'app/api/core/endpoint/basic_handler/associations/has_file.rb', line 9 def content_type(content_type) return nil if @supported_types.blank? @supported_types[content_type] end |
#file_through(content_types) ⇒ Object
15 16 17 |
# File 'app/api/core/endpoint/basic_handler/associations/has_file.rb', line 15 def file_through(content_types) content_type(content_types.detect { |ct| content_type(ct) }) end |
#has_file(options) ⇒ Object
3 4 5 6 7 |
# File 'app/api/core/endpoint/basic_handler/associations/has_file.rb', line 3 def has_file() ::Api::EndpointHandler.register_mimetype([:content_type]) @supported_types ||= {} @supported_types[[:content_type]] = [:as] || :retrieve_file end |