<commit_before>module Qblox
  module Api
    # Message API
    # http://quickblox.com/developers/Chat#Retrieve_messages
    class Message < Connections::ApiEndpoint
      include RequireUserSession
      @path = 'chat/Message'

      def create(data = {})
        @params = data
        validate_params(@params)
        response = query(:post) do |req|
          req.params = @params
        end
        json_parse(response.body)
      end

      def index(chat_dialog_id, options = {})
        result = options.delete(:result)
        all = options.delete(:all) || true
        count = options.delete(:count)

        response = query(:get) do |req|<commit_msg>Change create message to json body<commit_after>module Qblox
  module Api
    # Message API
    # http://quickblox.com/developers/Chat#Retrieve_messages
    class Message < Connections::ApiEndpoint
      include RequireUserSession
      @path = 'chat/Message'

      def create(data = {})
        @params = data
        validate_params(@params)
        response = query(:post) do |req|
          req.headers = headers.merge('Content-Type' => 'application/json')
          req.body = JSON.dump(options)
        end
        json_parse(response.body)
      end

      def index(chat_dialog_id, options = {})
        result = options.delete(:result)
        all = options.delete(:all) || true
        count = options.delete(:count)

        response = query(:get) do |req|
{'fraction_non_alphanumeric': 0.10979020979020979, 'fraction_numerical': 0.0, 'mean_word_length': 2.407142857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3361190', 'n_tokens_mistral': 404, 'n_tokens_neox': 400, 'n_words': 91}