Class: Praxis::MediaType

Inherits:
Blueprint
  • Object
show all
Defined in:
lib/praxis/media_type.rb

Direct Known Subclasses

MediaTypeCollection

Defined Under Namespace

Classes: DSLCompiler

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.attributes(opts = {}, &block) ⇒ Object



29
30
31
# File 'lib/praxis/media_type.rb', line 29

def self.attributes(opts={}, &block)
  super(opts.merge(dsl_compiler: MediaType::DSLCompiler), &block)
end

.describe(shallow = false) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/praxis/media_type.rb', line 21

def self.describe(shallow = false)
  hash = super
  unless shallow
    hash.merge!(identifier: @identifier, description: @description)
  end
  hash
end

.description(text = nil) ⇒ Object



10
11
12
13
# File 'lib/praxis/media_type.rb', line 10

def self.description(text=nil)
  @description = text if text
  @description
end

.identifier(identifier = nil) ⇒ Object



15
16
17
18
19
# File 'lib/praxis/media_type.rb', line 15

def self.identifier(identifier=nil)
  return @identifier unless identifier
  # TODO: parse the string and extract things like collection , and format type?...
  @identifier = identifier
end

Instance Method Details



33
34
35
# File 'lib/praxis/media_type.rb', line 33

def links
  self.class::Links.new(@object)
end