Class: Deliver::App
- Inherits:
-
Object
- Object
- Deliver::App
- Defined in:
- lib/deliver/app.rb
Defined Under Namespace
Modules: AppStatus
Updating the App Metadata collapse
-
#metadata ⇒ Deliver::AppMetadata
Access to update the metadata of this app.
Instance Attribute Summary collapse
-
#app_identifier ⇒ Object
Returns the value of attribute app_identifier.
-
#apple_id ⇒ Object
Returns the value of attribute apple_id.
Interacting with iTunesConnect collapse
-
#get_app_status ⇒ Object
This method fetches the current app status from iTunesConnect.
-
#get_live_version ⇒ Object
This method fetches the app version of the latest published version This method may take some time to execute, since it uses frontend scripting under the hood.
-
#itc ⇒ Object
The iTC handler which is used to interact with the iTunesConnect backend.
Updating the App Metadata collapse
-
#get_metadata_directory ⇒ Object
The path to the directy in which the itmsp files will be downloaded.
-
#metadata_downloaded? ⇒ Boolean
Was the app metadata already downloaded?.
-
#set_metadata_directory(dir) ⇒ Object
Use this method to change the default download location for the metadata packages.
-
#upload_app_icon!(path) ⇒ Object
Uploads a new app icon to iTunesConnect.
-
#upload_apple_watch_app_icon!(path) ⇒ Object
Uploads a new apple watch app icon to iTunesConnect.
Destructive/Constructive methods collapse
-
#create_new_version!(version_number) ⇒ Object
This method creates a new version of your app using the iTunesConnect frontend.
-
#upload_metadata! ⇒ bool
This method has to be called, after modifying the values of .metadata.
Instance Method Summary collapse
-
#initialize(apple_id: nil, app_identifier: nil) ⇒ App
constructor
A new instance of App.
- #to_s ⇒ Object
Constructor Details
#initialize(apple_id: nil, app_identifier: nil) ⇒ App
Returns a new instance of App.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/deliver/app.rb', line 34 def initialize(apple_id: nil, app_identifier: nil) self.apple_id = (apple_id || '').to_s.gsub('id', '').to_i self.app_identifier = app_identifier if apple_id and not app_identifier # Fetch the app identifier based on the given Apple ID self.app_identifier = FastlaneCore::ItunesSearchApi.fetch_bundle_identifier(apple_id) elsif app_identifier and not apple_id # Fetch the Apple ID based on the given app identifier begin begin self.apple_id = FastlaneCore::ItunesSearchApi.fetch_by_identifier(app_identifier)['trackId'] rescue Helper.log.warn "App doesn't seem to be in the App Store yet or is not available in the US App Store. Using the iTC API instead." # Use the iTunes Connect API instead: make that default in the future self.apple_id = FastlaneCore::ItunesConnect.new.find_apple_id(app_identifier) raise "Couldn't find Apple ID" unless self.apple_id end rescue unless Helper.is_test? Helper.log.info "Could not find Apple ID based on the app identifier in the US App Store. Maybe the app is not yet in the store?".yellow Helper.log.info "You can provide the Apple ID of your app using `apple_id '974739333'` in your `Deliverfile`".green while ((self.apple_id || '').to_s.length == 0) || ((self.apple_id || 0).to_i == 0) self.apple_id = ask("\nApple ID of your app (e.g. 284882215): ") end else raise "Please pass a valid Apple ID using 'apple_id'".red end end end end |
Instance Attribute Details
#app_identifier ⇒ Object
Returns the value of attribute app_identifier.
3 4 5 |
# File 'lib/deliver/app.rb', line 3 def app_identifier @app_identifier end |
#apple_id ⇒ Object
Returns the value of attribute apple_id.
3 4 5 |
# File 'lib/deliver/app.rb', line 3 def apple_id @apple_id end |
#metadata ⇒ Deliver::AppMetadata
Access to update the metadata of this app
The first time accessing this, will take some time, since it’s downloading the latest version from iTC.
Don’t forget to call #upload_metadata! once you are finished
119 120 121 |
# File 'lib/deliver/app.rb', line 119 def @metadata end |
Instance Method Details
#create_new_version!(version_number) ⇒ Object
This method creates a new version of your app using the iTunesConnect frontend. This will happen directly after calling this method. the new version that should be created
151 152 153 |
# File 'lib/deliver/app.rb', line 151 def create_new_version!(version_number) itc.create_new_version!(self, version_number) end |
#get_app_status ⇒ Object
This method fetches the current app status from iTunesConnect. This method may take some time to execute, since it uses frontend scripting under the hood.
83 84 85 |
# File 'lib/deliver/app.rb', line 83 def get_app_status itc.get_app_status(self) end |
#get_live_version ⇒ Object
This method fetches the app version of the latest published version This method may take some time to execute, since it uses frontend scripting under the hood.
90 91 92 |
# File 'lib/deliver/app.rb', line 90 def get_live_version itc.get_live_version(self) end |
#get_metadata_directory ⇒ Object
Returns the path to the directy in which the itmsp files will be downloaded.
106 107 108 109 110 |
# File 'lib/deliver/app.rb', line 106 def return @metadata_dir if @metadata_dir return "./spec/fixtures/packages/" if Helper.is_test? return "./" end |
#itc ⇒ Object
The iTC handler which is used to interact with the iTunesConnect backend
76 77 78 |
# File 'lib/deliver/app.rb', line 76 def itc @itc ||= Deliver::ItunesConnect.new end |
#metadata_downloaded? ⇒ Boolean
Was the app metadata already downloaded?
124 125 126 |
# File 'lib/deliver/app.rb', line 124 def @metadata != nil end |
#set_metadata_directory(dir) ⇒ Object
Use this method to change the default download location for the metadata packages
100 101 102 103 |
# File 'lib/deliver/app.rb', line 100 def (dir) raise "Can not change metadata directory after accessing metadata of an app" if @metadata @metadata_dir = dir end |
#to_s ⇒ Object
67 68 69 |
# File 'lib/deliver/app.rb', line 67 def to_s "#{apple_id} - #{app_identifier}" end |
#upload_app_icon!(path) ⇒ Object
Uploads a new app icon to iTunesConnect. This uses a headless browser which makes this command quite slow.
132 133 134 |
# File 'lib/deliver/app.rb', line 132 def upload_app_icon!(path) itc.upload_app_icon!(self, path) end |
#upload_apple_watch_app_icon!(path) ⇒ Object
Uploads a new apple watch app icon to iTunesConnect. This uses a headless browser which makes this command quite slow.
139 140 141 |
# File 'lib/deliver/app.rb', line 139 def upload_apple_watch_app_icon!(path) itc.upload_apple_watch_app_icon!(self, path) end |
#upload_metadata! ⇒ bool
This method has to be called, after modifying the values of .metadata. It will take care of uploading all changes to Apple. This method might take a few minutes to run
161 162 163 164 165 |
# File 'lib/deliver/app.rb', line 161 def raise "You first have to modify the metadata using app.metadata.setDescription" unless @metadata self..upload! end |