class Gitlab::Request

def self.decode(response)

Decodes a JSON response into Ruby object.
def self.decode(response)
  response ? JSON.load(response) : {}
rescue JSON::ParserError
  raise Error::Parsing, 'The response is not a valid JSON'
end