class Spaceship::Tunes::Application
def add_all_testers!
def add_all_testers! Tunes::Tester.external.add_all_to_app!(self.apple_id) Tunes::Tester.internal.add_all_to_app!(self.apple_id) end
def add_external_tester!(email: nil, first_name: nil, last_name: nil)
-
last_name
(String
) -- (optional): The last name of the tester (Ignored if user already exist) -
first_name
(String
) -- (optional): The first name of the tester (Ignored if user already exist) -
email
(String
) -- (required): The email of the tester
def add_external_tester!(email: nil, first_name: nil, last_name: nil) raise "Tester is already on #{self.name} betatesters" if find_external_tester(email) tester = Tunes::Tester.external.find(email) || Tunes::Tester.external.create!(email: email, first_name: first_name, last_name: last_name) tester.add_to_app!(self.apple_id) end
def all
-
(Array)
- Returns all apps available for this account
def all client.applications.map { |application| self.factory(application) } end
def all_processing_builds
-
(Array)
- This will return an array of *all* processing builds
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
def build_trains
-
(Hash)
- a hash, the version number being the key
def build_trains Tunes::BuildTrain.all(self, self.apple_id) end
def builds
Get all builds that are already processed for all build trains
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
def cancel_all_testflight_submissions!
def cancel_all_testflight_submissions! self.builds do |build| begin build.cancel_beta_review! rescue # We really don't care about any errors here end end true end
def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil)
-
company_name
(String
) -- : The company name or developer name to display on the App Store for your apps. -
bundle_id
(String
) -- : The bundle ID must match the one you used in Xcode. It -
sku
(String
) -- : A unique ID for your app that is not visible on the App Store. -
version
(String
) -- : The version number is shown on the App Store and should -
primary_language
(String
) -- : If localized app information isn't available in an -
name
(String
) -- : The name of your app as it will appear on the App Store.
def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil) client.create_application!(name: name, primary_language: primary_language, version: version, sku: sku, bundle_id: bundle_id, bundle_id_suffix: bundle_id_suffix, company_name: company_name) end
def create_submission
def create_submission version = self.latest_version if version.nil? raise "Could not find a valid version to submit for review" end Spaceship::AppSubmission.create(self, version) end
def create_version!(version_number)
Since we have stored the outdated raw_data, we need to refresh this object
Create a new version of your app
def create_version!(version_number) if edit_version raise "Cannot create a new version for this app as there already is an `edit_version` available" end client.create_version!(apple_id, version_number) # Future: implemented -reload method end
def details
def details attrs = client.app_details(apple_id) attrs.merge!(application: self) Tunes::AppDetails.factory(attrs) end
def edit_version
-
(Spaceship::AppVersion)
- Receive the version that can fully be edited
def edit_version Spaceship::AppVersion.find(self, self.apple_id, false) end
def ensure_version!(version_number)
-
(Bool)
- Was something changed?
def ensure_version!(version_number) if (e = edit_version) if e.version.to_s != version_number.to_s # Update an existing version e.version = version_number e.save! return true end return false else create_version!(version_number) return true end end
def external_testers
-
(Array)
- Returns all external testers available for this app
def external_testers Tunes::Tester.external.all_by_app(self.apple_id) end
def factory(attrs)
Create a new object based on a hash.
def factory(attrs) return self.new(attrs) end
def find(identifier)
-
(Spaceship::Tunes::Application)
- Returns the application matching the parameter
def find(identifier) all.find do |app| (app.apple_id == identifier.to_s or app.bundle_id == identifier) end end
def find_external_tester(identifier)
-
identifier
(String
) -- (required): Value used to filter the tester
Returns:
-
(Spaceship::Tunes::Tester.external)
- Returns the external tester matching the parameter
def find_external_tester(identifier) Tunes::Tester.external.find_by_app(self.apple_id, identifier) end
def find_internal_tester(identifier)
-
identifier
(String
) -- (required): Value used to filter the tester
Returns:
-
(Spaceship::Tunes::Tester.internal)
- Returns the internal tester matching the parameter
def find_internal_tester(identifier) Tunes::Tester.internal.find_by_app(self.apple_id, identifier) end
def internal_testers
-
(Array)
- Returns all internal testers available for this app
def internal_testers Tunes::Tester.internal.all_by_app(self.apple_id) end
def latest_version
-
(Spaceship::AppVersion)
- This will return the `edit_version` if available
def latest_version edit_version || live_version || Spaceship::AppVersion.find(self, self.apple_id, false) # we want to get *any* version, prefered the latest one end
def live_version
-
(Spaceship::AppVersion)
- Receive the version that is currently live on the
def live_version if raw_data['versions'].count == 1 v = raw_data['versions'].last if ['Prepare for Upload', 'prepareForUpload'].include?(v['state']) # this only applies for the initial version return nil end end Spaceship::AppVersion.find(self, self.apple_id, true) end
def pre_processing_builds
-
(Array)
- A list of binaries which are not even yet processing based on the version
def pre_processing_builds data = client.build_trains(apple_id, 'internal') # we need to fetch all trains here to get the builds builds = data.fetch('processingBuilds', []).collect do |attrs| attrs.merge!(build_train: self) Tunes::ProcessingBuild.factory(attrs) end builds.delete_if { |a| a.state == "ITC.apps.betaProcessingStatus.InvalidBinary" } builds end
def price_tier
def price_tier client.price_tier(self.apple_id) end
def remove_external_tester!(identifier)
-
identifier
(String
) -- (required): Value used to filter the tester
def remove_external_tester!(identifier) tester = find_external_tester(identifier) raise "Tester is not on #{self.name} betatesters" unless tester tester.remove_from_app!(self.apple_id) end
def resolution_center
-
(Hash)
- Contains the reason for rejection.
def resolution_center client.get_resolution_center(apple_id) end
def setup
@!group General
####################################################
def setup end
def update_price_tier!(price_tier)
def update_price_tier!(price_tier) client.update_price_tier!(self.apple_id, price_tier) end
def url
-
(String)
- An URL to this specific resource. You can enter this URL into your browser
def url "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{self.apple_id}" end