module HTTPX::Transcoder::JSON

  1. lib/httpx/transcoder/json.rb

Methods

Public Instance

  1. decode
  2. encode
  3. json_dump
  4. json_load

Classes and Modules

  1. HTTPX::Transcoder::JSON::Encoder

Constants

JSON_REGEX = %r{\bapplication/(?:vnd\.api\+|hal\+)?json\b}i.freeze  

Public Instance methods

decode(response)
[show source]
   # File lib/httpx/transcoder/json.rb
32 def decode(response)
33   content_type = response.content_type.mime_type
34 
35   raise HTTPX::Error, "invalid json mime type (#{content_type})" unless JSON_REGEX.match?(content_type)
36 
37   method(:json_load)
38 end
encode(json)
[show source]
   # File lib/httpx/transcoder/json.rb
28 def encode(json)
29   Encoder.new(json)
30 end
json_dump(*args)
[show source]
   # File lib/httpx/transcoder/json.rb
43 def json_dump(*args); MultiJson.dump(*args); end
json_load(*args)
[show source]
   # File lib/httpx/transcoder/json.rb
42 def json_load(*args); MultiJson.load(*args); end