<commit_before># typed: false
# Creates the Uphold Cards for a publisher
class CreateUpholdCardsJob < ApplicationJob
  queue_as :default

  def perform(uphold_connection_id:)
    conn = UpholdConnection.find(uphold_connection_id)
    card = Uphold::FindOrCreateCardService.build.call(conn)
    return conn if card&.id == conn.address

    conn.update!(address: card.id)
    conn
  end
end<commit_msg>fix: Check response type (#3754)<commit_after># typed: false
# Creates the Uphold Cards for a publisher
class CreateUpholdCardsJob < ApplicationJob
  include Uphold::Types

  queue_as :default

  def perform(uphold_connection_id:)
    conn = UpholdConnection.find(uphold_connection_id)
    result = Uphold::FindOrCreateCardService.build.call(conn)

    case result
    when UpholdCard
      return conn if result&.id == conn.address
      conn.update!(address: result.id)
      conn
    end
  end
end
{'fraction_non_alphanumeric': 0.08, 'fraction_numerical': 0.0044444444444444444, 'mean_word_length': 4.208092485549133, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4022384', 'n_tokens_mistral': 293, 'n_tokens_neox': 279, 'n_words': 72}