Class: Spaceship::Tunes::Application
- Defined in:
- lib/spaceship/tunes/application.rb
Builds collapse
-
#pre_processing_builds ⇒ Array
A list of all pre-processing builds These are all build that have no information except the upload date.
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).
-
#platform ⇒ String
The supported platform of this app.
-
#vendor_id ⇒ String
The Vendor ID provided by iTunes Connect.
Attributes inherited from Base
Getting information collapse
-
#edit_version ⇒ Spaceship::AppVersion
Receive the version that can fully be edited.
-
#latest_version ⇒ Spaceship::AppVersion
This will return the ‘edit_version` if available and fallback to the `edit_version`.
-
#live_version ⇒ Spaceship::AppVersion
Receive the version that is currently live on the App Store.
-
#resolution_center ⇒ Hash
Contains the reason for rejection.
-
#url ⇒ String
An URL to this specific resource.
Modifying collapse
-
#create_version!(version_number) ⇒ Object
Create a new version of your app.
Builds collapse
-
#all_processing_builds ⇒ Array
This will return an array of all processing builds this include pre-processing or standard processing.
-
#build_trains ⇒ Hash
A reference to all the build trains.
-
#builds ⇒ Object
Get all builds that are already processed for all build trains You can either use the return value (array) or pass a block.
Submit for Review collapse
-
#cancel_all_testflight_submissions! ⇒ Object
Cancels all ongoing TestFlight beta submission for this application.
- #create_submission ⇒ Object
General collapse
Testers collapse
-
#add_all_testers! ⇒ Object
Add all testers (internal and external) to the current app list.
-
#add_external_tester!(email: nil, first_name: nil, last_name: nil) ⇒ Object
Add external tester to the current app list, if it doesn’t exist will be created.
-
#external_testers ⇒ Array
Returns all external testers available for this app.
-
#find_external_tester(identifier) ⇒ Spaceship::Tunes::Tester.external
Returns the external tester matching the parameter as either the Tester id or email.
-
#find_internal_tester(identifier) ⇒ Spaceship::Tunes::Tester.internal
Returns the internal tester matching the parameter as either the Tester id or email.
-
#internal_testers ⇒ Array
Returns all internal testers available for this app.
-
#remove_external_tester!(identifier) ⇒ Object
Remove external tester from the current app list that matching the parameter as either the Tester id or email.
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) ⇒ Object
Creates a new application on iTunes Connect.
-
.factory(attrs) ⇒ Object
Create a new object based on a hash.
-
.find(identifier) ⇒ 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_mapping, #client, #initialize, #inspect, mapping_module, method_missing, set_client
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.
41 42 43 |
# File 'lib/spaceship/tunes/application.rb', line 41 def app_icon_preview_url @app_icon_preview_url end |
#apple_id ⇒ String
Returns The App identifier of this app, provided by iTunes Connect.
8 9 10 |
# File 'lib/spaceship/tunes/application.rb', line 8 def apple_id @apple_id end |
#bundle_id ⇒ String
Returns The bundle_id (app identifier) of your app.
28 29 30 |
# File 'lib/spaceship/tunes/application.rb', line 28 def bundle_id @bundle_id end |
#issues_count ⇒ Integer
Returns The number of issues provided by iTunes Connect.
34 35 36 |
# File 'lib/spaceship/tunes/application.rb', line 34 def issues_count @issues_count end |
#last_modified ⇒ String
Returns Last modified.
31 32 33 |
# File 'lib/spaceship/tunes/application.rb', line 31 def last_modified @last_modified end |
#name ⇒ String
Returns The name you provided for this app (in the default language).
13 14 15 |
# File 'lib/spaceship/tunes/application.rb', line 13 def name @name end |
#platform ⇒ String
Returns the supported platform of this app.
18 19 20 |
# File 'lib/spaceship/tunes/application.rb', line 18 def platform @platform end |
#pre_processing_builds ⇒ Array
Returns A list of all pre-processing builds These are all build that have no information except the upload date.
45 46 47 |
# File 'lib/spaceship/tunes/application.rb', line 45 def pre_processing_builds @pre_processing_builds end |
#vendor_id ⇒ String
Returns The Vendor ID provided by iTunes Connect.
23 24 25 |
# File 'lib/spaceship/tunes/application.rb', line 23 def vendor_id @vendor_id end |
Class Method Details
.all ⇒ Array
Returns all apps available for this account
66 67 68 |
# File 'lib/spaceship/tunes/application.rb', line 66 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) ⇒ Object
Creates a new application on iTunes Connect
88 89 90 91 92 93 94 95 |
# File 'lib/spaceship/tunes/application.rb', line 88 def create!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil) client.create_application!(name: name, primary_language: primary_language, version: version, sku: sku, bundle_id: bundle_id, bundle_id_suffix: bundle_id_suffix) end |
.factory(attrs) ⇒ Object
Create a new object based on a hash. This is used to create a new object based on the server response.
61 62 63 |
# File 'lib/spaceship/tunes/application.rb', line 61 def factory(attrs) self.new(attrs) end |
.find(identifier) ⇒ Spaceship::Tunes::Application
Returns the application matching the parameter as either the App ID or the bundle identifier
72 73 74 75 76 |
# File 'lib/spaceship/tunes/application.rb', line 72 def find(identifier) all.find do |app| (app.apple_id == identifier.to_s or app.bundle_id == identifier) end end |
Instance Method Details
#add_all_testers! ⇒ Object
Add all testers (internal and external) to the current app list
240 241 242 243 |
# File 'lib/spaceship/tunes/application.rb', line 240 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 |
#add_external_tester!(email: nil, first_name: nil, last_name: nil) ⇒ Object
Add external tester to the current app list, if it doesn’t exist will be created
273 274 275 276 277 278 279 280 |
# File 'lib/spaceship/tunes/application.rb', line 273 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 |
#all_processing_builds ⇒ Array
Returns This will return an array of all processing builds this include pre-processing or standard processing.
178 179 180 181 182 183 184 185 186 187 188 |
# File 'lib/spaceship/tunes/application.rb', line 178 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 |
#build_trains ⇒ Hash
A reference to all the build trains
161 162 163 |
# File 'lib/spaceship/tunes/application.rb', line 161 def build_trains Tunes::BuildTrain.all(self, self.apple_id) end |
#builds ⇒ Object
Get all builds that are already processed for all build trains You can either use the return value (array) or pass a block
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/spaceship/tunes/application.rb', line 192 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 |
#cancel_all_testflight_submissions! ⇒ Object
Cancels all ongoing TestFlight beta submission for this application
217 218 219 220 221 222 223 224 225 226 |
# File 'lib/spaceship/tunes/application.rb', line 217 def cancel_all_testflight_submissions! self.builds do |build| begin build.cancel_beta_review! rescue => ex # We really don't care about any errors here end end true end |
#create_submission ⇒ Object
207 208 209 210 211 212 213 214 |
# File 'lib/spaceship/tunes/application.rb', line 207 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, self.apple_id, version) end |
#create_version!(version_number) ⇒ Object
Create a new version of your app
143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/spaceship/tunes/application.rb', line 143 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) # Since we have stored the outdated raw_data, we need to refresh this object # otherwise `edit_version` will return nil # TODO: implemented -reload method end |
#edit_version ⇒ Spaceship::AppVersion
Returns Receive the version that can fully be edited.
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/spaceship/tunes/application.rb', line 109 def edit_version # Apple's server will respond with the same version if there is only one, for both v=live and v= # That's why we have to check in the app_summary.json request if there are 2 versions or just one # if there is only one version, we'll return nil if raw_data['versions'].count == 1 return nil # only live version, user should create a new version end Spaceship::AppVersion.find(self, self.apple_id, false) end |
#external_testers ⇒ Array
Returns all external testers available for this app
246 247 248 |
# File 'lib/spaceship/tunes/application.rb', line 246 def external_testers Tunes::Tester.external.all_by_app(self.apple_id) end |
#find_external_tester(identifier) ⇒ Spaceship::Tunes::Tester.external
Returns the external tester matching the parameter as either the Tester id or email
258 259 260 |
# File 'lib/spaceship/tunes/application.rb', line 258 def find_external_tester(identifier) Tunes::Tester.external.find_by_app(self.apple_id, identifier) end |
#find_internal_tester(identifier) ⇒ Spaceship::Tunes::Tester.internal
Returns the internal tester matching the parameter as either the Tester id or email
265 266 267 |
# File 'lib/spaceship/tunes/application.rb', line 265 def find_internal_tester(identifier) Tunes::Tester.internal.find_by_app(self.apple_id, identifier) end |
#internal_testers ⇒ Array
Returns all internal testers available for this app
251 252 253 |
# File 'lib/spaceship/tunes/application.rb', line 251 def internal_testers Tunes::Tester.internal.all_by_app(self.apple_id) end |
#latest_version ⇒ Spaceship::AppVersion
Returns This will return the ‘edit_version` if available and fallback to the `edit_version`. Use this to just access the latest data.
122 123 124 |
# File 'lib/spaceship/tunes/application.rb', line 122 def latest_version edit_version || live_version end |
#live_version ⇒ Spaceship::AppVersion
Returns Receive the version that is currently live on the App Store. You can’t modify all values there, so be careful.
104 105 106 |
# File 'lib/spaceship/tunes/application.rb', line 104 def live_version v = Spaceship::AppVersion.find(self, self.apple_id, true) end |
#remove_external_tester!(identifier) ⇒ Object
Remove external tester from the current app list that matching the parameter
as either the Tester id or email
285 286 287 288 289 290 291 |
# File 'lib/spaceship/tunes/application.rb', line 285 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 |
#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”=>[]}`.
134 135 136 |
# File 'lib/spaceship/tunes/application.rb', line 134 def resolution_center client.get_resolution_center(apple_id) end |
#setup ⇒ Object
231 232 233 |
# File 'lib/spaceship/tunes/application.rb', line 231 def setup end |
#url ⇒ String
Returns An URL to this specific resource. You can enter this URL into your browser.
127 128 129 |
# File 'lib/spaceship/tunes/application.rb', line 127 def url "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{self.apple_id}" end |