Class: Spaceship::Tunes::AppVersion
- Defined in:
- spaceship/lib/spaceship/tunes/app_version.rb
Overview
Represents an editable version of an App Store Connect Application This can either be the live or the edit version retrieved via the app rubocop:disable Metrics/ClassLength
Promo codes collapse
-
#release_on_approval ⇒ Object
These methods takes care of properly parsing values that are not returned in the right format, e.g.
-
#supports_apple_watch ⇒ Bool
Does the binary contain a watch binary?.
Instance Attribute Summary collapse
-
#app_status ⇒ Spaceship::Tunes::AppStatus
readonly
What’s the current status of this app e.g.
-
#app_type ⇒ String
The appType number of this version.
-
#application ⇒ Spaceship::Tunes::Application
A reference to the application this version is for.
-
#auto_release_date ⇒ Fixnum
Milliseconds for releasing in GMT (e.g. 1480435200000 = Tue, 29 Nov 2016 16:00:00 GMT).
-
#build_version ⇒ String
Build Version.
- #can_beta_test ⇒ Bool
- #can_prepare_for_upload ⇒ Bool
- #can_reject_version ⇒ Bool
- #can_send_version_live ⇒ Bool
-
#copyright ⇒ String
The copyright information of this app.
-
#description ⇒ Hash
readonly
A hash representing the description in all languages.
-
#in_app_purchases ⇒ Hash
readonly
A hash representing all in-app purchases that can get submitted with this version.
-
#is_live ⇒ Bool
Is that the version that’s currently available in the App Store?.
-
#keywords ⇒ Hash
readonly
A hash representing the keywords in all languages.
-
#languages ⇒ Array
Raw access the all available languages.
-
#large_app_icon ⇒ Spaceship::Tunes::AppImage
The structure containing information about the large app icon (1024x1024).
-
#marketing_url ⇒ Hash
readonly
A hash representing the marketing url in all languages.
-
#phased_release ⇒ Hash
readonly
Represents the phased_release hash (read-only) For now, please use the ‘toggle_phased_release` method and call `.save!` as the API will probably change in the future.
-
#platform ⇒ String
The platform value of this version.
-
#promotional_text ⇒ Hash
readonly
A hash representing the promotionalText in all languages.
-
#ratings_reset ⇒ Bool
Should the rating of the app be reset?.
-
#raw_status ⇒ String
App Status (e.g. ‘readyForSale’).
-
#release_notes ⇒ Hash
readonly
The changelog.
-
#review_attachment_file ⇒ Spaceship::Tunes::AppReviewAttachment
The structure containing information about the review attachment file.
-
#review_demo_password ⇒ String
App Review Information Demo Account Password.
-
#review_demo_user ⇒ String
App Review Information Demo Account User Name.
-
#review_email ⇒ String
App Review Information Email Address.
-
#review_first_name ⇒ String
App Review Information.
-
#review_last_name ⇒ String
App Review Information Last Name.
-
#review_notes ⇒ String
App Review Information Notes.
-
#review_phone_number ⇒ String
App Review Information Phone Number.
-
#review_user_needed ⇒ Boolean
readonly
The checkbox that indicates if a demo account is needed.
-
#screenshots ⇒ Hash
readonly
Represents the screenshots of this app version (read-only).
-
#support_url ⇒ Hash
readonly
A hash representing the support url in all languages.
-
#trade_representative_address_line_1 ⇒ String
Trade Representative Contact Information Address Line 1.
-
#trade_representative_address_line_2 ⇒ String
Trade Representative Contact Information Address Line 2.
-
#trade_representative_address_line_3 ⇒ String
Trade Representative Contact Information Address Line 3.
-
#trade_representative_city_name ⇒ String
Trade Representative Contact Information City Name.
-
#trade_representative_country ⇒ String
Trade Representative Contact Information Country.
-
#trade_representative_email ⇒ String
Trade Representative Contact Information Email Address.
-
#trade_representative_first_name ⇒ String
Trade Representative Contact Information First Name.
-
#trade_representative_is_displayed_on_app_store ⇒ Boolean
Display Trade Representative Contact Information on the Korean App Store or not.
-
#trade_representative_last_name ⇒ String
Trade Representative Contact Information Last Name.
-
#trade_representative_phone_number ⇒ String
Trade Representative Contact Information Phone Number.
-
#trade_representative_postal_code ⇒ String
Trade Representative Contact Information Postal Code.
-
#trade_representative_state ⇒ String
Trade Representative Contact Information State.
-
#trade_representative_trade_name ⇒ String
Trade Representative Contact Information.
-
#trailers ⇒ Hash
readonly
Represents the trailers of this app version (read-only).
-
#transit_app_file ⇒ Spaceship::Tunes::TransitAppFile
GeoJson.
-
#version ⇒ String
The version number of this version.
-
#version_id ⇒ Integer
A unique ID for this version generated by App Store Connect.
-
#watch_app_icon ⇒ Spaceship::Tunes::AppImage
The structure containing information about the large watch icon (1024x1024).
Attributes inherited from Base
Promo codes collapse
Class Method Summary collapse
-
.factory(attrs) ⇒ Object
Create a new object based on a hash.
- .find(application, app_id, is_live, platform: nil) ⇒ Object
Instance Method Summary collapse
-
#candidate_builds ⇒ Object
Returns an array of all builds that can be sent to review.
-
#create_languages(languages) ⇒ Object
Call this method to make sure the given languages are available for this app You should call this method before accessing the name, description and other localized values This will create the new language if it’s not available yet and do nothing if everything’s there Important: Due to a bug you have to fetch the ‘edit_version` again, as it doesn’t get refreshed immediately.
- #current_build_number ⇒ Object
-
#generate_image_metadata(image_data, original_file_name) ⇒ Object
This method will generate the required keys/values for App Store Connect to validate the uploaded image.
-
#generate_review_attachment_file(review_attachment_data, review_attachment_file) ⇒ Object
This method will generate the required keys/values for App Store Connect to validate the review attachment file.
-
#is_live? ⇒ Bool
Is that version currently available in the App Store?.
- #release! ⇒ Object
- #release_to_all_users! ⇒ Object
-
#save! ⇒ Object
Push all changes that were made back to App Store Connect.
-
#select_build(build) ⇒ Object
Select a build to be submitted for Review.
-
#setup ⇒ Object
Private methods.
-
#toggle_phased_release(enabled: false) ⇒ Object
Currently phased_release doesn’t seem to have all the features enabled.
-
#unfold_languages ⇒ Object
Prefill name, keywords, etc…
-
#update_rating(hash) ⇒ Object
Set the age restriction rating Call it like this: v.update_rating({ ‘CARTOON_FANTASY_VIOLENCE’ => 0, ‘MATURE_SUGGESTIVE’ => 2, ‘UNRESTRICTED_WEB_ACCESS’ => 0, ‘GAMBLING_CONTESTS’ => 0 }).
-
#upload_geojson!(geojson_path) ⇒ Object
Uploads or removes the transit app file.
-
#upload_large_icon!(icon_path) ⇒ Object
Uploads or removes the large icon.
-
#upload_review_attachment!(review_attachment_path) ⇒ Object
Uploads, app review attachments.
-
#upload_screenshot!(screenshot_path, sort_order, language, device, is_messages) ⇒ Object
Uploads or removes a screenshot.
-
#upload_trailer!(trailer_path, sort_order, language, device, timestamp = "05.00", preview_image_path = nil) ⇒ Object
Uploads, removes a trailer video.
-
#upload_watch_icon!(icon_path) ⇒ Object
Uploads or removes the watch icon.
-
#url ⇒ String
An URL to this specific resource.
Methods inherited from TunesBase
Methods inherited from Base
attr_accessor, attr_mapping, attributes, #attributes, #initialize, #inspect, mapping_module, method_missing, set_client, #to_s
Constructor Details
This class inherits a constructor from Spaceship::Base
Instance Attribute Details
#app_status ⇒ Spaceship::Tunes::AppStatus (readonly)
Returns What’s the current status of this app e.g. Waiting for Review, Ready for Sale, …
38 39 40 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 38 def app_status @app_status end |
#app_type ⇒ String
Returns The appType number of this version.
34 35 36 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 34 def app_type @app_type end |
#application ⇒ Spaceship::Tunes::Application
Returns A reference to the application this version is for.
22 23 24 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 22 def application @application end |
#auto_release_date ⇒ Fixnum
Returns Milliseconds for releasing in GMT (e.g. 1480435200000 = Tue, 29 Nov 2016 16:00:00 GMT). Use nil to unset. Setting this will supercede the release_on_approval field, so this field must be nil for release_on_approval to be used.
64 65 66 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 64 def auto_release_date @auto_release_date end |
#build_version ⇒ String
Returns Build Version.
47 48 49 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 47 def build_version @build_version end |
#can_beta_test ⇒ Bool
70 71 72 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 70 def can_beta_test @can_beta_test end |
#can_prepare_for_upload ⇒ Bool
53 54 55 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 53 def can_prepare_for_upload @can_prepare_for_upload end |
#can_reject_version ⇒ Bool
50 51 52 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 50 def can_reject_version @can_reject_version end |
#can_send_version_live ⇒ Bool
56 57 58 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 56 def can_send_version_live @can_send_version_live end |
#copyright ⇒ String
Returns The copyright information of this app.
31 32 33 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 31 def copyright @copyright end |
#description ⇒ Hash (readonly)
Returns A hash representing the description in all languages.
178 179 180 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 178 def description @description end |
#in_app_purchases ⇒ Hash (readonly)
Returns A hash representing all in-app purchases that can get submitted with this version.
196 197 198 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 196 def in_app_purchases @in_app_purchases end |
#is_live ⇒ Bool
Returns Is that the version that’s currently available in the App Store?.
41 42 43 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 41 def is_live @is_live end |
#keywords ⇒ Hash (readonly)
Returns A hash representing the keywords in all languages.
172 173 174 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 172 def keywords @keywords end |
#languages ⇒ Array
Returns Raw access the all available languages. You shouldn’t use it probably.
169 170 171 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 169 def languages @languages end |
#large_app_icon ⇒ Spaceship::Tunes::AppImage
Returns the structure containing information about the large app icon (1024x1024).
76 77 78 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 76 def large_app_icon @large_app_icon end |
#marketing_url ⇒ Hash (readonly)
Returns A hash representing the marketing url in all languages.
187 188 189 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 187 def marketing_url @marketing_url end |
#phased_release ⇒ Hash (readonly)
Returns Represents the phased_release hash (read-only) For now, please use the ‘toggle_phased_release` method and call `.save!` as the API will probably change in the future.
201 202 203 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 201 def phased_release @phased_release end |
#platform ⇒ String
Returns The platform value of this version.
25 26 27 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 25 def platform @platform end |
#promotional_text ⇒ Hash (readonly)
Returns A hash representing the promotionalText in all languages.
175 176 177 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 175 def promotional_text @promotional_text end |
#ratings_reset ⇒ Bool
Returns Should the rating of the app be reset?.
67 68 69 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 67 def @ratings_reset end |
#raw_status ⇒ String
Returns App Status (e.g. ‘readyForSale’). You should use ‘app_status` instead.
44 45 46 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 44 def raw_status @raw_status end |
#release_notes ⇒ Hash (readonly)
Returns The changelog.
181 182 183 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 181 def release_notes @release_notes end |
#release_on_approval ⇒ Object
These methods takes care of properly parsing values that are not returned in the right format, e.g. boolean as string
59 60 61 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 59 def release_on_approval @release_on_approval end |
#review_attachment_file ⇒ Spaceship::Tunes::AppReviewAttachment
Returns the structure containing information about the review attachment file.
85 86 87 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 85 def @review_attachment_file end |
#review_demo_password ⇒ String
Returns App Review Information Demo Account Password.
159 160 161 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 159 def review_demo_password @review_demo_password end |
#review_demo_user ⇒ String
Returns App Review Information Demo Account User Name.
156 157 158 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 156 def review_demo_user @review_demo_user end |
#review_email ⇒ String
Returns App Review Information Email Address.
148 149 150 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 148 def review_email @review_email end |
#review_first_name ⇒ String
App Review Information
139 140 141 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 139 def review_first_name @review_first_name end |
#review_last_name ⇒ String
Returns App Review Information Last Name.
142 143 144 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 142 def review_last_name @review_last_name end |
#review_notes ⇒ String
Returns App Review Information Notes.
162 163 164 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 162 def review_notes @review_notes end |
#review_phone_number ⇒ String
Returns App Review Information Phone Number.
145 146 147 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 145 def review_phone_number @review_phone_number end |
#review_user_needed ⇒ Boolean (readonly)
Returns The checkbox that indicates if a demo account is needed. Is set automatically depending on if a user and pass are set.
153 154 155 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 153 def review_user_needed @review_user_needed end |
#screenshots ⇒ Hash (readonly)
Returns Represents the screenshots of this app version (read-only).
190 191 192 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 190 def screenshots @screenshots end |
#support_url ⇒ Hash (readonly)
Returns A hash representing the support url in all languages.
184 185 186 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 184 def support_url @support_url end |
#supports_apple_watch ⇒ Bool
Returns Does the binary contain a watch binary?.
73 74 75 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 73 def supports_apple_watch @supports_apple_watch end |
#trade_representative_address_line_1 ⇒ String
Returns Trade Representative Contact Information Address Line 1.
106 107 108 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 106 def trade_representative_address_line_1 @trade_representative_address_line_1 end |
#trade_representative_address_line_2 ⇒ String
Returns Trade Representative Contact Information Address Line 2.
109 110 111 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 109 def trade_representative_address_line_2 @trade_representative_address_line_2 end |
#trade_representative_address_line_3 ⇒ String
Returns Trade Representative Contact Information Address Line 3.
112 113 114 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 112 def trade_representative_address_line_3 @trade_representative_address_line_3 end |
#trade_representative_city_name ⇒ String
Returns Trade Representative Contact Information City Name.
115 116 117 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 115 def trade_representative_city_name @trade_representative_city_name end |
#trade_representative_country ⇒ String
Returns Trade Representative Contact Information Country.
121 122 123 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 121 def trade_representative_country @trade_representative_country end |
#trade_representative_email ⇒ String
Returns Trade Representative Contact Information Email Address.
130 131 132 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 130 def trade_representative_email @trade_representative_email end |
#trade_representative_first_name ⇒ String
Returns Trade Representative Contact Information First Name.
100 101 102 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 100 def trade_representative_first_name @trade_representative_first_name end |
#trade_representative_is_displayed_on_app_store ⇒ Boolean
Returns Display Trade Representative Contact Information on the Korean App Store or not.
133 134 135 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 133 def trade_representative_is_displayed_on_app_store @trade_representative_is_displayed_on_app_store end |
#trade_representative_last_name ⇒ String
Returns Trade Representative Contact Information Last Name.
103 104 105 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 103 def trade_representative_last_name @trade_representative_last_name end |
#trade_representative_phone_number ⇒ String
Returns Trade Representative Contact Information Phone Number.
127 128 129 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 127 def trade_representative_phone_number @trade_representative_phone_number end |
#trade_representative_postal_code ⇒ String
Returns Trade Representative Contact Information Postal Code.
124 125 126 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 124 def trade_representative_postal_code @trade_representative_postal_code end |
#trade_representative_state ⇒ String
Returns Trade Representative Contact Information State.
118 119 120 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 118 def trade_representative_state @trade_representative_state end |
#trade_representative_trade_name ⇒ String
Trade Representative Contact Information
97 98 99 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 97 def trade_representative_trade_name @trade_representative_trade_name end |
#trailers ⇒ Hash (readonly)
Returns Represents the trailers of this app version (read-only).
193 194 195 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 193 def trailers @trailers end |
#transit_app_file ⇒ Spaceship::Tunes::TransitAppFile
GeoJson
91 92 93 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 91 def transit_app_file @transit_app_file end |
#version ⇒ String
Returns The version number of this version.
28 29 30 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 28 def version @version end |
#version_id ⇒ Integer
Returns a unique ID for this version generated by App Store Connect.
82 83 84 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 82 def version_id @version_id end |
#watch_app_icon ⇒ Spaceship::Tunes::AppImage
Returns the structure containing information about the large watch icon (1024x1024).
79 80 81 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 79 def watch_app_icon @watch_app_icon end |
Class Method Details
.factory(attrs) ⇒ Object
Create a new object based on a hash. This is used to create a new object based on the server response.
275 276 277 278 279 280 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 275 def factory(attrs) obj = self.new(attrs) obj.unfold_languages return obj end |
.find(application, app_id, is_live, platform: nil) ⇒ Object
285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 285 def find(application, app_id, is_live, platform: nil) # we only support applications raise "We do not support BUNDLE types right now" if application.type == 'BUNDLE' # too bad the "id" field is empty, it forces us to make more requests to the server # these could also be cached attrs = client.app_version(app_id, is_live, platform: platform) return nil unless attrs attrs[:application] = application attrs[:is_live] = is_live return self.factory(attrs) end |
Instance Method Details
#candidate_builds ⇒ Object
Returns an array of all builds that can be sent to review
346 347 348 349 350 351 352 353 354 355 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 346 def candidate_builds res = client.candidate_builds(self.application.apple_id, self.version_id) builds = [] res.each do |attrs| next unless attrs["type"] == "BUILD" # I don't know if it can be something else. attrs[:apple_id] = self.application.apple_id builds << Tunes::Build.factory(attrs) end return builds end |
#create_languages(languages) ⇒ Object
Call this method to make sure the given languages are available for this app You should call this method before accessing the name, description and other localized values This will create the new language if it’s not available yet and do nothing if everything’s there Important: Due to a bug you have to fetch the ‘edit_version` again, as it doesn’t get refreshed immediately
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 314 def create_languages(languages) languages = [languages] if languages.kind_of?(String) raise "Please pass an array" unless languages.kind_of?(Array) copy_from = self.languages.find { |a| a['language'] == 'en-US' } || self.languages.first languages.each do |language| # First, see if it's already available found = self.languages.find do |local| local['language'] == language end next if found new_language = copy_from.clone new_language['language'] = language self.languages << new_language end nil end |
#current_build_number ⇒ Object
335 336 337 338 339 340 341 342 343 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 335 def current_build_number if self.is_live? build_version else if candidate_builds.length > 0 candidate_builds.sort_by(&:upload_date).last.build_version end end end |
#generate_image_metadata(image_data, original_file_name) ⇒ Object
This method will generate the required keys/values for App Store Connect to validate the uploaded image
437 438 439 440 441 442 443 444 445 446 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 437 def (image_data, original_file_name) { assetToken: image_data["token"], originalFileName: original_file_name, size: image_data["length"], height: image_data["height"], width: image_data["width"], checksum: image_data["md5"] } end |
#generate_promocodes!(quantity) ⇒ Object
686 687 688 689 690 691 692 693 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 686 def generate_promocodes!(quantity) data = client.generate_app_version_promocodes!( app_id: self.application.apple_id, version_id: self.version_id, quantity: quantity ) Tunes::AppVersionGeneratedPromocodes.factory(data) end |
#generate_review_attachment_file(review_attachment_data, review_attachment_file) ⇒ Object
This method will generate the required keys/values for App Store Connect to validate the review attachment file
450 451 452 453 454 455 456 457 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 450 def (, ) { assetToken: ["token"], name: File.basename(), fileType: Utilities.content_type(), url: nil } end |
#is_live? ⇒ Bool
Returns Is that version currently available in the App Store?.
302 303 304 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 302 def is_live? is_live end |
#reject! ⇒ Object
705 706 707 708 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 705 def reject! raise 'Version not rejectable' unless can_reject_version client.reject!(self.application.apple_id, self.version_id) end |
#release! ⇒ Object
675 676 677 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 675 def release! client.release!(self.application.apple_id, self.version_id) end |
#release_to_all_users! ⇒ Object
679 680 681 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 679 def release_to_all_users! client.release_to_all_users!(self.application.apple_id, self.version_id) end |
#save! ⇒ Object
Push all changes that were made back to App Store Connect
411 412 413 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 411 def save! client.update_app_version!(application.apple_id, self.version_id, raw_data) end |
#select_build(build) ⇒ Object
Select a build to be submitted for Review. You have to pass a build you got from - candidate_builds Don’t forget to call save! after calling this method
360 361 362 363 364 365 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 360 def select_build(build) raw_data.set(['preReleaseBuildVersionString', 'value'], build.build_version) raw_data.set(['preReleaseBuildTrainVersionString'], build.train_version) raw_data.set(['preReleaseBuildUploadDate'], build.upload_date) true end |
#setup ⇒ Object
Private methods
423 424 425 426 427 428 429 430 431 432 433 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 423 def setup status = raw_data['status'] @app_status = Tunes::AppStatus.get_from_string(status) setup_large_app_icon setup_watch_app_icon if setup_transit_app_file if supports_app_transit? setup_screenshots setup_trailers end |
#toggle_phased_release(enabled: false) ⇒ Object
Currently phased_release doesn’t seem to have all the features enabled
=> {"state"=>{"value"=>"NOT_STARTED", "isEditable"=>true, "isRequired"=>false, "errorKeys"=>nil},
"startDate"=>nil,
"lastPaused"=>nil,
"pausedDuration"=>nil,
"totalPauseDays"=>30,
"currentDayNumber"=>nil,
"dayPercentageMap"=>{"1"=>1, "2"=>2, "3"=>5, "4"=>10, "5"=>20, "6"=>50, "7"=>100},
"isEnabled"=>true}
214 215 216 217 218 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 214 def toggle_phased_release(enabled: false) state = (enabled ? "INACTIVE" : "NOT_STARTED") self.phased_release["state"]["value"] = state end |
#unfold_languages ⇒ Object
Prefill name, keywords, etc…
662 663 664 665 666 667 668 669 670 671 672 673 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 662 def unfold_languages { keywords: :keywords, description: :description, supportUrl: :support_url, marketingUrl: :marketing_url, releaseNotes: :release_notes, promotionalText: :promotional_text }.each do |json, attribute| instance_variable_set("@#{attribute}".to_sym, LanguageItem.new(json, languages)) end end |
#update_rating(hash) ⇒ Object
Set the age restriction rating Call it like this: v.update_rating(
'CARTOON_FANTASY_VIOLENCE' => 0,
'MATURE_SUGGESTIVE' => 2,
'UNRESTRICTED_WEB_ACCESS' => 0,
'GAMBLING_CONTESTS' => 0
)
Available Values docs.fastlane.tools/actions/deliver/#reference
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 378 def (hash) raise "Must be a hash" unless hash.kind_of?(Hash) hash.each do |key, value| to_edit = self.raw_data['ratings']['nonBooleanDescriptors'].find do |current| current['name'].include?(key) end if to_edit to_set = "NONE" if value == 0 to_set = "INFREQUENT_MILD" if value == 1 to_set = "FREQUENT_INTENSE" if value == 2 raise "Invalid value '#{value}' for '#{key}', must be 0-2" unless to_set to_edit['level'] = "ITC.apps.ratings.level.#{to_set}" else # Maybe it's a boolean descriptor? to_edit = self.raw_data['ratings']['booleanDescriptors'].find do |current| current['name'].include?(key) end if to_edit to_set = "NO" to_set = "YES" if value.to_i > 0 to_edit['level'] = "ITC.apps.ratings.level.#{to_set}" else raise "Could not find option '#{key}' in the list of available options" end end end true end |
#upload_geojson!(geojson_path) ⇒ Object
Uploads or removes the transit app file
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 487 def upload_geojson!(geojson_path) unless geojson_path raw_data["transitAppFile"]["value"] = nil @transit_app_file = nil return end upload_file = UploadFile.from_path(geojson_path) geojson_data = client.upload_geojson(self, upload_file) @transit_app_file = Tunes::TransitAppFile.factory({}) if @transit_app_file.nil? @transit_app_file .url = nil # response.headers['Location'] @transit_app_file.asset_token = geojson_data["token"] @transit_app_file.name = upload_file.file_name @transit_app_file.time_stamp = Time.now.to_i * 1000 # works without but... end |
#upload_large_icon!(icon_path) ⇒ Object
Uploads or removes the large icon
461 462 463 464 465 466 467 468 469 470 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 461 def upload_large_icon!(icon_path) unless icon_path @large_app_icon.reset! return end upload_image = UploadFile.from_path(icon_path) image_data = client.upload_large_icon(self, upload_image) raw_data["largeAppIcon"]["value"] = (image_data, upload_image.file_name) end |
#upload_review_attachment!(review_attachment_path) ⇒ Object
Uploads, app review attachments
while submitting for review, ITC allow developers to attach file.
Following list can be found at appstoreconnect.apple.com on iOS app edit version, above the attachment label/button there is a question mark if it is press the a dialog is shown which has the list.
File types allowed by Apple are: pdf, doc, docx, rtf, pages, xls, xlsx, numbers zip, rar, plist, crash, jpg, png, mp4 or avi.
646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 646 def () raise 'cannot upload review attachment for live edition.' if self.is_live? if ! || .size < 1 @review_attachment_file.reset! return end raise "cannot find file: #{}." unless File.exist?() = UploadFile.from_path() = client.(self, ) raw_data["appReviewInfo"]["attachmentFiles"]["value"] = (, ) end |
#upload_screenshot!(screenshot_path, sort_order, language, device, is_messages) ⇒ Object
Uploads or removes a screenshot
509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 509 def upload_screenshot!(screenshot_path, sort_order, language, device, ) raise "sort_order must be higher than 0" unless sort_order > 0 raise "sort_order must not be > 10" if sort_order > 10 # this will also check both language and device parameters device_lang_screenshots = screenshots_data_for_language_and_device(language, device, )["value"] existing_sort_orders = device_lang_screenshots.map { |s| s["value"]["sortOrder"] } if screenshot_path # adding / replacing upload_file = UploadFile.from_path(screenshot_path) screenshot_data = client.upload_screenshot(self, upload_file, device, ) # Since October 2016 we also need to pass the size, height, width and checksum # otherwise App Store Connect validation will fail at a later point new_screenshot = { "value" => { "assetToken" => screenshot_data["token"], "sortOrder" => sort_order, "originalFileName" => upload_file.file_name, "size" => screenshot_data["length"], "height" => screenshot_data["height"], "width" => screenshot_data["width"], "checksum" => screenshot_data["md5"] } } # We disable "scaling" for this device type / language combination # We only set this, if we actually successfully uploaded a new screenshot # for this device / language combination # if this value is not set, iTC will fallback to another device type for screenshots language_details = raw_data_details.find { |d| d["language"] == language }["displayFamilies"]["value"] device_language_details = language_details.find { |display_family| display_family['name'] == device } scaled_key = ? "messagesScaled" : "scaled" device_language_details[scaled_key]["value"] = false if existing_sort_orders.include?(sort_order) # replace device_lang_screenshots[existing_sort_orders.index(sort_order)] = new_screenshot else # add device_lang_screenshots << new_screenshot end else # removing raise "cannot remove screenshot with nonexistent sort_order" unless existing_sort_orders.include?(sort_order) device_lang_screenshots.delete_at(existing_sort_orders.index(sort_order)) end setup_screenshots end |
#upload_trailer!(trailer_path, sort_order, language, device, timestamp = "05.00", preview_image_path = nil) ⇒ Object
Uploads, removes a trailer video
A preview image for the video is required by ITC and is usually automatically extracted by your browser. This method will either automatically extract it from the video (using ‘ffmpeg`) or allow you to specify it using preview_image_path
. If the preview image is specified, `ffmpeg` will not be used. The image resolution will be checked against expectations (which might be different from the trailer resolution.
It is recommended to extract the preview image using the spaceship related tools in order to ensure the appropriate format and resolution are used.
Note: to extract its resolution and a screenshot preview, the ‘ffmpeg` tool will be used
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 574 def upload_trailer!(trailer_path, sort_order, language, device, = "05.00", preview_image_path = nil) raise "No app trailer supported for iphone35" if device == 'iphone35' raise "sort_order must be higher than 0" unless sort_order > 0 raise "sort_order must not be > 3" if sort_order > 3 device_lang_trailers = trailer_data_for_language_and_device(language, device)["value"] existing_sort_orders = device_lang_trailers.map { |s| s["value"]["sortPosition"] } if trailer_path # adding / replacing trailer raise "Invalid timestamp #{}" if ( =~ /^[0-9][0-9].[0-9][0-9]$/).nil? if preview_image_path check_preview_screenshot_resolution(preview_image_path, device) video_preview_path = preview_image_path else # IDEA: optimization, we could avoid fetching the screenshot if the timestamp hasn't changed video_preview_resolution = video_preview_resolution_for(device, trailer_path) # Keep a reference of the video_preview here to avoid Ruby getting rid of the Tempfile in the meanwhile video_preview = Utilities.grab_video_preview(trailer_path, , video_preview_resolution) video_preview_path = video_preview.path end video_preview_file = UploadFile.from_path(video_preview_path) video_preview_data = client.upload_trailer_preview(self, video_preview_file, device) upload_file = UploadFile.from_path(trailer_path) trailer_data = client.upload_trailer(self, upload_file) ts = "00:00:#{}" ts[8] = ':' new_trailer = { "value" => { "videoAssetToken" => trailer_data["responses"][0]["token"], "descriptionXML" => trailer_data["responses"][0]["descriptionDoc"], "contentType" => upload_file.content_type, "sortPosition" => sort_order, "size" => video_preview_data["length"], "width" => video_preview_data["width"], "height" => video_preview_data["height"], "checksum" => video_preview_data["md5"], "pictureAssetToken" => video_preview_data["token"], "previewFrameTimeCode" => ts.to_s, "isPortrait" => Utilities.portrait?(video_preview_path) } } if existing_sort_orders.include?(sort_order) # replace device_lang_trailers[existing_sort_orders.index(sort_order)] = new_trailer else # add device_lang_trailers << new_trailer end else # removing trailer raise "cannot remove trailer with nonexistent sort_order" unless existing_sort_orders.include?(sort_order) device_lang_trailers.delete_at(existing_sort_orders.index(sort_order)) end setup_trailers end |
#upload_watch_icon!(icon_path) ⇒ Object
Uploads or removes the watch icon
474 475 476 477 478 479 480 481 482 483 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 474 def upload_watch_icon!(icon_path) unless icon_path @watch_app_icon.reset! return end upload_image = UploadFile.from_path(icon_path) image_data = client.upload_watch_icon(self, upload_image) raw_data["watchAppIcon"]["value"] = (image_data, upload_image.file_name) end |
#url ⇒ String
Returns An URL to this specific resource. You can enter this URL into your browser.
416 417 418 419 420 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 416 def url url = "https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{application.apple_id}/#{self.platform}/versioninfo/" url += "deliverable" if self.is_live? return url end |