<commit_before>module GData
  module Client

    class C2dm < Base

      # Google auth token.
      attr_accessor :token

      # Url to which c2dmessage has to be sent.
      attr_accessor :c2dm_url

      def initialize(options = {})
        options[:clientlogin_service] ||= 'ac2dm'
        super(options)

        @c2dm_url = "https://android.apis.google.com/c2dm/send"
      end

      # Set the clientlogin token if present.
      def set_clientlogin_token(auth_token)
        @token = auth_token
      end

      def send_c2dmessage(registration_id, collapse_key, data, delay_while_idle, auth_token)
        body = Hash.new
        body["registration_id"] = registration_id
        body["collapse_key"] = collapse_key
        body["data.message"] = data
        body["delay_while_idle"] = delay_while_idle if delay_while_idle
        body["AUTH_TOKEN"] = auth_token

        self.make_request(:post, @c2dm_url, body)
      end
    end
  end
end<commit_msg>Modified to send Auth Token in the form of header.<commit_after>module GData
  module Client

    class C2dm < Base

      # Google auth token.
      attr_accessor :token

      # Url to which c2dmessage has to be sent.
      attr_accessor :c2dm_url

      def initialize(options = {})
        options[:clientlogin_service] ||= 'ac2dm'
        super(options)

        @c2dm_url = "https://android.apis.google.com/c2dm/send"
      end

      # Set the clientlogin token if present.
      def set_clientlogin_token(auth_token)
        @token = auth_token
      end

      def send_c2dmessage(registration_id, collapse_key, delay_while_idle, data_hash)
        body = data_hash
        body["registration_id"] = registration_id
        body["collapse_key"] = collapse_key
        body["delay_while_idle"] = delay_while_idle if delay_while_idle
        body["AUTH_TOKEN"] = auth_token

        self.make_request(:post, @c2dm_url, body)
      end

      def prepare_headers
        headers = super.prepare_headers
        headers['Authorization: GoogleLogin auth'] = @token
        headers
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08188824662813102, 'fraction_numerical': 0.007707129094412331, 'mean_word_length': 2.5504273504273502, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5805357', 'n_tokens_mistral': 645, 'n_tokens_neox': 636, 'n_words': 151}