class Spaceship::Tunes::Build

Represents a build which is inside the build train

def apple_id

def apple_id
  return @apple_id if @apple_id
  return self.build_train.application.apple_id
end

def cancel_beta_review!

This will cancel the review process for this TestFlight build
def cancel_beta_review!
  client.remove_testflight_build_from_review!(app_id: self.apple_id,
                                               train: self.train_version,
                                        build_number: self.build_version,
                                            platform: self.platform)
end

def details

def details
  response = client.build_details(app_id: self.apple_id,
                                   train: self.train_version,
                            build_number: self.build_version,
                                platform: self.platform)
  response['apple_id'] = self.apple_id
  BuildDetails.factory(response)
end

def factory(attrs)

This is used to create a new object based on the server response.
Create a new object based on a hash.
def factory(attrs)
  self.new(attrs)
end

def setup

def setup
  super
  self.external_expiry_date ||= 0
  self.internal_expiry_date ||= 0
end

def submit_for_beta_review!(metadata)

Parameters:
  • metadata (Hash) -- A hash containing the following information (keys must be symbols):
def submit_for_beta_review!(metadata)
  parameters = {
    app_id: self.apple_id,
    train: self.train_version,
    build_number: self.build_version,
    platform: self.platform
  }.merge(metadata)
  client.submit_testflight_build_for_review!(parameters)
  return parameters
end

def testing_status

Returns:
  • (String) - A nicely formatted string about the state of this build
def testing_status
  testing ||= "External" if self.external_testing_enabled
  testing ||= "Internal" if self.internal_testing_enabled
  if Time.at(self.internal_expiry_date / 1000) > Time.now
    testing ||= "Inactive"
  else
    testing = "Expired"
  end
  return testing
end

def update_build_information!(whats_new: nil,

def update_build_information!(whats_new: nil,
                              description: nil,
                              feedback_email: nil)
  parameters = {
    app_id: self.apple_id,
    train: self.train_version,
    build_number: self.build_version,
    platform: self.platform
  }.merge({
    whats_new: whats_new,
    description: description,
    feedback_email: feedback_email
  })
  client.update_build_information!(parameters)
end