<commit_before>module MonkeyParty
  class List < Base
    include HappyMapper
    tag "struct"

    element :id, String
    element :web_id, String
    element :name, String
    element :date_created, Time
    element :member_count, Integer

    def create_subscribers(array_of_subscribers, options = {})
      options[:double_optin]      ||= true
      options[:update_existing]   ||= false
      options[:replace_interests] ||= true
      
      batch_hash = {}
      index = 0
      array_of_subscribers.each do |s|
        batch_hash["batch[#{index}]"] = s.to_mailchimp_hash
        index += 1
      end

      response = self.class.get("", :query => {
         :apikey            => self.class.api_key,
         :id                => self.id,
         :method            => "listBatchSubscribe",
      }.merge(options).merge(batch_hash))

      #response[1] is the error count
      if !response["MCAPI"].nil? && response["MCAPI"][1] > 0
        attach_errors_to_subscribers(array_of_subscribers, response.body)
      end

      array_of_subscribers
    end

    def destroy_subscribers(array_of_unsubscribers, options = {})
      options[:delete_member] ||= false
      options[:send_goodbye]  ||= true
      options[:send_notify]   ||= false

      batch_hash = {}
      index = 0
      array_of_unsubscribers.each do |s|
        batch_hash["emails[#{index}]"] = s.email
      end

      response = self.class.get("", :query => {
        :apikey => self.class.api_key,
        :id => self.id,
        :method => "listBatchUnsubscribe"
      }.merge(options).merge(batch_hash))

      if !response["MCAPI"].nil? && response["MCAPI"][1] > 0
        attach_errors_to_subscribers(array_of_unsubscribers, response.body)
      end<commit_msg>fixing default options ||= true for a false object will assign<commit_after>module MonkeyParty
  class List < Base
    include HappyMapper
    tag "struct"

    element :id, String
    element :web_id, String
    element :name, String
    element :date_created, Time
    element :member_count, Integer

    def create_subscribers(array_of_subscribers, options = {})
      options = {
        :double_optin => true,
        :update_existing => false,
        :replace_interests => true
      }.merge(options)
      
      batch_hash = {}
      index = 0
      array_of_subscribers.each do |s|
        batch_hash["batch[#{index}]"] = s.to_mailchimp_hash
        index += 1
      end

      response = self.class.get("", :query => {
         :apikey            => self.class.api_key,
         :id                => self.id,
         :method            => "listBatchSubscribe",
      }.merge(options).merge(batch_hash))

      #response[1] is the error count
      if !response["MCAPI"].nil? && response["MCAPI"][1] > 0
        attach_errors_to_subscribers(array_of_subscribers, response.body)
      end

      array_of_subscribers
    end

    def destroy_subscribers(array_of_unsubscribers, options = {})
      options = {
        :delete_member => false,
        :send_goodbye  => true,
        :send_notify   => false
      }.merge(options)

      batch_hash = {}
      index = 0
      array_of_unsubscribers.each do |s|
        batch_hash["emails[#{index}]"] = s.email
      end

      response = self.class.get("", :query => {
        :apikey => self.class.api_key,
        :id => self.id,
        :method => "listBatchUnsubscribe"
      }.merge(options).merge(batch_hash))

      if !response["MCAPI"].nil? && response["MCAPI"][1] > 0
        attach_errors_to_subscribers(array_of_unsubscribers, response.body)
      end
{'fraction_non_alphanumeric': 0.12142456533931575, 'fraction_numerical': 0.00448681996634885, 'mean_word_length': 2.3971428571428572, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '6684816', 'n_tokens_mistral': 1139, 'n_tokens_neox': 1112, 'n_words': 218}