<commit_before>require_relative '../model'
require 'spaceship/test_flight/build'
module Spaceship
  class ConnectAPI
    class Build
      include Spaceship::ConnectAPI::Model

      attr_accessor :version
      attr_accessor :uploaded_date
      attr_accessor :expiration_date
      attr_accessor :expired
      attr_accessor :min_os_version
      attr_accessor :icon_asset_token
      attr_accessor :processing_state
      attr_accessor :uses_non_exempt_encryption

      attr_accessor :app
      attr_accessor :beta_app_review_submission
      attr_accessor :beta_build_metrics
      attr_accessor :build_beta_detail
      attr_accessor :pre_release_version

      attr_mapping({
        "version" => "version",
        "uploadedDate" => "uploaded_date",
        "expirationDate" => "expiration_date",
        "expired" => "expired",
        "minOsVersion" => "min_os_version",
        "iconAssetToken" => "icon_asset_token",
        "processingState" => "processing_state",
        "usesNonExemptEncryption" => "uses_non_exempt_encryption",

        "app" => "app",
        "betaAppReviewSubmission" => "beta_app_review_submission",
        "betaBuildMetrics" => "beta_build_metrics",
        "buildBetaDetail" => "build_beta_detail",
        "preReleaseVersion" => "pre_release_version"
      })

      ESSENTIAL_INCLUDES = "app,buildBetaDetail,preReleaseVersion"

      module ProcessingState
        PROCESSING = "PROCESSING"
        FAILED = "FAILED"
        INVALID = "INVALID"
        VALID = "VALID"
      end

      def self.type
        return "builds"
      end

      #
      # Helpers
      #

      def app_version
        raise "No pre_release_version included" unless pre_release_version
        return pre_release_version.version
      end

      def app_id
        raise "No app included" unless app
        return app.id
      end

      def bundle_id
        raise "No app included" unless app
        return app.bundle_id
      end

      def platform
        raise "No pre_release_version included" unless pre_release_version
        return pre_release_version.platform
      end

      def processed?
        return processing_state != ProcessingState::PROCESSING
      end

      def ready_for_internal_testing?
        raise "No build_beta_detail included" unless build_beta_detail
        return build_beta_detail.ready_for_internal_testing?
      end

      def ready_for_beta_submission?
        raise "No build_beta_detail included" unless build_beta_detail
        return build_beta_detail.ready_for_beta_submission?
      end

      # This is here temporarily until the removal of Spaceship::TestFlight
      def to_testflight_build
        h = {<commit_msg>Removes raising exception when build_beta_detail is nil (#16068)<commit_after>require_relative '../model'
require 'spaceship/test_flight/build'
module Spaceship
  class ConnectAPI
    class Build
      include Spaceship::ConnectAPI::Model

      attr_accessor :version
      attr_accessor :uploaded_date
      attr_accessor :expiration_date
      attr_accessor :expired
      attr_accessor :min_os_version
      attr_accessor :icon_asset_token
      attr_accessor :processing_state
      attr_accessor :uses_non_exempt_encryption

      attr_accessor :app
      attr_accessor :beta_app_review_submission
      attr_accessor :beta_build_metrics
      attr_accessor :build_beta_detail
      attr_accessor :pre_release_version

      attr_mapping({
        "version" => "version",
        "uploadedDate" => "uploaded_date",
        "expirationDate" => "expiration_date",
        "expired" => "expired",
        "minOsVersion" => "min_os_version",
        "iconAssetToken" => "icon_asset_token",
        "processingState" => "processing_state",
        "usesNonExemptEncryption" => "uses_non_exempt_encryption",

        "app" => "app",
        "betaAppReviewSubmission" => "beta_app_review_submission",
        "betaBuildMetrics" => "beta_build_metrics",
        "buildBetaDetail" => "build_beta_detail",
        "preReleaseVersion" => "pre_release_version"
      })

      ESSENTIAL_INCLUDES = "app,buildBetaDetail,preReleaseVersion"

      module ProcessingState
        PROCESSING = "PROCESSING"
        FAILED = "FAILED"
        INVALID = "INVALID"
        VALID = "VALID"
      end

      def self.type
        return "builds"
      end

      #
      # Helpers
      #

      def app_version
        raise "No pre_release_version included" unless pre_release_version
        return pre_release_version.version
      end

      def app_id
        raise "No app included" unless app
        return app.id
      end

      def bundle_id
        raise "No app included" unless app
        return app.bundle_id
      end

      def platform
        raise "No pre_release_version included" unless pre_release_version
        return pre_release_version.platform
      end

      def processed?
        return processing_state != ProcessingState::PROCESSING
      end

      def ready_for_internal_testing?
        return build_beta_detail.nil? == false && build_beta_detail.ready_for_internal_testing?
      end

      def ready_for_beta_submission?
        raise "No build_beta_detail included" unless build_beta_detail
        return build_beta_detail.ready_for_beta_submission?
      end

      # This is here temporarily until the removal of Spaceship::TestFlight
      def to_testflight_build
        h = {
{'fraction_non_alphanumeric': 0.06723467308760882, 'fraction_numerical': 0.0009260974254491572, 'mean_word_length': 2.737024221453287, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2646393', 'n_tokens_mistral': 1585, 'n_tokens_neox': 1531, 'n_words': 339}