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.
-
#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_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 indiciates 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 unqiue 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.
-
#is_live? ⇒ Bool
Is that version currently available in the App Store?.
- #release! ⇒ 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_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, …
36 37 38 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 36 def app_status @app_status end |
#app_type ⇒ String
Returns The appType number of this version.
32 33 34 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 32 def app_type @app_type end |
#application ⇒ Spaceship::Tunes::Application
Returns A reference to the application this version is for.
20 21 22 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 20 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.
62 63 64 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 62 def auto_release_date @auto_release_date end |
#build_version ⇒ String
Returns Build Version.
45 46 47 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 45 def build_version @build_version end |
#can_beta_test ⇒ Bool
68 69 70 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 68 def can_beta_test @can_beta_test end |
#can_prepare_for_upload ⇒ Bool
51 52 53 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 51 def can_prepare_for_upload @can_prepare_for_upload end |
#can_reject_version ⇒ Bool
48 49 50 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 48 def can_reject_version @can_reject_version end |
#can_send_version_live ⇒ Bool
54 55 56 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 54 def can_send_version_live @can_send_version_live end |
#copyright ⇒ String
Returns The copyright information of this app.
29 30 31 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 29 def copyright @copyright end |
#description ⇒ Hash (readonly)
Returns A hash representing the description in all languages.
173 174 175 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 173 def description @description end |
#is_live ⇒ Bool
Returns Is that the version that’s currently available in the App Store?.
39 40 41 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 39 def is_live @is_live end |
#keywords ⇒ Hash (readonly)
Returns A hash representing the keywords in all languages.
167 168 169 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 167 def keywords @keywords end |
#languages ⇒ Array
Returns Raw access the all available languages. You shouldn’t use it probably.
164 165 166 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 164 def languages @languages end |
#large_app_icon ⇒ Spaceship::Tunes::AppImage
Returns the structure containing information about the large app icon (1024x1024).
74 75 76 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 74 def large_app_icon @large_app_icon end |
#marketing_url ⇒ Hash (readonly)
Returns A hash representing the marketing url in all languages.
182 183 184 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 182 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.
193 194 195 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 193 def phased_release @phased_release end |
#platform ⇒ String
Returns The platform value of this version.
23 24 25 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 23 def platform @platform end |
#promotional_text ⇒ Hash (readonly)
Returns A hash representing the promotionalText in all languages.
170 171 172 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 170 def promotional_text @promotional_text end |
#ratings_reset ⇒ Bool
Returns Should the rating of the app be reset?.
65 66 67 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 65 def @ratings_reset end |
#raw_status ⇒ String
Returns App Status (e.g. ‘readyForSale’). You should use ‘app_status` instead.
42 43 44 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 42 def raw_status @raw_status end |
#release_notes ⇒ Hash (readonly)
Returns The changelog.
176 177 178 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 176 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
57 58 59 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 57 def release_on_approval @release_on_approval end |
#review_demo_password ⇒ String
Returns App Review Information Demo Account Password.
154 155 156 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 154 def review_demo_password @review_demo_password end |
#review_demo_user ⇒ String
Returns App Review Information Demo Account User Name.
151 152 153 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 151 def review_demo_user @review_demo_user end |
#review_email ⇒ String
Returns App Review Information Email Address.
143 144 145 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 143 def review_email @review_email end |
#review_first_name ⇒ String
App Review Information
134 135 136 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 134 def review_first_name @review_first_name end |
#review_last_name ⇒ String
Returns App Review Information Last Name.
137 138 139 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 137 def review_last_name @review_last_name end |
#review_notes ⇒ String
Returns App Review Information Notes.
157 158 159 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 157 def review_notes @review_notes end |
#review_phone_number ⇒ String
Returns App Review Information Phone Number.
140 141 142 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 140 def review_phone_number @review_phone_number end |
#review_user_needed ⇒ Boolean (readonly)
Returns The checkbox that indiciates if a demo account is needed. Is set automatically depending on if a user and pass are set.
148 149 150 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 148 def review_user_needed @review_user_needed end |
#screenshots ⇒ Hash (readonly)
Returns Represents the screenshots of this app version (read-only).
185 186 187 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 185 def screenshots @screenshots end |
#support_url ⇒ Hash (readonly)
Returns A hash representing the support url in all languages.
179 180 181 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 179 def support_url @support_url end |
#supports_apple_watch ⇒ Bool
Returns Does the binary contain a watch binary?.
71 72 73 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 71 def supports_apple_watch @supports_apple_watch end |
#trade_representative_address_line_1 ⇒ String
Returns Trade Representative Contact Information Address Line 1.
101 102 103 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 101 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.
104 105 106 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 104 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.
107 108 109 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 107 def trade_representative_address_line_3 @trade_representative_address_line_3 end |
#trade_representative_city_name ⇒ String
Returns Trade Representative Contact Information City Name.
110 111 112 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 110 def trade_representative_city_name @trade_representative_city_name end |
#trade_representative_country ⇒ String
Returns Trade Representative Contact Information Country.
116 117 118 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 116 def trade_representative_country @trade_representative_country end |
#trade_representative_email ⇒ String
Returns Trade Representative Contact Information Email Address.
125 126 127 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 125 def trade_representative_email @trade_representative_email end |
#trade_representative_first_name ⇒ String
Returns Trade Representative Contact Information First Name.
95 96 97 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 95 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.
128 129 130 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 128 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.
98 99 100 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 98 def trade_representative_last_name @trade_representative_last_name end |
#trade_representative_phone_number ⇒ String
Returns Trade Representative Contact Information Phone Number.
122 123 124 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 122 def trade_representative_phone_number @trade_representative_phone_number end |
#trade_representative_postal_code ⇒ String
Returns Trade Representative Contact Information Postal Code.
119 120 121 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 119 def trade_representative_postal_code @trade_representative_postal_code end |
#trade_representative_state ⇒ String
Returns Trade Representative Contact Information State.
113 114 115 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 113 def trade_representative_state @trade_representative_state end |
#trade_representative_trade_name ⇒ String
Trade Representative Contact Information
92 93 94 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 92 def trade_representative_trade_name @trade_representative_trade_name end |
#trailers ⇒ Hash (readonly)
Returns Represents the trailers of this app version (read-only).
188 189 190 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 188 def trailers @trailers end |
#transit_app_file ⇒ Spaceship::Tunes::TransitAppFile
GeoJson
86 87 88 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 86 def transit_app_file @transit_app_file end |
#version ⇒ String
Returns The version number of this version.
26 27 28 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 26 def version @version end |
#version_id ⇒ Integer
Returns a unqiue ID for this version generated by App Store Connect.
80 81 82 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 80 def version_id @version_id end |
#watch_app_icon ⇒ Spaceship::Tunes::AppImage
Returns the structure containing information about the large watch icon (1024x1024).
77 78 79 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 77 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.
266 267 268 269 270 271 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 266 def factory(attrs) obj = self.new(attrs) obj.unfold_languages return obj end |
.find(application, app_id, is_live, platform: nil) ⇒ Object
276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 276 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
337 338 339 340 341 342 343 344 345 346 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 337 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
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 305 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
326 327 328 329 330 331 332 333 334 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 326 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
427 428 429 430 431 432 433 434 435 436 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 427 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
630 631 632 633 634 635 636 637 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 630 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 |
#is_live? ⇒ Bool
Returns Is that version currently available in the App Store?.
293 294 295 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 293 def is_live? is_live end |
#reject! ⇒ Object
649 650 651 652 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 649 def reject! raise 'Version not rejectable' unless can_reject_version client.reject!(self.application.apple_id, self.version_id) end |
#release! ⇒ Object
623 624 625 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 623 def release! client.release!(self.application.apple_id, self.version_id) end |
#save! ⇒ Object
Push all changes that were made back to App Store Connect
402 403 404 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 402 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
351 352 353 354 355 356 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 351 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
414 415 416 417 418 419 420 421 422 423 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 414 def setup status = raw_data['status'] @app_status = Tunes::AppStatus.get_from_string(status) setup_large_app_icon setup_watch_app_icon 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}
206 207 208 209 210 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 206 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…
610 611 612 613 614 615 616 617 618 619 620 621 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 610 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
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 369 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
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 466 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
440 441 442 443 444 445 446 447 448 449 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 440 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_screenshot!(screenshot_path, sort_order, language, device, is_messages) ⇒ Object
Uploads or removes a screenshot
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 488 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 non existing 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
553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 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 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 553 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) video_preview_path = Utilities.grab_video_preview(trailer_path, , video_preview_resolution) 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 non existing 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
453 454 455 456 457 458 459 460 461 462 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 453 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.
407 408 409 410 411 |
# File 'spaceship/lib/spaceship/tunes/app_version.rb', line 407 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 |