class Spaceship::TestFlight::Build

Constants

BUILD_STATES

Attributes

auto_notify_enabled[RW]
beta_review_info[RW]
build_sdk[RW]
build_version[RW]

@example

"152"
bundle_id[RW]

@example

"com.sample.app"
contains_odr[RW]
crash_count[RW]
did_notify[RW]
dsym_url[RW]
export_compliance[RW]
external_state[RW]

@example

"testflight.build.state.submit.ready"

@example

"testflight.build.state.processing"
file_name[RW]
id[RW]

Internal build ID (int) @example

19285309
include_symbols[RW]
install_count[RW]
internal_state[RW]

@example

"testflight.build.state.testing.active"

@example

"testflight.build.state.processing"
invite_count[RW]
number_of_asset_packs[RW]
test_info[RW]
train_version[RW]

@example

"1.0"
upload_date[RW]

Public Class Methods

all(app_id: nil, platform: nil, retry_count: 0) click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 109
def self.all(app_id: nil, platform: nil, retry_count: 0)
  trains = BuildTrains.all(app_id: app_id, platform: platform, retry_count: retry_count)
  trains.values.flatten
end
all_processing_builds(app_id: nil, platform: nil, retry_count: 0) click to toggle source

Just the builds, as a flat array, that are still processing

# File spaceship/lib/spaceship/test_flight/build.rb, line 120
def self.all_processing_builds(app_id: nil, platform: nil, retry_count: 0)
  all(app_id: app_id, platform: platform, retry_count: retry_count).find_all(&:processing?)
end
all_waiting_for_review(app_id: nil, platform: nil, retry_count: 0) click to toggle source

Just the builds, as a flat array, that are waiting for beta review

# File spaceship/lib/spaceship/test_flight/build.rb, line 125
def self.all_waiting_for_review(app_id: nil, platform: nil, retry_count: 0)
  all(app_id: app_id, platform: platform, retry_count: retry_count).select { |app| app.external_state == 'testflight.build.state.review.waiting' }
end
builds_for_train(app_id: nil, platform: nil, train_version: nil, retry_count: 3) click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 114
def self.builds_for_train(app_id: nil, platform: nil, train_version: nil, retry_count: 3)
  builds_data = client.get_builds_for_train(app_id: app_id, platform: platform, train_version: train_version, retry_count: retry_count)
  builds_data.map { |data| self.new(data) }
end
find(app_id: nil, build_id: nil) click to toggle source

Find a Build by `build_id`.

@return (Spaceship::TestFlight::Build)

# File spaceship/lib/spaceship/test_flight/build.rb, line 104
def self.find(app_id: nil, build_id: nil)
  attrs = client.get_build(app_id: app_id, build_id: build_id)
  self.new(attrs)
end
latest(app_id: nil, platform: nil) click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 129
def self.latest(app_id: nil, platform: nil)
  all(app_id: app_id, platform: platform).sort_by(&:upload_date).last
end

Public Instance Methods

active?() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 152
def active?
  external_state == BUILD_STATES[:active]
end
add_group!(group) click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 227
def add_group!(group)
  client.add_group_to_build(app_id: app_id, group_id: group.id, build_id: id)
end
approved?() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 168
def approved?
  external_state == BUILD_STATES[:approved]
end
expire!() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 223
def expire!
  client.expire_build(app_id: app_id, build_id: id, build: self)
end
export_compliance_missing?() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 160
def export_compliance_missing?
  external_state == BUILD_STATES[:export_compliance_missing]
end
find_app_store_connect_build() click to toggle source

Bridges the TestFlight::Build to the App Store Connect API build

# File spaceship/lib/spaceship/test_flight/build.rb, line 232
def find_app_store_connect_build
  builds = Spaceship::ConnectAPI::Build.all(
    app_id: app_id,
    version: self.train_version,
    build_number: self.build_version
  )
  return builds.find { |build| build.id == id }
end
processed?() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 172
def processed?
  active? || ready_to_submit? || export_compliance_missing? || review_rejected?
end
processing?() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 156
def processing?
  external_state == BUILD_STATES[:processing]
end
ready_to_submit?() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 144
def ready_to_submit?
  external_state == BUILD_STATES[:ready_to_submit]
end
ready_to_test?() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 148
def ready_to_test?
  external_state == BUILD_STATES[:ready_to_test]
end
reload() click to toggle source

reload the raw_data resource for this build. 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 (Spaceship::Base::DataHash) the raw_data of the build.

# File spaceship/lib/spaceship/test_flight/build.rb, line 140
def reload
  self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data
end
review_rejected?() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 164
def review_rejected?
  external_state == BUILD_STATES[:review_rejected]
end
save!() click to toggle source

saves the changes to the Build object to TestFlight

# File spaceship/lib/spaceship/test_flight/build.rb, line 205
def save!
  client.put_build(app_id: app_id, build_id: id, build: self)
end
submit_for_testflight_review!() click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 216
def submit_for_testflight_review!
  return if ready_to_test?
  return if approved?

  Spaceship::ConnectAPI.post_beta_app_review_submissions(build_id: id)
end
update_build_information!(description: nil, feedback_email: nil, whats_new: nil) click to toggle source
# File spaceship/lib/spaceship/test_flight/build.rb, line 209
def update_build_information!(description: nil, feedback_email: nil, whats_new: nil)
  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