spaceship/lib/spaceship/test_flight/build.rb in fastlane-2.28.5 vs spaceship/lib/spaceship/test_flight/build.rb in fastlane-2.28.6

- old
+ new

@@ -65,20 +65,21 @@ }) BUILD_STATES = { processing: 'testflight.build.state.processing', active: 'testflight.build.state.testing.active', - ready: 'testflight.build.state.submit.ready', + ready_to_submit: 'testflight.build.state.submit.ready', + ready_to_test: 'testflight.build.state.testing.ready', export_compliance_missing: 'testflight.build.state.export.compliance.missing' } - # Find a Build by `build_id`. Returns `nil` if can't find it. + # Find a Build by `build_id`. # # @return (Spaceship::TestFlight::Build) def self.find(app_id: nil, build_id: nil) attrs = client.get_build(app_id: app_id, build_id: build_id) - self.new(attrs) if attrs + self.new(attrs) end def self.all(app_id: nil, platform: nil) trains = BuildTrains.all(app_id: app_id, platform: platform) trains.values.flatten @@ -102,19 +103,23 @@ # This is useful when we start with a partial build response as returned by the BuildTrains, # but then need to look up some attributes on the full build representation. # # Note: this will overwrite any non-saved changes to the object # - # @return (Spaceceship::Base::DataHash) the raw_data of the build. + # @return (Spaceship::Base::DataHash) the raw_data of the build. def reload self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data end def ready_to_submit? - external_state == BUILD_STATES[:ready] + external_state == BUILD_STATES[:ready_to_submit] end + def ready_to_test? + external_state == BUILD_STATES[:ready_to_test] + end + def active? external_state == BUILD_STATES[:active] end def processing? @@ -123,10 +128,14 @@ def export_compliance_missing? external_state == BUILD_STATES[:export_compliance_missing] end + def self.processed? + active? || ready_to_submit? || export_compliance_missing? + end + # Getting builds from BuildTrains only gets a partial Build object # We are then requesting the full build from iTC when we need to access # any of the variables below, because they are not inlcuded in the partial Build objects # # `super` here calls `beta_review_info` as defined by the `attr_mapping` above. @@ -157,16 +166,17 @@ def save! client.put_build(app_id: app_id, build_id: id, build: self) end def update_build_information!(description: nil, feedback_email: nil, whats_new: nil) - test_info.description = description - test_info.feedback_email = feedback_email - test_info.whats_new = whats_new + test_info.description = description if description + test_info.feedback_email = feedback_email if feedback_email + test_info.whats_new = whats_new if whats_new save! end def submit_for_testflight_review! + return if ready_to_test? client.post_for_testflight_review(app_id: app_id, build_id: id, build: self) end def add_group!(group) client.add_group_to_build(app_id: app_id, group_id: group.id, build_id: id)