Class: Spaceship::Tunes::Application
- Defined in:
- spaceship/lib/spaceship/tunes/application.rb
Instance Attribute Summary collapse
-
#app_icon_preview_url ⇒ String
The URL to a low resolution app icon of this app (340x340px).
-
#apple_id ⇒ String
The App identifier of this app, provided by iTunes Connect.
-
#bundle_id ⇒ String
The bundle_id (app identifier) of your app.
-
#issues_count ⇒ Integer
The number of issues provided by iTunes Connect.
-
#last_modified ⇒ String
Last modified.
-
#name ⇒ String
The name you provided for this app (in the default language).
-
#vendor_id ⇒ String
The Vendor ID provided by iTunes Connect.
-
#version_sets ⇒ Array
An array of all versions sets.
Attributes inherited from Base
Getting information collapse
- #details ⇒ Object
-
#edit_version(platform: nil) ⇒ Spaceship::Tunes::AppVersion
Receive the version that can fully be edited.
-
#latest_version(platform: nil) ⇒ Spaceship::Tunes::AppVersion
This will return the ‘edit_version` if available and fallback to the `live_version`.
-
#live_version(platform: nil) ⇒ Spaceship::Tunes::AppVersion
Receive the version that is currently live on the App Store.
-
#platform ⇒ Object
kept for backward compatibility tries to guess the platform of the currently submitted apps note that as ITC now supports multiple app types, this might break if your app supports more than one.
- #platforms ⇒ Object
- #ratings(version_id: '', storefront: '') ⇒ Object
-
#resolution_center ⇒ Hash
Contains the reason for rejection.
- #type ⇒ Object
-
#url ⇒ String
An URL to this specific resource.
- #version_set_for_platform(platform) ⇒ Object
- #versions_history ⇒ Object
Modifying collapse
-
#availability ⇒ Object
The current availability.
-
#create_version!(version_number, platform: nil) ⇒ Object
Create a new version of your app Since we have stored the outdated raw_data, we need to refresh this object otherwise ‘edit_version` will return nil.
-
#ensure_version!(version_number, platform: nil) ⇒ Bool
Will make sure the current edit_version matches the given version number This will either create a new version or change the version number from an existing version.
-
#price_tier ⇒ Object
The current price tier.
- #reject_version_if_possible! ⇒ Object
-
#update_availability!(availability) ⇒ Object
set the availability.
-
#update_price_tier!(price_tier) ⇒ Object
set the price tier.
in_app_purchases collapse
-
#in_app_purchases ⇒ Object
Get base In-App-Purchases object.
Builds collapse
-
#all_build_train_numbers(platform: nil) ⇒ Array
The numbers of all build trains that were uploaded.
-
#all_builds_for_train(train: nil, platform: nil) ⇒ Object
Receive the build details for a specific build useful if the app is not listed in the TestFlight build list which might happen if you don’t use TestFlight This is used to receive dSYM files from Apple.
-
#all_processing_builds(platform: nil) ⇒ Array
This will return an array of all processing builds this include pre-processing or standard processing.
-
#build_trains(platform: nil) ⇒ Hash
TestFlight: A reference to all the build trains.
-
#builds(platform: nil) ⇒ Object
Get all builds that are already processed for all build trains You can either use the return value (array) or pass a block.
- #tunes_all_build_trains(app_id: nil, platform: nil) ⇒ Object
- #tunes_all_builds_for_train(train: nil, platform: nil) ⇒ Object
- #tunes_build_details(train: nil, build_number: nil, platform: nil) ⇒ Object
Submit for Review collapse
-
#cancel_all_testflight_submissions! ⇒ Object
Cancels all ongoing TestFlight beta submission for this application.
- #create_submission ⇒ Object
release collapse
General collapse
Testers collapse
Promo codes collapse
-
#ensure_not_a_bundle ⇒ Object
private to module.
- #promocodes ⇒ Object
- #promocodes_history ⇒ Object
Class Method Summary collapse
-
.all ⇒ Array
Returns all apps available for this account.
-
.create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, itunes_connect_users: nil) ⇒ Object
Creates a new application on iTunes Connect It cannot be changed after you create your first app.
-
.find(identifier, mac: false) ⇒ Spaceship::Tunes::Application
Returns the application matching the parameter as either the App ID or the bundle identifier.
Methods inherited from TunesBase
Methods inherited from Base
attr_accessor, attr_mapping, attributes, #attributes, factory, #initialize, #inspect, mapping_module, method_missing, set_client, #to_s
Constructor Details
This class inherits a constructor from Spaceship::Base
Instance Attribute Details
#app_icon_preview_url ⇒ String
Returns The URL to a low resolution app icon of this app (340x340px). Might be nil.
48 49 50 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 48 def app_icon_preview_url @app_icon_preview_url end |
#apple_id ⇒ String
Returns The App identifier of this app, provided by iTunes Connect.
20 21 22 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 20 def apple_id @apple_id end |
#bundle_id ⇒ String
Returns The bundle_id (app identifier) of your app.
35 36 37 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 35 def bundle_id @bundle_id end |
#issues_count ⇒ Integer
Returns The number of issues provided by iTunes Connect.
41 42 43 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 41 def issues_count @issues_count end |
#last_modified ⇒ String
Returns Last modified.
38 39 40 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 38 def last_modified @last_modified end |
#name ⇒ String
Returns The name you provided for this app (in the default language).
25 26 27 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 25 def name @name end |
#vendor_id ⇒ String
Returns The Vendor ID provided by iTunes Connect.
30 31 32 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 30 def vendor_id @vendor_id end |
#version_sets ⇒ Array
Returns An array of all versions sets.
51 52 53 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 51 def version_sets @version_sets end |
Class Method Details
.all ⇒ Array
Returns all apps available for this account
65 66 67 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 65 def all client.applications.map { |application| self.factory(application) } end |
.create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, itunes_connect_users: nil) ⇒ Object
Creates a new application on iTunes Connect It cannot be changed after you create your first app.
93 94 95 96 97 98 99 100 101 102 103 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 93 def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, itunes_connect_users: nil) puts("The `version` parameter is deprecated. Use `ensure_version!` method instead") if version client.create_application!(name: name, primary_language: primary_language, sku: sku, bundle_id: bundle_id, bundle_id_suffix: bundle_id_suffix, company_name: company_name, platform: platform, itunes_connect_users: itunes_connect_users) end |
.find(identifier, mac: false) ⇒ Spaceship::Tunes::Application
Returns the application matching the parameter as either the App ID or the bundle identifier
71 72 73 74 75 76 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 71 def find(identifier, mac: false) all.find do |app| ((app.apple_id && app.apple_id.casecmp(identifier.to_s) == 0) || (app.bundle_id && app.bundle_id.casecmp(identifier.to_s) == 0)) && app.version_sets.any? { |v| (mac ? ["osx"] : ["ios", "appletvos"]).include?(v.platform) } end end |
Instance Method Details
#all_build_train_numbers(platform: nil) ⇒ Array
The numbers of all build trains that were uploaded
291 292 293 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 291 def all_build_train_numbers(platform: nil) return self.build_trains(platform: platform || self.platform).versions end |
#all_builds_for_train(train: nil, platform: nil) ⇒ Object
Receive the build details for a specific build useful if the app is not listed in the TestFlight build list which might happen if you don’t use TestFlight This is used to receive dSYM files from Apple
299 300 301 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 299 def all_builds_for_train(train: nil, platform: nil) return TestFlight::Build.builds_for_train(app_id: self.apple_id, platform: platform || self.platform, train_version: train) end |
#all_processing_builds(platform: nil) ⇒ Array
Returns This will return an array of all processing builds this include pre-processing or standard processing.
305 306 307 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 305 def all_processing_builds(platform: nil) return TestFlight::Build.all_processing_builds(app_id: self.apple_id, platform: platform || self.platform) end |
#availability ⇒ Object
The current availability.
265 266 267 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 265 def availability client.availability(self.apple_id) end |
#build_trains(platform: nil) ⇒ Hash
TestFlight: A reference to all the build trains
285 286 287 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 285 def build_trains(platform: nil) TestFlight::BuildTrains.all(app_id: self.apple_id, platform: platform || self.platform) end |
#builds(platform: nil) ⇒ Object
Get all builds that are already processed for all build trains You can either use the return value (array) or pass a block
335 336 337 338 339 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 335 def builds(platform: nil) all = TestFlight::Build.all(app_id: self.apple_id, platform: platform || self.platform) return all unless block_given? all.each { |build| yield(build) } end |
#cancel_all_testflight_submissions! ⇒ Object
Cancels all ongoing TestFlight beta submission for this application
355 356 357 358 359 360 361 362 363 364 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 355 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 |
#create_submission ⇒ Object
345 346 347 348 349 350 351 352 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 345 def create_submission version = self.latest_version if version.nil? raise "Could not find a valid version to submit for review" end Spaceship::Tunes::AppSubmission.create(self, version) end |
#create_version!(version_number, platform: nil) ⇒ Object
Create a new version of your app Since we have stored the outdated raw_data, we need to refresh this object otherwise ‘edit_version` will return nil
211 212 213 214 215 216 217 218 219 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 211 def create_version!(version_number, platform: nil) if edit_version(platform: platform) 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, platform.nil? ? 'ios' : platform) # Future: implemented -reload method end |
#default_external_group ⇒ Object
393 394 395 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 393 def default_external_group TestFlight::Group.default_external_group(app_id: self.apple_id) end |
#details ⇒ Object
189 190 191 192 193 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 189 def details attrs = client.app_details(apple_id) attrs[:application] = self Tunes::AppDetails.factory(attrs) end |
#edit_version(platform: nil) ⇒ Spaceship::Tunes::AppVersion
Returns Receive the version that can fully be edited.
124 125 126 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 124 def edit_version(platform: nil) Spaceship::Tunes::AppVersion.find(self, self.apple_id, false, platform: platform) end |
#ensure_not_a_bundle ⇒ Object
private to module
415 416 417 418 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 415 def ensure_not_a_bundle # we only support applications raise "We do not support BUNDLE types right now" if self.type == 'BUNDLE' end |
#ensure_version!(version_number, platform: nil) ⇒ Bool
Will make sure the current edit_version matches the given version number This will either create a new version or change the version number from an existing version
225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 225 def ensure_version!(version_number, platform: nil) if (e = edit_version(platform: platform)) 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, platform: platform) return true end end |
#in_app_purchases ⇒ Object
Get base In-App-Purchases object
273 274 275 276 277 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 273 def in_app_purchases attrs = {} attrs[:application] = self Tunes::IAP.factory(attrs) end |
#latest_version(platform: nil) ⇒ Spaceship::Tunes::AppVersion
Returns This will return the ‘edit_version` if available and fallback to the `live_version`. Use this to just access the latest data.
130 131 132 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 130 def latest_version(platform: nil) edit_version(platform: platform) || live_version(platform: platform) end |
#live_version(platform: nil) ⇒ Spaceship::Tunes::AppVersion
Returns Receive the version that is currently live on the App Store. You can’t modify all values there, so be careful.
119 120 121 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 119 def live_version(platform: nil) Spaceship::Tunes::AppVersion.find(self, self.apple_id, true, platform: platform) end |
#platform ⇒ Object
kept for backward compatibility tries to guess the platform of the currently submitted apps note that as ITC now supports multiple app types, this might break if your app supports more than one
176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 176 def platform if self.version_sets.nil? raise 'The application has no version sets and Spaceship does not know what to do here.' end if self.version_sets.length == 1 version_sets[0].platform elsif self.platforms == %w(ios appletvos) 'ios' end Spaceship::Tunes::AppVersionCommon.find_platform(raw_data['versionSets'])['platformString'] end |
#platforms ⇒ Object
152 153 154 155 156 157 158 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 152 def platforms platforms = [] version_sets.each do |version_set| platforms << version_set.platform end platforms end |
#price_tier ⇒ Object
The current price tier
255 256 257 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 255 def price_tier client.price_tier(self.apple_id) end |
#promocodes ⇒ Object
400 401 402 403 404 405 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 400 def promocodes data = client.app_promocodes(app_id: self.apple_id) data.map do |attrs| Tunes::AppVersionPromocodes.factory(attrs) end end |
#promocodes_history ⇒ Object
407 408 409 410 411 412 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 407 def promocodes_history data = client.app_promocodes_history(app_id: self.apple_id) data.map do |attrs| Tunes::AppVersionGeneratedPromocodes.factory(attrs) end end |
#ratings(version_id: '', storefront: '') ⇒ Object
146 147 148 149 150 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 146 def (version_id: '', storefront: '') attrs = client.(apple_id, platform, version_id, storefront) attrs[:application] = self Tunes::AppRatings.new(attrs) end |
#reject_version_if_possible! ⇒ Object
240 241 242 243 244 245 246 247 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 240 def reject_version_if_possible! can_reject = edit_version.can_reject_version if can_reject client.reject!(apple_id, edit_version.version_id) end return can_reject end |
#release! ⇒ Object
370 371 372 373 374 375 376 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 370 def release! version = self.edit_version if version.nil? raise "Could not find a valid version to release" end version.release! end |
#resolution_center ⇒ Hash
Returns Contains the reason for rejection. if everything is alright, the result will be ‘“sectionInfoKeys”=>[], “sectionWarningKeys”=>[], “replyConstraints”=>{“minLength”=>1, “maxLength”=>4000, “appNotes”=>“threads”=>[], “betaNotes”=>“threads”=>[], “appMessages”=>“threads”=>[]}`.
142 143 144 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 142 def resolution_center client.get_resolution_center(apple_id, platform) end |
#setup ⇒ Object
381 382 383 384 385 386 387 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 381 def setup super @version_sets = (self.raw_data['versionSets'] || []).map do |attrs| attrs[:application] = self Tunes::VersionSet.factory(attrs) end end |
#tunes_all_build_trains(app_id: nil, platform: nil) ⇒ Object
309 310 311 312 313 314 315 316 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 309 def tunes_all_build_trains(app_id: nil, platform: nil) resp = client.all_build_trains(app_id: apple_id, platform: platform) trains = resp["trains"] or [] trains.map do |attrs| attrs['application'] = self Tunes::BuildTrain.factory(attrs) end end |
#tunes_all_builds_for_train(train: nil, platform: nil) ⇒ Object
318 319 320 321 322 323 324 325 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 318 def tunes_all_builds_for_train(train: nil, platform: nil) resp = client.all_builds_for_train(app_id: apple_id, train: train, platform: platform) items = resp["items"] or [] items.map do |attrs| attrs['apple_id'] = apple_id Tunes::Build.factory(attrs) end end |
#tunes_build_details(train: nil, build_number: nil, platform: nil) ⇒ Object
327 328 329 330 331 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 327 def tunes_build_details(train: nil, build_number: nil, platform: nil) resp = client.build_details(app_id: apple_id, train: train, build_number: build_number, platform: platform) resp['apple_id'] = apple_id Tunes::BuildDetails.factory(resp) end |
#type ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 160 def type if self.version_sets.nil? raise 'The application has no version sets and Spaceship does not know what to do here.' end if self.version_sets.length == 1 version_sets[0].platform end platform = Spaceship::Tunes::AppVersionCommon.find_platform(raw_data['versionSets']) platform['type'] end |
#update_availability!(availability) ⇒ Object
set the availability. This method doesn’t require ‘save` to be called
260 261 262 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 260 def update_availability!(availability) client.update_availability!(self.apple_id, availability) end |
#update_price_tier!(price_tier) ⇒ Object
set the price tier. This method doesn’t require ‘save` to be called
250 251 252 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 250 def update_price_tier!(price_tier) client.update_price_tier!(self.apple_id, price_tier) end |
#url ⇒ String
Returns An URL to this specific resource. You can enter this URL into your browser.
135 136 137 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 135 def url "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{self.apple_id}" end |
#version_set_for_platform(platform) ⇒ Object
110 111 112 113 114 115 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 110 def version_set_for_platform(platform) version_sets.each do |version_set| return version_set if version_set.platform == platform end nil end |
#versions_history ⇒ Object
195 196 197 198 199 200 201 202 |
# File 'spaceship/lib/spaceship/tunes/application.rb', line 195 def versions_history ensure_not_a_bundle versions = client.versions_history(apple_id, platform) versions.map do |attrs| attrs[:application] = self Tunes::AppVersionHistory.factory(attrs) end end |