<commit_before>#TODO: replace with MultiJSON
require 'json'

class Callapi::Call::Response::Json < Callapi::Call::Response
  extend Memoist

  def parse
    to_hash
  end

  private

  def to_hash
    JSON.parse(body)
  end
  memoize :to_hash

  def error_message
    to_hash['error_message'] rescue super
  end
end<commit_msg>use MultiJson<commit_after>require 'multi_json'

class Callapi::Call::Response::Json < Callapi::Call::Response
  def parse
    to_hash
  end

  private

  def to_hash
    @to_hash ||= MultiJson.load(body)
  end
  #TODO: remove Memoist

  def error_message
    to_hash['error_message'] rescue super
  end
end
{'fraction_non_alphanumeric': 0.08675078864353312, 'fraction_numerical': 0.0, 'mean_word_length': 4.0396825396825395, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7638788', 'n_tokens_mistral': 222, 'n_tokens_neox': 215, 'n_words': 54}