b0VIM 8.0#\_joshJoshs-MacBook-Pro.local~josh/Projects/fastlane/fastlane/spaceship/lib/spaceship/test_flight/build.rbutf-8 3210#"! Utpsjtad3srRQ*)^M z V U 5 $  o n H G  o O N - ,  } ^ ] H (  ] + _9c4Y Jh82   builds_data = client.get_builds_for_train(app_id: app_id, platform: platform, train_version: train_version, retry_count: retry_count) def self.builds_for_train(app_id: nil, platform: nil, train_version: nil, retry_count: 3) end trains.values.flatten trains = BuildTrains.all(app_id: app_id, platform: platform, retry_count: retry_count) def self.all(app_id: nil, platform: nil, retry_count: 0) end self.new(attrs) attrs = client.get_build(app_id: app_id, build_id: build_id) def self.find(app_id: nil, build_id: nil) # @return (Spaceship::TestFlight::Build) # # Find a Build by `build_id`. } approved: 'testflight.build.state.review.approved' review_rejected: 'testflight.build.state.review.rejected', export_compliance_missing: 'testflight.build.state.export.compliance.missing', ready_to_test: 'testflight.build.state.testing.ready', ready_to_submit: 'testflight.build.state.submit.ready', active: 'testflight.build.state.testing.active', processing: 'testflight.build.state.processing', BUILD_STATES = { }) 'fileName' => :file_name 'containsODR' => :contains_odr, 'numberOfAssetPacks' => :number_of_asset_packs, 'includesSymbols' => :include_symbols, 'buildSdk' => :build_sdk, 'dSYMUrl' => :dsym_url, 'id' => :id, 'uploadDate' => :upload_date, 'didNotify' => :did_notify, 'autoNotifyEnabled' => :auto_notify_enabled, 'crashCount' => :crash_count, 'inviteCount' => :invite_count, 'installCount' => :install_count, 'testInfo' => :test_info, 'externalState' => :external_state, 'internalState' => :internal_state, 'exportCompliance' => :export_compliance, 'betaReviewInfo' => :beta_review_info, 'buildVersion' => :build_version, 'trainVersion' => :train_version, 'bundleId' => :bundle_id, 'providerId' => :provider_id, 'appAdamId' => :app_id, attr_mapping({ attr_accessor :file_name attr_accessor :contains_odr attr_accessor :number_of_asset_packs attr_accessor :include_symbols attr_accessor :build_sdk attr_accessor :dsym_url attr_accessor :upload_date attr_accessor :did_notify attr_accessor :auto_notify_enabled attr_accessor :crash_count attr_accessor :invite_count attr_accessor :install_count attr_accessor :test_info attr_accessor :export_compliance attr_accessor :beta_review_info attr_accessor :build_version # "152" # @example attr_accessor :train_version # "1.0" # @example attr_accessor :id # 19285309 # @example # Internal build ID (int) attr_accessor :external_state # "testflight.build.state.processing" # @example # "testflight.build.state.submit.ready" # @example attr_accessor :internal_state # "testflight.build.state.processing" # @example # "testflight.build.state.testing.active" # @example attr_accessor :bundle_id # "com.sample.app" # @example class Build < Base module TestFlightmodule Spaceshiprequire_relative '../connect_api/base'require_relative 'build_trains'require_relative 'beta_review_info'require_relative 'export_compliance'require_relative 'test_info'require_relative 'base'require 'time'adk u! end end end end resp.first resp = Spaceship::ConnectAPI::Base.client.get_builds(filter: { expired: false, processingState: "PROCESSING,VALID", version: self.build_version, app: app_id }) def find_app_store_connect_build # Bridges the TestFlight::Build to the App Store Connect API build end client.add_group_to_build(app_id: app_id, group_id: group.id, build_id: id) def add_group!(group) end client.expire_build(app_id: app_id, build_id: id, build: self) def expire! endad j.v$ N  _  o ^    U K J 8  @ 6 5  pxhP.$#T@( J:Uz^]0 Spaceship::ConnectAPI::Base.client.post_beta_app_review_submissions(build_id: build["id"]) build = find_app_store_connect_build return if approved? return if ready_to_test? def submit_for_testflight_review! end save! test_info.whats_new = whats_new if whats_new test_info.feedback_email = feedback_email if feedback_email test_info.description = description if description def update_build_information!(description: nil, feedback_email: nil, whats_new: nil) end client.put_build(app_id: app_id, build_id: id, build: self) def save! # saves the changes to the Build object to TestFlight end Time.parse(super) def upload_date # @return (Time) an parsed Time value for the upload_date end TestInfo.new(super) super || reload def test_info # @return (Spaceship::TestFlight::TestInfo) end ExportCompliance.new(super) super || reload def export_compliance # @return (Spaceship::TestFlight::ExportCompliance) end BetaReviewInfo.new(super) super || reload def beta_review_info # @return (Spaceship::TestFlight::BetaReviewInfo) # `super` here calls `beta_review_info` as defined by the `attr_mapping` above. # # any of the variables below, because they are not included in the partial Build objects # We are then requesting the full build from iTC when we need to access # Getting builds from BuildTrains only gets a partial Build object end active? || ready_to_submit? || export_compliance_missing? || review_rejected? def processed? end external_state == BUILD_STATES[:approved] def approved? end external_state == BUILD_STATES[:review_rejected] def review_rejected? end external_state == BUILD_STATES[:export_compliance_missing] def export_compliance_missing? end external_state == BUILD_STATES[:processing] def processing? end external_state == BUILD_STATES[:active] def active? end external_state == BUILD_STATES[:ready_to_test] def ready_to_test? end external_state == BUILD_STATES[:ready_to_submit] def ready_to_submit? end self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data def reload # @return (Spaceship::Base::DataHash) the raw_data of the build. # # Note: this will overwrite any non-saved changes to the object # # but then need to look up some attributes on the full build representation. # This is useful when we start with a partial build response as returned by the BuildTrains, # reload the raw_data resource for this build. end all(app_id: app_id, platform: platform).sort_by(&:upload_date).last def self.latest(app_id: nil, platform: nil) end all(app_id: app_id, platform: platform, retry_count: retry_count).select { |app| app.external_state == 'testflight.build.state.review.waiting' } def self.all_waiting_for_review(app_id: nil, platform: nil, retry_count: 0) # Just the builds, as a flat array, that are waiting for beta review end all(app_id: app_id, platform: platform, retry_count: retry_count).find_all(&:processing?) def self.all_processing_builds(app_id: nil, platform: nil, retry_count: 0) # Just the builds, as a flat array, that are still processing end builds_data.map { |data| self.new(data) }