Class: Praxis::MediaType
- Includes:
- Types::MediaTypeCommon
- Defined in:
- lib/praxis/media_type.rb
Overview
An Internet Media Type as defined in RFC 1590, as used in HTTP (see RFC 2616). As used in the Praxis framework, media types also define the structure and content of entities of that type: the attributes that exist, their names and types.
An object with a media type can be represented on the wire using different structured-syntax encodings; for example, a controller might respond with an actual Widget object, but a Content-Type header specifying ‘application/vnd.acme.widget+json’; Praxis uses the information contained in the media-type definition of Widget to transform the object into an equivalent JSON representation. The use of media types allows your application’s models to be decoupled from its HTTP interface specification.
A media type definition consists of:
- a MIME type identifier
- attributes, each of which has a name and a data type
- named views, which expose interesting subsets of attributes
Instance Attribute Summary
Attributes inherited from Blueprint
Method Summary
Methods inherited from Blueprint
#_cache_key, _finalize!, #_get_attr, as_json_schema, attributes, cache, cache=, caching_enabled=, caching_enabled?, check_option!, default_fieldset, define_attribute!, define_reader!, define_readers!, domain_model, dump, example, family, generate_default_fieldset!, inherited, #initialize, json_schema_type, load, new, parse_default_fieldset, #render, resolve_domain_model!, #to_h, valid_type?, validate, #validate, view
Methods included from Finalizable
#_finalize!, extended, #finalizable, #finalize!, #finalized?, #inherited
Constructor Details
This class inherits a constructor from Praxis::Blueprint