lib/spaceship/tunes/application.rb in spaceship-0.1.2 vs lib/spaceship/tunes/application.rb in spaceship-0.2.0

- old
+ new

@@ -160,19 +160,48 @@ # @return [Hash] a hash, the version number being the key def build_trains Tunes::BuildTrain.all(self, self.apple_id) end + # @return [Array] A list of all pre-processing builds + # These are all build that have no information except the upload date def pre_processing_builds data = client.build_trains(apple_id) # we need to fetch all trains here to get the builds data.fetch('processingBuilds', []).collect do |attrs| attrs.merge!(build_train: self) Tunes::ProcessingBuild.factory(attrs) end end + # @return [Array] This will return an array of *all* processing builds + # this include pre-processing or standard processing + def all_processing_builds + builds = self.pre_processing_builds + + self.build_trains.each do |version_number, train| + train.processing_builds.each do |build| + builds << build + end + end + + return builds + end + + # Get all builds that are already processed for all build trains + # You can either use the return value (array) or pass a block + def builds + all_builds = [] + self.build_trains.each do |version_number, train| + train.builds.each do |build| + yield(build) if block_given? + all_builds << build unless block_given? + end + end + all_builds + end + ##################################################### # @!group Submit for Review ##################################################### def create_submission @@ -180,9 +209,21 @@ if version.nil? raise "Could not find a valid version to submit for review" end Spaceship::AppSubmission.create(self, self.apple_id, version) + end + + # Cancels all ongoing TestFlight beta submission for this application + def cancel_all_testflight_submissions! + self.builds do |build| + begin + build.cancel_beta_review! + rescue => ex + # We really don't care about any errors here + end + end + true end ##################################################### # @!group General #####################################################