spaceship/lib/spaceship/connect_api/models/build.rb in fastlane_hotfix-2.165.1 vs spaceship/lib/spaceship/connect_api/models/build.rb in fastlane_hotfix-2.187.0

- old
+ new

@@ -15,12 +15,14 @@ attr_accessor :uses_non_exempt_encryption attr_accessor :app attr_accessor :beta_app_review_submission attr_accessor :beta_build_metrics + attr_accessor :beta_build_localizations attr_accessor :build_beta_detail attr_accessor :pre_release_version + attr_accessor :individual_testers attr_mapping({ "version" => "version", "uploadedDate" => "uploaded_date", "expirationDate" => "expiration_date", @@ -31,12 +33,14 @@ "usesNonExemptEncryption" => "uses_non_exempt_encryption", "app" => "app", "betaAppReviewSubmission" => "beta_app_review_submission", "betaBuildMetrics" => "beta_build_metrics", + "betaBuildLocalizations" => "beta_build_localizations", "buildBetaDetail" => "build_beta_detail", - "preReleaseVersion" => "pre_release_version" + "preReleaseVersion" => "pre_release_version", + "individualTesters" => "individual_testers" }) ESSENTIAL_INCLUDES = "app,buildBetaDetail,preReleaseVersion" module ProcessingState @@ -85,10 +89,15 @@ def ready_for_beta_submission? raise "No build_beta_detail included" unless build_beta_detail return build_beta_detail.ready_for_beta_submission? end + def missing_export_compliance? + raise "No build_beta_detail included" unless build_beta_detail + return build_beta_detail.missing_export_compliance? + end + # This is here temporarily until the removal of Spaceship::TestFlight def to_testflight_build h = { 'id' => id, 'buildVersion' => version, @@ -104,12 +113,13 @@ # # API # - def self.all(app_id: nil, version: nil, build_number: nil, platform: nil, processing_states: "PROCESSING,FAILED,INVALID,VALID", includes: ESSENTIAL_INCLUDES, sort: "-uploadedDate", limit: 30) - resps = Spaceship::ConnectAPI.get_builds( + def self.all(client: nil, app_id: nil, version: nil, build_number: nil, platform: nil, processing_states: "PROCESSING,FAILED,INVALID,VALID", includes: ESSENTIAL_INCLUDES, sort: "-uploadedDate", limit: 30) + client ||= Spaceship::ConnectAPI + resps = client.get_builds( filter: { app: app_id, "preReleaseVersion.version" => version, version: build_number, processingState: processing_states }, includes: includes, sort: sort, limit: limit ).all_pages @@ -123,50 +133,57 @@ end return models end - def self.get(build_id: nil, includes: ESSENTIAL_INCLUDES) - return Spaceship::ConnectAPI.get_build(build_id: build_id, includes: includes).first + def self.get(client: nil, build_id: nil, includes: ESSENTIAL_INCLUDES) + client ||= Spaceship::ConnectAPI + return client.get_build(build_id: build_id, includes: includes).first end - def update(attributes: nil) + def update(client: nil, attributes: nil) + client ||= Spaceship::ConnectAPI attributes = reverse_attr_mapping(attributes) - return Spaceship::ConnectAPI.patch_builds(build_id: id, attributes: attributes).first + return client.patch_builds(build_id: id, attributes: attributes).first end - def add_beta_groups(beta_groups: nil) + def add_beta_groups(client: nil, beta_groups: nil) + client ||= Spaceship::ConnectAPI beta_groups ||= [] beta_group_ids = beta_groups.map(&:id) - return Spaceship::ConnectAPI.add_beta_groups_to_build(build_id: id, beta_group_ids: beta_group_ids) + return client.add_beta_groups_to_build(build_id: id, beta_group_ids: beta_group_ids) end - def get_beta_build_localizations(filter: {}, includes: nil, limit: nil, sort: nil) - resps = Spaceship::ConnectAPI.get_beta_build_localizations( + def get_beta_build_localizations(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) + client ||= Spaceship::ConnectAPI + resps = client.get_beta_build_localizations( filter: { build: id }, includes: includes, sort: sort, limit: limit ).all_pages return resps.flat_map(&:to_models) end - def get_build_beta_details(filter: {}, includes: nil, limit: nil, sort: nil) - resps = Spaceship::ConnectAPI.get_build_beta_details( + def get_build_beta_details(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) + client ||= Spaceship::ConnectAPI + resps = client.get_build_beta_details( filter: { build: id }, includes: includes, sort: sort, limit: limit ).all_pages return resps.flat_map(&:to_models) end - def post_beta_app_review_submission - return Spaceship::ConnectAPI.post_beta_app_review_submissions(build_id: id) + def post_beta_app_review_submission(client: nil) + client ||= Spaceship::ConnectAPI + return client.post_beta_app_review_submissions(build_id: id) end - def expire! - return Spaceship::ConnectAPI.patch_builds(build_id: id, attributes: { expired: true }) + def expire!(client: nil) + client ||= Spaceship::ConnectAPI + return client.patch_builds(build_id: id, attributes: { expired: true }) end end end end