Class: Apical::JsonContentType

Inherits:
ContentType show all
Defined in:
lib/apical/content_types.rb

Instance Method Summary collapse

Methods inherited from ContentType

[], format

Instance Method Details

#generate(obj) ⇒ Object



28
29
30
# File 'lib/apical/content_types.rb', line 28

def generate(obj)
  JSON.pretty_generate(obj)
end

#headerObject



24
25
26
# File 'lib/apical/content_types.rb', line 24

def header
  'application/json'
end

#parse(str) ⇒ Object



32
33
34
# File 'lib/apical/content_types.rb', line 32

def parse(str)
  JSON.parse(str)
end

#to_sObject



36
37
38
# File 'lib/apical/content_types.rb', line 36

def to_s
  'json'
end