Module: ActiveResource::Formats::JsonAPIFormat

Defined in:
lib/esp/extensions/active_resource/formats/json_api_format.rb

Class Method Summary collapse

Class Method Details

.decode(json) ⇒ Object



39
40
41
42
# File 'lib/esp/extensions/active_resource/formats/json_api_format.rb', line 39

def decode(json)
  # pp ActiveSupport::JSON.decode(json), index: false, indent: -2
  Formats.remove_root(parse_json_api(ActiveSupport::JSON.decode(json)))
end

.encode(hash, options = nil) ⇒ Object



35
36
37
# File 'lib/esp/extensions/active_resource/formats/json_api_format.rb', line 35

def encode(hash, options = nil)
  ActiveSupport::JSON.encode(hash, options)
end

.extensionObject



27
28
29
# File 'lib/esp/extensions/active_resource/formats/json_api_format.rb', line 27

def extension
  "json".freeze
end

.mime_typeObject



31
32
33
# File 'lib/esp/extensions/active_resource/formats/json_api_format.rb', line 31

def mime_type
  "application/vnd.api+json".freeze
end