<commit_before># rubocop:disable Style/StructInheritance
class RapidProCreateJob < Struct.new(:id)

  def enqueue(job)
    Rails.logger.info '[RapidProCreate] job enqueued'
    job.save!
  end

  def perform
    person = Person.find id
    if person&.phone_number.present?
      res = HTTParty.post('https://rapidpro.brl.nyc/api/v2/contacts.json',
        headers: { 'Authorization' => "Token #{ENV['RAPIDPRO_TOKEN']}",
                   'Content-Type'=> 'application/json' },
        body: { name: person.full_name,
                urns: ["tel:#{person.phone_number}"],
                language: 'eng',
                groups: [],
                fields: {
                  # first_name: person.first_name,
                  # last_name: person.last_name,
                  # email_address: person.email_address,
                  # zip_code: person.postal_code,
                  # neighborhood: person.neighborhood,
                  # patterns_token: person.token,
                  # patterns_id: person.id
                }}.to_json)
    case res.code
    when 400 # this person already exists in rapidpro
      Delayed::Job.enqueue(RapidProUpdateJob.new(id)).save
    else
      raise "error"
    end
  end

  def max_attempts
    5
  end

  def reschedule_at(current_time, attempts)
    current_time + (5 * attempts).seconds<commit_msg>oops syntaxfail<commit_after># rubocop:disable Style/StructInheritance
class RapidProCreateJob < Struct.new(:id)

  def enqueue(job)
    Rails.logger.info '[RapidProCreate] job enqueued'
    job.save!
  end

  def perform
    person = Person.find id
    if person&.phone_number.present?
      res = HTTParty.post('https://rapidpro.brl.nyc/api/v2/contacts.json',
        headers: { 'Authorization' => "Token #{ENV['RAPIDPRO_TOKEN']}",
                   'Content-Type'=> 'application/json' },
        body: { name: person.full_name,
                urns: ["tel:#{person.phone_number}"],
                language: 'eng',
                groups: [],
                fields: {
                  # first_name: person.first_name,
                  # last_name: person.last_name,
                  # email_address: person.email_address,
                  # zip_code: person.postal_code,
                  # neighborhood: person.neighborhood,
                  # patterns_token: person.token,
                  # patterns_id: person.id
                }}.to_json)
      case res.code
      when 400 # this person already exists in rapidpro
        Delayed::Job.enqueue(RapidProUpdateJob.new(id)).save
      else
        raise "error"
      end
    end
  end

  def max_attempts
    5
  end

  def reschedule_at(current_time, attempts)
    current_time + (5 * attempts).seconds
{'fraction_non_alphanumeric': 0.10759027266028003, 'fraction_numerical': 0.004421518054532056, 'mean_word_length': 1.9672131147540983, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4602321', 'n_tokens_mistral': 845, 'n_tokens_neox': 790, 'n_words': 159}