<commit_before>module J7W1
  module PushClient
    def self.create_sns_client(configuration = J7W1.configuration)
      AWS::SNS.new J7W1.configuration.account
    end

    def push(terminal, options = {})
      message = options[:message]
      badge = options[:badge]
      sound = options[:sound]
      sns_configuration = options[:sns_configuration]

      return unless endpoint = terminal.sns_arn

      message_value = {}
      message_value.merge!(alert: message) unless message.blank?
      message_value.merge!(badge: badge) unless badge.blank?
      message_value.merge!(sound: sound) unless sound.blank?


      payload = payload_for(message_value, endpoint.platform)
      J7W1.create_sns(sns_configuration || J7W1.configuration).sns.client.publish(
          target_arn: endpoint.arn,
          message: payload.to_json,
          message_structure: 'json',
      )
    end
<commit_msg>Now The client can accept sns client externally initialized.<commit_after>module J7W1
  module PushClient
    def self.create_sns_client(configuration = J7W1.configuration)
      AWS::SNS.new J7W1.configuration.account
    end

    def push(terminal, options = {})
      message = options[:message]
      badge = options[:badge]
      sound = options[:sound]
      sns_configuration = options[:sns_configuration]
      sns_client = options[:sns_client]

      return unless endpoint = terminal.sns_arn

      message_value = {}
      message_value.merge!(alert: message) unless message.blank?
      message_value.merge!(badge: badge) unless badge.blank?
      message_value.merge!(sound: sound) unless sound.blank?


      payload = payload_for(message_value, endpoint.platform)

      sns_client = J7W1.create_sns(sns_configuration || J7W1.configuration)
      sns_client.sns.client.publish(
          target_arn: endpoint.arn,
          message: payload.to_json,
          message_structure: 'json',
      )
    end

{'fraction_non_alphanumeric': 0.09384775808133472, 'fraction_numerical': 0.010427528675703858, 'mean_word_length': 3.199124726477024, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5865120', 'n_tokens_mistral': 580, 'n_tokens_neox': 563, 'n_words': 112}