Class: Spaceship::TunesClient
- Defined in:
- spaceship/lib/spaceship/tunes/tunes_client.rb
Overview
rubocop:disable Metrics/ClassLength
Constant Summary collapse
- ITunesConnectError =
Legacy support
Tunes::Error
- ITunesConnectTemporaryError =
Tunes::TemporaryError
- ITunesConnectPotentialServerError =
Tunes::PotentialServerError
Constants inherited from Client
Client::AUTH_TYPES, Client::AccessForbiddenError, Client::AppleTimeoutError, Client::BadGatewayError, Client::BasicPreferredInfoError, Client::GatewayTimeoutError, Client::InsufficientPermissions, Client::InternalServerError, Client::InvalidUserCredentialsError, Client::NoUserCredentialsError, Client::PROTOCOL_VERSION, Client::ProgramLicenseAgreementUpdated, Client::TooManyRequestsError, Client::USER_AGENT, Client::UnauthorizedAccessError, Client::UnexpectedResponse
Instance Attribute Summary collapse
-
#du_client ⇒ Object
readonly
Returns the value of attribute du_client.
Attributes inherited from Client
#additional_headers, #client, #csrf_tokens, #logger, #provider, #user, #user_email
Init and Login collapse
- .hostname ⇒ Object
-
#fetch_errors_in_data(data_section: nil, sub_section_name: nil, keys: nil) ⇒ Object
Sometimes we get errors or info nested in our data This method allows you to pass in a set of keys to check for along with the name of the sub_section of your original data where we should check Returns a mapping of keys to data array if we find anything, otherwise, empty map.
-
#handle_itc_response(raw, flaky_api_call: false) ⇒ Object
rubocop:disable Metrics/PerceivedComplexity If the response is coming from a flaky api, set flaky_api_call to true so we retry a little.
-
#select_team(team_id: nil, team_name: nil) ⇒ Object
Shows a team selection for the user in the terminal.
- #send_login_request(user, password) ⇒ Object
Applications collapse
- #app_details(app_id) ⇒ Object
- #applications ⇒ Object
- #bundle_details(app_id) ⇒ Object
-
#create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil) ⇒ Object
Creates a new application on App Store Connect.
- #create_version!(app_id, version_number, platform = 'ios') ⇒ Object
- #get_available_bundle_ids(platform: nil) ⇒ Object
- #get_ratings(app_id, platform, version_id = '', storefront = '') ⇒ Object
- #get_resolution_center(app_id, platform) ⇒ Object
- #get_reviews(app_id, platform, storefront, version_id, upto_date = nil) ⇒ Object
- #post_resolution_center(app_id, platform, thread_id, version_id, version_number, from, message_body) ⇒ Object
- #update_app_details!(app_id, data) ⇒ Object
AppVersions collapse
- #app_version(app_id, is_live, platform: nil) ⇒ Object
- #app_version_data(app_id, version_platform: nil, version_id: nil) ⇒ Object
- #update_app_version!(app_id, version_id, data) ⇒ Object
Members collapse
- #create_member!(firstname: nil, lastname: nil, email_address: nil, roles: [], apps: []) ⇒ Object
- #delete_member!(user_id, email) ⇒ Object
- #members ⇒ Object
- #reinvite_member(email) ⇒ Object
- #update_member_roles!(member, roles: [], apps: []) ⇒ Object
AppAnalytics collapse
Pricing collapse
- #price_tier(app_id) ⇒ Object
-
#pricing_tiers(app_id) ⇒ Array
Returns an array of all available pricing tiers.
- #transform_to_raw_pricing_intervals(app_id = nil, purchase_id = nil, pricing_intervals = 5, subscription_price_target = nil) ⇒ Object
- #update_price_tier!(app_id, price_tier) ⇒ Object
Availability collapse
- #availability(app_id) ⇒ Object
- #available_languages ⇒ Object
-
#supported_countries ⇒ Object
An array of supported countries [{ “code”: “AL”, “name”: “Albania”, “region”: “Europe” }, { .…
-
#supported_territories ⇒ Array
Returns an array of all supported territories.
-
#update_availability!(app_id, availability) ⇒ Spaceship::Tunes::Availability
Updates the availability.
App Icons collapse
-
#ref_data ⇒ AppVersionRef
Fetches the App Version Reference information from ITC.
-
#upload_app_review_attachment(app_version, upload_attachment_file) ⇒ JSON
Uploads a attachment file.
-
#upload_geojson(app_version, upload_file) ⇒ JSON
Uploads the transit app file.
-
#upload_large_icon(app_version, upload_image) ⇒ JSON
Uploads a large icon.
-
#upload_messages_screenshot(app_version, upload_image, device) ⇒ JSON
Uploads an iMessage screenshot.
-
#upload_purchase_merch_screenshot(app_id, upload_image) ⇒ JSON
Uploads an In-App-Purchase Promotional image.
-
#upload_purchase_review_screenshot(app_id, upload_image) ⇒ JSON
Uploads an In-App-Purchase Review screenshot.
-
#upload_screenshot(app_version, upload_image, device, is_messages) ⇒ JSON
Uploads a screenshot.
-
#upload_trailer(app_version, upload_trailer) ⇒ JSON
Uploads the transit app file.
-
#upload_trailer_preview(app_version, upload_trailer_preview, device) ⇒ JSON
Uploads the trailer preview.
-
#upload_watch_icon(app_version, upload_image) ⇒ JSON
Uploads a watch icon.
CandiateBuilds collapse
Build Trains collapse
-
#all_build_trains(app_id: nil, platform: 'ios') ⇒ Object
All build trains, even if there is no TestFlight.
- #all_builds_for_train(app_id: nil, train: nil, platform: 'ios') ⇒ Object
- #build_details(app_id: nil, train: nil, build_number: nil, platform: nil) ⇒ Object
-
#build_trains(app_id, testing_type, tries = 5, platform: nil) ⇒ Object
rubocop:disable Metrics/BlockNesting.
-
#get_build_info_for_review(app_id: nil, train: nil, build_number: nil, platform: 'ios') ⇒ Object
rubocop:enable Metrics/ParameterLists.
- #remove_testflight_build_from_review!(app_id: nil, train: nil, build_number: nil, platform: 'ios') ⇒ Object
-
#submit_testflight_build_for_review!(app_id: nil, train: nil, build_number: nil, platform: 'ios', changelog: nil, description: nil, feedback_email: nil, marketing_url: nil, first_name: nil, last_name: nil, review_email: nil, phone_number: nil, significant_change: false, privacy_policy_url: nil, review_user_name: nil, review_password: nil, review_notes: nil, encryption: false, encryption_updated: false, is_exempt: false, proprietary: false, third_party: false) ⇒ Object
rubocop:disable Metrics/ParameterLists.
- #update_build_information!(app_id: nil, train: nil, build_number: nil, whats_new: nil, description: nil, feedback_email: nil, platform: 'ios') ⇒ Object
-
#update_build_trains!(app_id, testing_type, data) ⇒ Object
rubocop:enable Metrics/BlockNesting.
Submit for Review collapse
- #prepare_app_submissions(app_id, version) ⇒ Object
- #send_app_submission(app_id, version, data) ⇒ Object
release collapse
release to all users collapse
in-app-purchases collapse
-
#create_iap!(app_id: nil, type: nil, versions: nil, reference_name: nil, product_id: nil, cleared_for_sale: true, merch_screenshot: nil, review_notes: nil, review_screenshot: nil, pricing_intervals: nil, family_id: nil, subscription_duration: nil, subscription_free_trial: nil) ⇒ Object
Creates an In-App-Purchases.
- #create_iap_family(app_id: nil, name: nil, product_id: nil, reference_name: nil, versions: []) ⇒ Object
-
#delete_iap!(app_id: nil, purchase_id: nil) ⇒ Object
Deletes a In-App-Purchases.
-
#generate_shared_secret(app_id: nil) ⇒ Object
Generates app-specific shared secret key.
-
#get_shared_secret(app_id: nil) ⇒ Object
Retrieves app-specific shared secret key.
-
#iap_families(app_id: nil) ⇒ Object
Returns list of all available Families.
-
#iap_subscription_pricing_target(app_id: nil, purchase_id: nil, currency: nil, tier: nil) ⇒ Object
returns pricing goal array.
-
#iaps(app_id: nil) ⇒ Object
Returns list of all available In-App-Purchases.
-
#load_iap(app_id: nil, purchase_id: nil) ⇒ Object
Loads the full In-App-Purchases.
-
#load_iap_family(app_id: nil, family_id: nil) ⇒ Object
Loads the full In-App-Purchases-Family.
- #load_recurring_iap_pricing(app_id: nil, purchase_id: nil) ⇒ Object
-
#submit_iap!(app_id: nil, purchase_id: nil) ⇒ Object
Submit the In-App-Purchase for review.
-
#subscription_pricing_tiers(app_id) ⇒ [Spaceship::Tunes::IAPSubscriptionPricingTier]
Loads the full In-App-Purchases-Pricing-Matrix note: the matrix is the same for any app_id.
-
#update_iap!(app_id: nil, purchase_id: nil, data: nil) ⇒ Object
updates an In-App-Purchases.
-
#update_iap_family!(app_id: nil, family_id: nil, data: nil) ⇒ Object
updates an In-App-Purchases-Family.
- #update_recurring_iap_pricing!(app_id: nil, purchase_id: nil, pricing_intervals: nil) ⇒ Object
Sandbox Testers collapse
- #create_sandbox_tester!(tester_class: nil, email: nil, password: nil, first_name: nil, last_name: nil, country: nil) ⇒ Object
- #delete_sandbox_testers!(tester_class, emails) ⇒ Object
- #sandbox_testers(tester_class) ⇒ Object
State History collapse
- #version_states_history(app_id, platform, version_id) ⇒ Object
- #versions_history(app_id, platform) ⇒ Object
Promo codes collapse
- #app_promocodes(app_id: nil) ⇒ Object
- #app_promocodes_history(app_id: nil) ⇒ Object
- #generate_app_version_promocodes!(app_id: nil, version_id: nil, quantity: nil) ⇒ Object
reject collapse
Class Method Summary collapse
-
.video_preview_resolution_for(device, is_portrait) ⇒ Object
trailer preview screenshots are required to have a specific size.
Instance Method Summary collapse
-
#initialize ⇒ TunesClient
constructor
A new instance of TunesClient.
Methods inherited from Client
#UI, #ask_for_2fa_code, #choose_phone_number, client_with_authorization_from, #cookie, #detect_most_common_errors_and_raise_exceptions, #exit_with_session_state, #fastlane_user_dir, #fetch_hashcash, #fetch_olympus_session, #fetch_program_license_agreement_messages, #handle_two_factor, #handle_two_step, #handle_two_step_for_device, #handle_two_step_or_factor, #has_valid_session, #itc_service_key, #load_session_from_env, #load_session_from_file, #login, login, #match_phone_to_masked_phone, #page_size, #paging, #parse_response, #persistent_cookie_path, #phone_id_from_masked_number, #phone_id_from_number, #push_mode_from_masked_number, #push_mode_from_number, #raise_insufficient_permission_error!, #request, #request_two_factor_code_from_phone, #request_two_factor_code_from_phone_choose, #send_shared_login_request, #sms_automatically_sent, #sms_fallback, spaceship_session_env, #store_cookie, #store_session, #team_id, #team_id=, #team_information, #team_name, #teams, #try_upgrade_2fa_later, #update_request_headers, #user_details_data, #with_retry
Constructor Details
#initialize ⇒ TunesClient
Returns a new instance of TunesClient.
23 24 25 26 27 28 29 30 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 23 def initialize super @du_client = DUClient.new # Used by most WebObjects requests starting in July 2021 @additional_headers = { 'x-csrf-itc': 'itc' } end |
Instance Attribute Details
#du_client ⇒ Object (readonly)
Returns the value of attribute du_client.
21 22 23 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 21 def du_client @du_client end |
Class Method Details
.hostname ⇒ Object
58 59 60 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 58 def self.hostname "https://appstoreconnect.apple.com/WebObjects/iTunesConnect.woa/" end |
.video_preview_resolution_for(device, is_portrait) ⇒ Object
trailer preview screenshots are required to have a specific size
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 34 def video_preview_resolution_for(device, is_portrait) resolutions = { 'iphone4' => [1136, 640], 'iphone6' => [1334, 750], 'iphone6Plus' => [2208, 1242], 'iphone58' => [2436, 1125], 'iphone65' => [2688, 1242], 'ipad' => [1024, 768], 'ipad105' => [2224, 1668], 'ipadPro' => [2732, 2048], 'ipadPro11' => [2388, 1668], 'ipadPro129' => [2732, 2048] } r = resolutions[device] r = [r[1], r[0]] if is_portrait r end |
Instance Method Details
#all_build_trains(app_id: nil, platform: 'ios') ⇒ Object
All build trains, even if there is no TestFlight
1082 1083 1084 1085 1086 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1082 def all_build_trains(app_id: nil, platform: 'ios') platform = 'ios' if platform.nil? r = request(:get, "ra/apps/#{app_id}/buildHistory?platform=#{platform}") handle_itc_response(r.body) end |
#all_builds_for_train(app_id: nil, train: nil, platform: 'ios') ⇒ Object
1088 1089 1090 1091 1092 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1088 def all_builds_for_train(app_id: nil, train: nil, platform: 'ios') platform = 'ios' if platform.nil? r = request(:get, "ra/apps/#{app_id}/trains/#{train}/buildHistory?platform=#{platform}") handle_itc_response(r.body) end |
#app_details(app_id) ⇒ Object
322 323 324 325 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 322 def app_details(app_id) r = request(:get, "ra/apps/#{app_id}/details") parse_response(r, 'data') end |
#app_promocodes(app_id: nil) ⇒ Object
1563 1564 1565 1566 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1563 def app_promocodes(app_id: nil) r = request(:get, "ra/apps/#{app_id}/promocodes/versions") parse_response(r, 'data')['versions'] end |
#app_promocodes_history(app_id: nil) ⇒ Object
1583 1584 1585 1586 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1583 def app_promocodes_history(app_id: nil) r = request(:get, "ra/apps/#{app_id}/promocodes/history") parse_response(r, 'data')['requests'] end |
#app_version(app_id, is_live, platform: nil) ⇒ Object
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 495 def app_version(app_id, is_live, platform: nil) raise "app_id is required" unless app_id # First we need to fetch the IDs for the edit / live version r = request(:get, "ra/apps/#{app_id}/overview") platforms = parse_response(r, 'data')['platforms'] platform = Spaceship::Tunes::AppVersionCommon.find_platform(platforms, search_platform: platform) return nil unless platform version_id = Spaceship::Tunes::AppVersionCommon.find_version_id(platform, is_live) return nil unless version_id version_platform = platform['platformString'] app_version_data(app_id, version_platform: version_platform, version_id: version_id) end |
#app_version_data(app_id, version_platform: nil, version_id: nil) ⇒ Object
513 514 515 516 517 518 519 520 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 513 def app_version_data(app_id, version_platform: nil, version_id: nil) raise "app_id is required" unless app_id raise "version_platform is required" unless version_platform raise "version_id is required" unless version_id r = request(:get, "ra/apps/#{app_id}/platforms/#{version_platform}/versions/#{version_id}") parse_response(r, 'data') end |
#applications ⇒ Object
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 257 def applications # Doing this real bad puts for now until a more formal deprecation logic can get made puts("Spaceship::Tunes::Application.all is deprecated") puts(" It's using a temporary patch to keep it from raising an error but things may not work correctly") puts(" Please consider switching to Spaceship::ConnectAPI if you can") puts(" For more details - https://github.com/fastlane/fastlane/pull/20480") # This legacy endpoint went offline around July 7th, 2022. This is a rough attempt # at retrofitting using the newer App Store Connect API endpoints # # This could all be done easily with Spaceship::ConnectAPI::App.find but there were a lot of # circular dependency issues that were very difficult to solve because. Spaceship::Tunes would be # using Spaceship::ConnectAPI which uses Spaceship::Tunes # # However, using Spaceship::ConnectAPI::Response works. This will fetch multiple pages of app # if it needs to # # https://github.com/fastlane/fastlane/pull/20480 r = request(:get, "https://appstoreconnect.apple.com/iris/v1/apps?include=appStoreVersions") response = Spaceship::ConnectAPI::Response.new( body: r.body, status: r.status, headers: r.headers, client: nil ) apps = response.all_pages do |url| r = request(:get, url) Spaceship::ConnectAPI::Response.new( body: r.body, status: r.status, headers: r.headers, client: nil ) end.flat_map(&:to_models) apps.map do |asc_app| platforms = (asc_app.app_store_versions || []).map(&:platform).uniq.map do |asc_platform| case asc_platform when "TV_OS" "appletvos" when "MAC_OS" "osx" when "IOS" "ios" else raise "Cannot find a matching platform for '#{asc_platform}'}" end end { 'adamId' => asc_app.id, 'name' => asc_app.name, 'vendorId' => "", 'bundleId' => asc_app.bundle_id, 'lastModifiedDate' => nil, 'issuesCount' => nil, 'iconUrl' => nil, 'versionSets' => platforms.map do |platform| { 'type' => 'app', 'platformString' => platform } end } end end |
#availability(app_id) ⇒ Object
821 822 823 824 825 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 821 def availability(app_id) r = request(:get, "ra/apps/#{app_id}/pricing/intervals") data = parse_response(r, 'data') Spaceship::Tunes::Availability.factory(data) end |
#available_languages ⇒ Object
849 850 851 852 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 849 def available_languages r = request(:get, "ra/ref") parse_response(r, 'data')['detailLocales'] end |
#build_details(app_id: nil, train: nil, build_number: nil, platform: nil) ⇒ Object
1094 1095 1096 1097 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1094 def build_details(app_id: nil, train: nil, build_number: nil, platform: nil) r = request(:get, "ra/apps/#{app_id}/platforms/#{platform || 'ios'}/trains/#{train}/builds/#{build_number}/details") handle_itc_response(r.body) end |
#build_trains(app_id, testing_type, tries = 5, platform: nil) ⇒ Object
rubocop:disable Metrics/BlockNesting
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1028 def build_trains(app_id, testing_type, tries = 5, platform: nil) raise "app_id is required" unless app_id url = "ra/apps/#{app_id}/trains/?testingType=#{testing_type}" url += "&platform=#{platform}" unless platform.nil? r = request(:get, url) return parse_response(r, 'data') rescue Spaceship::Client::UnexpectedResponse => ex # Build trains fail randomly very often # we need to catch those errors and retry # https://github.com/fastlane/fastlane/issues/6419 = [ "ITC.response.error.OPERATION_FAILED", "Internal Server Error", "Service Unavailable" ].freeze if .any? { || ex.to_s.include?() } tries -= 1 if tries > 0 logger.warn("Received temporary server error from App Store Connect. Retrying the request...") sleep(3) unless Object.const_defined?(:SpecHelper) retry end end raise Spaceship::Client::UnexpectedResponse, "Temporary App Store Connect error: #{ex}" end |
#bundle_details(app_id) ⇒ Object
327 328 329 330 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 327 def bundle_details(app_id) r = request(:get, "ra/appbundles/metadetail/#{app_id}") parse_response(r, 'data') end |
#candidate_builds(app_id, version_id) ⇒ Object
1017 1018 1019 1020 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1017 def candidate_builds(app_id, version_id) r = request(:get, "ra/apps/#{app_id}/versions/#{version_id}/candidateBuilds") parse_response(r, 'data')['builds'] end |
#create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil) ⇒ Object
Creates a new application on App Store Connect
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 352 def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil, platform: nil, platforms: nil, itunes_connect_users: nil) puts("The `version` parameter is deprecated. Use `Spaceship::Tunes::Application.ensure_version!` method instead") if version # First, we need to fetch the data from Apple, which we then modify with the user's values primary_language ||= "English" platform ||= "ios" r = request(:get, "ra/apps/create/v2/?platformString=#{platform}") data = parse_response(r, 'data') # Now fill in the values we have # some values are nil, that's why there is a hash data['name'] = { value: name } data['bundleId'] = { value: bundle_id } data['primaryLanguage'] = { value: primary_language } data['primaryLocaleCode'] = { value: primary_language.to_itc_locale } data['vendorId'] = { value: sku } data['bundleIdSuffix'] = { value: bundle_id_suffix } data['companyName'] = { value: company_name } if company_name data['enabledPlatformsForCreation'] = { value: [platform] } data['initialPlatform'] = platform data['enabledPlatformsForCreation'] = { value: platforms || [platform] } unless itunes_connect_users.nil? data['iTunesConnectUsers']['grantedAllUsers'] = false data['iTunesConnectUsers']['grantedUsers'] = data['iTunesConnectUsers']['availableUsers'].select { |user| itunes_connect_users.include?(user['username']) } end # Now send back the modified hash r = request(:post) do |req| req.url('ra/apps/create/v2') req.body = data.to_json req.headers['Content-Type'] = 'application/json' end data = parse_response(r, 'data') handle_itc_response(data) end |
#create_iap!(app_id: nil, type: nil, versions: nil, reference_name: nil, product_id: nil, cleared_for_sale: true, merch_screenshot: nil, review_notes: nil, review_screenshot: nil, pricing_intervals: nil, family_id: nil, subscription_duration: nil, subscription_free_trial: nil) ⇒ Object
Creates an In-App-Purchases
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1414 def create_iap!(app_id: nil, type: nil, versions: nil, reference_name: nil, product_id: nil, cleared_for_sale: true, merch_screenshot: nil, review_notes: nil, review_screenshot: nil, pricing_intervals: nil, family_id: nil, subscription_duration: nil, subscription_free_trial: nil) # Load IAP Template based on Type type ||= "consumable" r = request(:get, "ra/apps/#{app_id}/iaps/#{type}/template") data = parse_response(r, 'data') # Now fill in the values we have # some values are nil, that's why there is a hash data['familyId'] = family_id.to_s if family_id data['productId'] = { value: product_id } data['referenceName'] = { value: reference_name } data['clearedForSale'] = { value: cleared_for_sale } data['pricingDurationType'] = { value: subscription_duration } if subscription_duration data['freeTrialDurationType'] = { value: subscription_free_trial } if subscription_free_trial # pricing tier if pricing_intervals data['pricingIntervals'] = [] pricing_intervals.each do |interval| data['pricingIntervals'] << { value: { country: interval[:country] || "WW", tierStem: interval[:tier].to_s, priceTierEndDate: interval[:end_date], priceTierEffectiveDate: interval[:begin_date] } } end end versions_array = [] versions.each do |k, v| versions_array << { value: { description: { value: v[:description] }, name: { value: v[:name] }, localeCode: k.to_s } } end data["versions"][0]["details"]["value"] = versions_array data['versions'][0]["reviewNotes"] = { value: review_notes } if merch_screenshot # Upload App Store Promotional image (Optional) upload_file = UploadFile.from_path(merch_screenshot) merch_data = upload_purchase_merch_screenshot(app_id, upload_file) data["versions"][0]["merch"] = merch_data end if review_screenshot # Upload Screenshot: upload_file = UploadFile.from_path(review_screenshot) screenshot_data = upload_purchase_review_screenshot(app_id, upload_file) data["versions"][0]["reviewScreenshot"] = screenshot_data end # Now send back the modified hash r = request(:post) do |req| req.url("ra/apps/#{app_id}/iaps") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#create_iap_family(app_id: nil, name: nil, product_id: nil, reference_name: nil, versions: []) ⇒ Object
1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1390 def create_iap_family(app_id: nil, name: nil, product_id: nil, reference_name: nil, versions: []) r = request(:get, "ra/apps/#{app_id}/iaps/family/template") data = parse_response(r, 'data') data['activeAddOns'][0]['productId'] = { value: product_id } data['activeAddOns'][0]['referenceName'] = { value: reference_name } data['name'] = { value: name } data["details"]["value"] = versions r = request(:post) do |req| req.url("ra/apps/#{app_id}/iaps/family/") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#create_member!(firstname: nil, lastname: nil, email_address: nil, roles: [], apps: []) ⇒ Object
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 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 563 def create_member!(firstname: nil, lastname: nil, email_address: nil, roles: [], apps: []) r = request(:get, "ra/users/itc/create") data = parse_response(r, 'data') data["user"]["firstName"] = { value: firstname } data["user"]["lastName"] = { value: lastname } data["user"]["emailAddress"] = { value: email_address } roles << "admin" if roles.length == 0 data["user"]["roles"] = [] roles.each do |role| # find role from template data["roles"].each do |template_role| if template_role["value"]["name"] == role data["user"]["roles"] << template_role end end end if apps.length == 0 data["user"]["userSoftwares"] = { value: { grantAllSoftware: true, grantedSoftwareAdamIds: [] } } else data["user"]["userSoftwares"] = { value: { grantAllSoftware: false, grantedSoftwareAdamIds: apps } } end # send the changes back to Apple r = request(:post) do |req| req.url("ra/users/itc/create") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#create_sandbox_tester!(tester_class: nil, email: nil, password: nil, first_name: nil, last_name: nil, country: nil) ⇒ Object
1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1504 def create_sandbox_tester!(tester_class: nil, email: nil, password: nil, first_name: nil, last_name: nil, country: nil) url = tester_class.url[:create] r = request(:post) do |req| req.url(url) req.body = { user: { emailAddress: { value: email }, password: { value: password }, confirmPassword: { value: password }, firstName: { value: first_name }, lastName: { value: last_name }, storeFront: { value: country }, birthDay: { value: 1 }, birthMonth: { value: 1 }, secretQuestion: { value: SecureRandom.hex }, secretAnswer: { value: SecureRandom.hex }, sandboxAccount: nil } }.to_json req.headers['Content-Type'] = 'application/json' end response_object = parse_response(r, 'data') errors = response_object['sectionErrorKeys'] raise ITunesConnectError, errors.join(' ') unless errors.empty? response_object['user'] end |
#create_version!(app_id, version_number, platform = 'ios') ⇒ Object
391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 391 def create_version!(app_id, version_number, platform = 'ios') r = request(:post) do |req| req.url("ra/apps/#{app_id}/platforms/#{platform}/versions/create/") req.body = { version: { value: version_number.to_s } }.to_json req.headers['Content-Type'] = 'application/json' end data = parse_response(r, 'data') handle_itc_response(data) end |
#delete_iap!(app_id: nil, purchase_id: nil) ⇒ Object
Deletes a In-App-Purchases
1312 1313 1314 1315 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1312 def delete_iap!(app_id: nil, purchase_id: nil) r = request(:delete, "ra/apps/#{app_id}/iaps/#{purchase_id}") handle_itc_response(r) end |
#delete_member!(user_id, email) ⇒ Object
550 551 552 553 554 555 556 557 558 559 560 561 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 550 def delete_member!(user_id, email) payload = [] payload << { dsId: user_id, email: email } request(:post) do |req| req.url("ra/users/itc/delete") req.body = payload.to_json req.headers['Content-Type'] = 'application/json' end end |
#delete_sandbox_testers!(tester_class, emails) ⇒ Object
1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1531 def delete_sandbox_testers!(tester_class, emails) url = tester_class.url[:delete] request(:post) do |req| req.url(url) req.body = emails.map do |email| { emailAddress: { value: email } } end.to_json req.headers['Content-Type'] = 'application/json' end true end |
#fetch_errors_in_data(data_section: nil, sub_section_name: nil, keys: nil) ⇒ Object
Sometimes we get errors or info nested in our data This method allows you to pass in a set of keys to check for along with the name of the sub_section of your original data where we should check Returns a mapping of keys to data array if we find anything, otherwise, empty map
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 142 def fetch_errors_in_data(data_section: nil, sub_section_name: nil, keys: nil) if data_section && sub_section_name sub_section = data_section[sub_section_name] else sub_section = data_section end unless sub_section return {} end error_map = {} keys.each do |key| errors = sub_section.fetch(key, []) error_map[key] = errors if errors.count > 0 end return error_map end |
#generate_app_version_promocodes!(app_id: nil, version_id: nil, quantity: nil) ⇒ Object
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1568 def generate_app_version_promocodes!(app_id: nil, version_id: nil, quantity: nil) data = [{ numberOfCodes: quantity, agreedToContract: true, versionId: version_id }] url = "ra/apps/#{app_id}/promocodes/versions" r = request(:post) do |req| req.url(url) req.body = data.to_json req.headers['Content-Type'] = 'application/json' end parse_response(r, 'data') end |
#generate_shared_secret(app_id: nil) ⇒ Object
Generates app-specific shared secret key
1489 1490 1491 1492 1493 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1489 def generate_shared_secret(app_id: nil) r = request(:post, "ra/apps/#{app_id}/iaps/appSharedSecret") data = parse_response(r, 'data') data['sharedSecret'] end |
#get_available_bundle_ids(platform: nil) ⇒ Object
406 407 408 409 410 411 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 406 def get_available_bundle_ids(platform: nil) platform ||= "ios" r = request(:get, "ra/apps/create/v2/?platformString=#{platform}") data = parse_response(r, 'data') return data['bundleIds'].keys end |
#get_build_info_for_review(app_id: nil, train: nil, build_number: nil, platform: 'ios') ⇒ Object
rubocop:enable Metrics/ParameterLists
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1201 def get_build_info_for_review(app_id: nil, train: nil, build_number: nil, platform: 'ios') url = "ra/apps/#{app_id}/platforms/#{platform}/trains/#{train}/builds/#{build_number}/testInformation" r = request(:get) do |req| req.url(url) req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) r.body['data'] end |
#get_ratings(app_id, platform, version_id = '', storefront = '') ⇒ Object
443 444 445 446 447 448 449 450 451 452 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 443 def (app_id, platform, version_id = '', storefront = '') # if storefront or version_id is empty api fails = "ra/apps/#{app_id}/platforms/#{platform}/reviews/summary" params = {} params['storefront'] = storefront unless storefront.empty? params['version_id'] = version_id unless version_id.empty? r = request(:get, , params) parse_response(r, 'data') end |
#get_resolution_center(app_id, platform) ⇒ Object
413 414 415 416 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 413 def get_resolution_center(app_id, platform) r = request(:get, "ra/apps/#{app_id}/platforms/#{platform}/resolutionCenter?v=latest") parse_response(r, 'data') end |
#get_reviews(app_id, platform, storefront, version_id, upto_date = nil) ⇒ Object
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 454 def get_reviews(app_id, platform, storefront, version_id, upto_date = nil) index = 0 per_page = 100 # apple default all_reviews = [] upto_date = Time.parse(upto_date) unless upto_date.nil? loop do = "ra/apps/#{app_id}/platforms/#{platform}/reviews?" << "sort=REVIEW_SORT_ORDER_MOST_RECENT" << "&index=#{index}" << "&storefront=#{storefront}" unless storefront.empty? << "&versionId=#{version_id}" unless version_id.empty? r = request(:get, ) all_reviews.concat(parse_response(r, 'data')['reviews']) # The following lines throw errors when there are no reviews so exit out of the loop before them if the app has no reviews break if all_reviews.count == 0 last_review_date = Time.at(all_reviews[-1]['value']['lastModified'] / 1000) if upto_date && last_review_date < upto_date all_reviews = all_reviews.select { |review| Time.at(review['value']['lastModified'] / 1000) > upto_date } break end if all_reviews.count < parse_response(r, 'data')['reviewCount'] index += per_page else break end end all_reviews end |
#get_shared_secret(app_id: nil) ⇒ Object
Retrieves app-specific shared secret key
1482 1483 1484 1485 1486 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1482 def get_shared_secret(app_id: nil) r = request(:get, "ra/apps/#{app_id}/iaps/appSharedSecret") data = parse_response(r, 'data') data['sharedSecret'] end |
#handle_itc_response(raw, flaky_api_call: false) ⇒ Object
rubocop:disable Metrics/PerceivedComplexity If the response is coming from a flaky api, set flaky_api_call to true so we retry a little. Patience is a virtue.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 164 def handle_itc_response(raw, flaky_api_call: false) return unless raw return unless raw.kind_of?(Hash) data = raw['data'] || raw # sometimes it's with data, sometimes it isn't error_keys = ["sectionErrorKeys", "validationErrors", "serviceErrors"] info_keys = ["sectionInfoKeys", "sectionWarningKeys"] error_and_info_keys_to_check = error_keys + info_keys errors_in_data = fetch_errors_in_data(data_section: data, keys: error_and_info_keys_to_check) errors_in_version_info = fetch_errors_in_data(data_section: data, sub_section_name: "versionInfo", keys: error_and_info_keys_to_check) # If we have any errors or "info" we need to treat them as warnings or errors if errors_in_data.count == 0 && errors_in_version_info.count == 0 logger.debug("Request was successful") end # We pass on the `current_language` so that the error message tells the user # what language the error was caused in handle_response_hash = lambda do |hash, current_language = nil| errors = [] if hash.kind_of?(Hash) current_language ||= hash["language"] hash.each do |key, value| errors += handle_response_hash.call(value, current_language) next unless key == 'errorKeys' && value.kind_of?(Array) && value.count > 0 # Prepend the error with the language so it's easier to understand for the user errors += value.collect do || current_language ? "[#{current_language}]: #{}" : end end elsif hash.kind_of?(Array) hash.each do |value| errors += handle_response_hash.call(value) end # else: We don't care about simple values end return errors end errors = handle_response_hash.call(data) # Search at data level, as well as "versionInfo" level for errors errors_in_data = fetch_errors_in_data(data_section: data, keys: error_keys) errors_in_version_info = fetch_errors_in_data(data_section: data, sub_section_name: "versionInfo", keys: error_keys) errors += errors_in_data.values if errors_in_data.values errors += errors_in_version_info.values if errors_in_version_info.values errors = errors.flat_map { |value| value } # Sometimes there is a different kind of error in the JSON response # e.g. {"warn"=>nil, "error"=>["operation_failed"], "info"=>nil} different_error = raw.fetch('messages', {}).fetch('error', nil) errors << different_error if different_error if errors.count > 0 # they are separated by `.` by default # Sample `error` content: [["Forbidden"]] if errors.count == 1 && errors.first == "You haven't made any changes." # This is a special error which we really don't care about elsif errors.count == 1 && errors.first.include?("try again later") raise ITunesConnectTemporaryError.new, errors.first elsif errors.count == 1 && errors.first.include?("Forbidden") elsif flaky_api_call raise ITunesConnectPotentialServerError.new, errors.join(' ') else raise ITunesConnectError.new, errors.join(' ') end end # Search at data level, as well as "versionInfo" level for info and warnings info_in_data = fetch_errors_in_data(data_section: data, keys: info_keys) info_in_version_info = fetch_errors_in_data(data_section: data, sub_section_name: "versionInfo", keys: info_keys) info_in_data.each do |info_key, info_value| puts(info_value) end info_in_version_info.each do |info_key, info_value| puts(info_value) end return data end |
#iap_families(app_id: nil) ⇒ Object
Returns list of all available Families
1306 1307 1308 1309 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1306 def iap_families(app_id: nil) r = request(:get, "ra/apps/#{app_id}/iaps/families") return r.body["data"] end |
#iap_subscription_pricing_target(app_id: nil, purchase_id: nil, currency: nil, tier: nil) ⇒ Object
returns pricing goal array
1408 1409 1410 1411 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1408 def iap_subscription_pricing_target(app_id: nil, purchase_id: nil, currency: nil, tier: nil) r = request(:get, "ra/apps/#{app_id}/iaps/#{purchase_id}/pricing/equalize/#{currency}/#{tier}") parse_response(r, 'data') end |
#iaps(app_id: nil) ⇒ Object
Returns list of all available In-App-Purchases
1300 1301 1302 1303 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1300 def iaps(app_id: nil) r = request(:get, "ra/apps/#{app_id}/iaps") return r.body["data"] end |
#load_iap(app_id: nil, purchase_id: nil) ⇒ Object
Loads the full In-App-Purchases
1318 1319 1320 1321 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1318 def load_iap(app_id: nil, purchase_id: nil) r = request(:get, "ra/apps/#{app_id}/iaps/#{purchase_id}") parse_response(r, 'data') end |
#load_iap_family(app_id: nil, family_id: nil) ⇒ Object
Loads the full In-App-Purchases-Family
1330 1331 1332 1333 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1330 def load_iap_family(app_id: nil, family_id: nil) r = request(:get, "ra/apps/#{app_id}/iaps/family/#{family_id}") parse_response(r, 'data') end |
#load_recurring_iap_pricing(app_id: nil, purchase_id: nil) ⇒ Object
1385 1386 1387 1388 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1385 def load_recurring_iap_pricing(app_id: nil, purchase_id: nil) r = request(:get, "ra/apps/#{app_id}/iaps/#{purchase_id}/pricing") parse_response(r, 'data') end |
#members ⇒ Object
541 542 543 544 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 541 def members r = request(:get, "ra/users/itc") parse_response(r, 'data')["users"] end |
#post_resolution_center(app_id, platform, thread_id, version_id, version_number, from, message_body) ⇒ Object
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 418 def post_resolution_center(app_id, platform, thread_id, version_id, version_number, from, ) r = request(:post) do |req| req.url("ra/apps/#{app_id}/platforms/#{platform}/resolutionCenter") req.body = { appNotes: { threads: [{ id: thread_id, versionId: version_id, version: version_number, messages: [{ from: from, date: DateTime.now.strftime('%Q'), body: , tokens: [] }] }] } }.to_json req.headers['Content-Type'] = 'application/json' end data = parse_response(r, 'data') handle_itc_response(data) end |
#prepare_app_submissions(app_id, version) ⇒ Object
1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1216 def prepare_app_submissions(app_id, version) raise "app_id is required" unless app_id raise "version is required" unless version r = request(:get) do |req| req.url("ra/apps/#{app_id}/versions/#{version}/submit/summary") req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) parse_response(r, 'data') end |
#price_tier(app_id) ⇒ Object
738 739 740 741 742 743 744 745 746 747 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 738 def price_tier(app_id) r = request(:get, "ra/apps/#{app_id}/pricing/intervals") data = parse_response(r, 'data') begin data["pricingIntervalsFieldTO"]["value"].first["tierStem"] rescue nil end end |
#pricing_tiers(app_id) ⇒ Array
Although this information is publicly available, the current spaceship implementation requires you to have a logged in client to access it
Returns an array of all available pricing tiers
[{
"tierStem": "0",
"tierName": "Free",
"pricingInfo": [{
"country": "United States",
"countryCode": "US",
"currencySymbol": "$",
"currencyCode": "USD",
"wholesalePrice": 0.0,
"retailPrice": 0.0,
"fRetailPrice": "$0.00",
"fWholesalePrice": "$0.00"
}, {
...
}, { …
770 771 772 773 774 775 776 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 770 def pricing_tiers(app_id) @pricing_tiers ||= begin r = request(:get, "ra/apps/#{app_id}/iaps/pricing/matrix") data = parse_response(r, 'data')['pricingTiers'] data.map { |tier| Spaceship::Tunes::PricingTier.factory(tier) } end end |
#ref_data ⇒ AppVersionRef
Fetches the App Version Reference information from ITC
1007 1008 1009 1010 1011 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1007 def ref_data r = request(:get, '/WebObjects/iTunesConnect.woa/ra/apps/version/ref') data = parse_response(r, 'data') Spaceship::Tunes::AppVersionRef.factory(data) end |
#reinvite_member(email) ⇒ Object
546 547 548 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 546 def reinvite_member(email) request(:post, "ra/users/itc/#{email}/resendInvitation") end |
#reject!(app_id, version) ⇒ Object
1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1592 def reject!(app_id, version) raise "app_id is required" unless app_id raise "version is required" unless version r = request(:post) do |req| req.url("ra/apps/#{app_id}/versions/#{version}/reject") req.headers['Content-Type'] = 'application/json' req.body = app_id.to_s end handle_itc_response(r.body) parse_response(r, 'data') end |
#release!(app_id, version) ⇒ Object
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1263 def release!(app_id, version) raise "app_id is required" unless app_id raise "version is required" unless version r = request(:post) do |req| req.url("ra/apps/#{app_id}/versions/#{version}/releaseToStore") req.headers['Content-Type'] = 'application/json' req.body = app_id.to_s end handle_itc_response(r.body) parse_response(r, 'data') end |
#release_to_all_users!(app_id, version) ⇒ Object
1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1281 def release_to_all_users!(app_id, version) raise "app_id is required" unless app_id raise "version is required" unless version r = request(:post) do |req| req.url("ra/apps/#{app_id}/versions/#{version}/phasedRelease/state/COMPLETE") req.headers['Content-Type'] = 'application/json' req.body = app_id.to_s end handle_itc_response(r.body) parse_response(r, 'data') end |
#remove_testflight_build_from_review!(app_id: nil, train: nil, build_number: nil, platform: 'ios') ⇒ Object
1072 1073 1074 1075 1076 1077 1078 1079 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1072 def remove_testflight_build_from_review!(app_id: nil, train: nil, build_number: nil, platform: 'ios') r = request(:post) do |req| req.url("ra/apps/#{app_id}/platforms/#{platform}/trains/#{train}/builds/#{build_number}/reject") req.body = {}.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#sandbox_testers(tester_class) ⇒ Object
1498 1499 1500 1501 1502 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1498 def sandbox_testers(tester_class) url = tester_class.url[:index] r = request(:get, url) parse_response(r, 'data') end |
#select_team(team_id: nil, team_name: nil) ⇒ Object
Shows a team selection for the user in the terminal. This should not be called on CI systems
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 67 def select_team(team_id: nil, team_name: nil) t_id = (team_id || ENV['FASTLANE_ITC_TEAM_ID'] || '').strip t_name = (team_name || ENV['FASTLANE_ITC_TEAM_NAME'] || '').strip if t_name.length > 0 && t_id.length.zero? # we prefer IDs over names, they are unique puts("Looking for App Store Connect Team with name #{t_name}") if Spaceship::Globals.verbose? teams.each do |t| t_id = t['providerId'].to_s if t['name'].casecmp(t_name).zero? end puts("Could not find team with name '#{t_name}', trying to fallback to default team") if t_id.length.zero? end t_id = teams.first['providerId'].to_s if teams.count == 1 if t_id.length > 0 puts("Looking for App Store Connect Team with ID #{t_id}") if Spaceship::Globals.verbose? # actually set the team id here self.team_id = t_id return self.team_id end # user didn't specify a team... #thisiswhywecanthavenicethings loop do puts("Multiple #{'App Store Connect teams'.yellow} found, please enter the number of the team you want to use: ") if ENV["FASTLANE_HIDE_TEAM_INFORMATION"].to_s.length == 0 first_team = teams.first puts("Note: to automatically choose the team, provide either the App Store Connect Team ID, or the Team Name in your fastlane/Appfile:") puts("Alternatively you can pass the team name or team ID using the `FASTLANE_ITC_TEAM_ID` or `FASTLANE_ITC_TEAM_NAME` environment variable") puts("") puts(" itc_team_id \"#{first_team['providerId']}\"") puts("") puts("or") puts("") puts(" itc_team_name \"#{first_team['name']}\"") puts("") end # We're not using highline here, as spaceship doesn't have a dependency to fastlane_core or highline teams.each_with_index do |team, i| puts("#{i + 1}) \"#{team['name']}\" (#{team['providerId']})") end unless Spaceship::Client::UserInterface.interactive? puts("Multiple teams found on App Store Connect, Your Terminal is running in non-interactive mode! Cannot continue from here.") puts("Please check that you set FASTLANE_ITC_TEAM_ID or FASTLANE_ITC_TEAM_NAME to the right value.") raise "Multiple App Store Connect Teams found; unable to choose, terminal not interactive!" end selected = ($stdin.gets || '').strip.to_i - 1 team_to_use = teams[selected] if selected >= 0 if team_to_use self.team_id = team_to_use['providerId'].to_s # actually set the team id here return self.team_id end end end |
#send_app_submission(app_id, version, data) ⇒ Object
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1229 def send_app_submission(app_id, version, data) raise "app_id is required" unless app_id # ra/apps/1039164429/version/submit/complete r = request(:post) do |req| req.url("ra/apps/#{app_id}/versions/#{version}/submit/complete") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) # App Store Connect still returns a success status code even the submission # was failed because of Ad ID Info / Export Compliance. This checks for any section error # keys in returned adIdInfo / exportCompliance and prints them out. ad_id_error_keys = r.body.fetch('data').fetch('adIdInfo').fetch('sectionErrorKeys') export_error_keys = r.body.fetch('data').fetch('exportCompliance').fetch('sectionErrorKeys') if ad_id_error_keys.any? raise "Something wrong with your Ad ID information: #{ad_id_error_keys}." elsif export_error_keys.any? raise "Something wrong with your Export Compliance: #{export_error_keys}" elsif r.body.fetch('messages').fetch('info').last == "Successful POST" # success else raise "Something went wrong when submitting the app for review. Make sure to pass valid options to submit your app for review" end parse_response(r, 'data') end |
#send_login_request(user, password) ⇒ Object
128 129 130 131 132 133 134 135 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 128 def send_login_request(user, password) clear_user_cached_data result = send_shared_login_request(user, password) return result end |
#submit_iap!(app_id: nil, purchase_id: nil) ⇒ Object
Submit the In-App-Purchase for review
1324 1325 1326 1327 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1324 def submit_iap!(app_id: nil, purchase_id: nil) r = request(:post, "ra/apps/#{app_id}/iaps/#{purchase_id}/submission") handle_itc_response(r) end |
#submit_testflight_build_for_review!(app_id: nil, train: nil, build_number: nil, platform: 'ios', changelog: nil, description: nil, feedback_email: nil, marketing_url: nil, first_name: nil, last_name: nil, review_email: nil, phone_number: nil, significant_change: false, privacy_policy_url: nil, review_user_name: nil, review_password: nil, review_notes: nil, encryption: false, encryption_updated: false, is_exempt: false, proprietary: false, third_party: false) ⇒ Object
rubocop:disable Metrics/ParameterLists
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1131 def submit_testflight_build_for_review!(app_id: nil, train: nil, build_number: nil, platform: 'ios', # Required Metadata: changelog: nil, description: nil, feedback_email: nil, marketing_url: nil, first_name: nil, last_name: nil, review_email: nil, phone_number: nil, significant_change: false, # Optional Metadata: privacy_policy_url: nil, review_user_name: nil, review_password: nil, review_notes: nil, encryption: false, encryption_updated: false, is_exempt: false, proprietary: false, third_party: false) build_info = get_build_info_for_review(app_id: app_id, train: train, build_number: build_number, platform: platform) # Now fill in the values provided by the user # First the localized values: build_info['details'].each do |current| current['whatsNew']['value'] = changelog if changelog current['description']['value'] = description if description current['feedbackEmail']['value'] = feedback_email if feedback_email current['marketingUrl']['value'] = marketing_url if marketing_url current['privacyPolicyUrl']['value'] = privacy_policy_url if privacy_policy_url current['pageLanguageValue'] = current['language'] # There is no valid reason why we need this, only iTC being iTC end review_info = { "significantChange" => { "value" => significant_change }, "buildTestInformationTO" => build_info, "exportComplianceTO" => { "usesEncryption" => { "value" => encryption }, "encryptionUpdated" => { "value" => encryption_updated }, "isExempt" => { "value" => is_exempt }, "containsProprietaryCryptography" => { "value" => proprietary }, "containsThirdPartyCryptography" => { "value" => third_party } } } r = request(:post) do |req| # same URL, but a POST request req.url("ra/apps/#{app_id}/platforms/#{platform}/trains/#{train}/builds/#{build_number}/review/submit") req.body = review_info.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#subscription_pricing_tiers(app_id) ⇒ [Spaceship::Tunes::IAPSubscriptionPricingTier]
Loads the full In-App-Purchases-Pricing-Matrix
note: the matrix is the same for any app_id
1340 1341 1342 1343 1344 1345 1346 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1340 def subscription_pricing_tiers(app_id) @subscription_pricing_tiers ||= begin r = request(:get, "ra/apps/#{app_id}/iaps/pricing/matrix/recurring") data = parse_response(r, "data")["pricingTiers"] data.map { |tier| Spaceship::Tunes::IAPSubscriptionPricingTier.factory(tier) } end end |
#supported_countries ⇒ Object
An array of supported countries [
"code": "AL",
"name": "Albania",
"region": "Europe"
, { …
844 845 846 847 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 844 def supported_countries r = request(:get, "ra/apps/pricing/supportedCountries") parse_response(r, 'data') end |
#supported_territories ⇒ Array
Although this information is publicly available, the current spaceship implementation requires you to have a logged in client to access it
Returns an array of all supported territories
832 833 834 835 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 832 def supported_territories data = supported_countries data.map { |country| Spaceship::Tunes::Territory.factory(country) } end |
#time_series_analytics(app_ids, measures, start_time, end_time, frequency, view_by) ⇒ Object
633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 633 def time_series_analytics(app_ids, measures, start_time, end_time, frequency, view_by) data = { adamId: app_ids, dimensionFilters: [], endTime: end_time, frequency: frequency, group: group_for_view_by(view_by, measures), measures: measures, startTime: start_time } r = request(:post) do |req| req.url("https://appstoreconnect.apple.com/analytics/api/v1/data/time-series") req.body = data.to_json req.headers['Content-Type'] = 'application/json' req.headers['X-Requested-By'] = 'appstoreconnect.apple.com' end data = parse_response(r) end |
#transform_to_raw_pricing_intervals(app_id = nil, purchase_id = nil, pricing_intervals = 5, subscription_price_target = nil) ⇒ Object
693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 693 def transform_to_raw_pricing_intervals(app_id = nil, purchase_id = nil, pricing_intervals = 5, subscription_price_target = nil) intervals_array = [] if pricing_intervals intervals_array = pricing_intervals.map do |interval| { "value" => { "tierStem" => interval[:tier], "priceTierEffectiveDate" => interval[:begin_date], "priceTierEndDate" => interval[:end_date], "country" => interval[:country] || "WW", "grandfathered" => interval[:grandfathered] } } end end if subscription_price_target pricing_calculator = iap_subscription_pricing_target(app_id: app_id, purchase_id: purchase_id, currency: subscription_price_target[:currency], tier: subscription_price_target[:tier]) intervals_array = pricing_calculator.map do |language_code, value| existing_interval = if pricing_intervals pricing_intervals.find { |interval| interval[:country] == language_code } end grandfathered = if existing_interval existing_interval[:grandfathered].clone else { "value" => "FUTURE_NONE" } end { "value" => { "tierStem" => value["tierStem"], "priceTierEffectiveDate" => value["priceTierEffectiveDate"], "priceTierEndDate" => value["priceTierEndDate"], "country" => language_code, "grandfathered" => grandfathered } } end end intervals_array end |
#update_app_details!(app_id, data) ⇒ Object
332 333 334 335 336 337 338 339 340 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 332 def update_app_details!(app_id, data) r = request(:post) do |req| req.url("ra/apps/#{app_id}/details") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#update_app_version!(app_id, version_id, data) ⇒ Object
522 523 524 525 526 527 528 529 530 531 532 533 534 535 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 522 def update_app_version!(app_id, version_id, data) raise "app_id is required" unless app_id raise "version_id is required" unless version_id.to_i > 0 with_tunes_retry do r = request(:post) do |req| req.url("ra/apps/#{app_id}/platforms/ios/versions/#{version_id}") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body, flaky_api_call: true) end end |
#update_availability!(app_id, availability) ⇒ Spaceship::Tunes::Availability
Although this information is publicly available, the current spaceship implementation requires you to have a logged in client to access it
Updates the availability
788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 788 def update_availability!(app_id, availability) r = request(:get, "ra/apps/#{app_id}/pricing/intervals") data = parse_response(r, 'data') data["countriesChanged"] = true data["countries"] = availability.territories.map { |territory| { 'code' => territory.code } } data["theWorld"] = availability.include_future_territories.nil? ? true : availability.include_future_territories # InitializespreOrder (if needed) data["preOrder"] ||= {} # Sets app_available_date to nil if cleared_for_preorder if false # This is need for apps that have never set either of these before # API will error out if cleared_for_preorder is false and app_available_date has a date cleared_for_preorder = availability.cleared_for_preorder app_available_date = cleared_for_preorder ? availability.app_available_date : nil data["b2bAppEnabled"] = availability.b2b_app_enabled data["educationalDiscount"] = availability.educational_discount data["preOrder"]["clearedForPreOrder"] = { "value" => cleared_for_preorder, "isEditable" => true, "isRequired" => true, "errorKeys" => nil } data["preOrder"]["appAvailableDate"] = { "value" => app_available_date, "isEditable" => true, "isRequired" => true, "errorKeys" => nil } data["b2bUsers"] = availability.b2b_app_enabled ? availability.b2b_users.map { |user| { "value" => { "add" => user.add, "delete" => user.delete, "dsUsername" => user.ds_username } } } : [] data["b2bOrganizations"] = availability.b2b_app_enabled ? availability.b2b_organizations.map { |org| { "value" => { "type" => org.type, "depCustomerId" => org.dep_customer_id, "organizationId" => org.dep_organization_id, "name" => org.name } } } : [] # send the changes back to Apple r = request(:post) do |req| req.url("ra/apps/#{app_id}/pricing/intervals") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) data = parse_response(r, 'data') Spaceship::Tunes::Availability.factory(data) end |
#update_build_information!(app_id: nil, train: nil, build_number: nil, whats_new: nil, description: nil, feedback_email: nil, platform: 'ios') ⇒ Object
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1099 def update_build_information!(app_id: nil, train: nil, build_number: nil, # optional: whats_new: nil, description: nil, feedback_email: nil, platform: 'ios') url = "ra/apps/#{app_id}/platforms/#{platform}/trains/#{train}/builds/#{build_number}/testInformation" build_info = get_build_info_for_review(app_id: app_id, train: train, build_number: build_number, platform: platform) build_info["details"].each do |current| current["whatsNew"]["value"] = whats_new if whats_new current["description"]["value"] = description if description current["feedbackEmail"]["value"] = feedback_email if feedback_email end review_user_name = build_info['reviewUserName']['value'] review_password = build_info['reviewPassword']['value'] build_info['reviewAccountRequired']['value'] = (review_user_name.to_s + review_password.to_s).length > 0 # Now send everything back to iTC r = request(:post) do |req| # same URL, but a POST request req.url(url) req.body = build_info.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#update_build_trains!(app_id, testing_type, data) ⇒ Object
rubocop:enable Metrics/BlockNesting
1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1057 def update_build_trains!(app_id, testing_type, data) raise "app_id is required" unless app_id # The request fails if this key is present in the data data.delete("dailySubmissionCountByPlatform") r = request(:post) do |req| req.url("ra/apps/#{app_id}/testingTypes/#{testing_type}/trains/") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#update_iap!(app_id: nil, purchase_id: nil, data: nil) ⇒ Object
updates an In-App-Purchases
1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1361 def update_iap!(app_id: nil, purchase_id: nil, data: nil) with_tunes_retry do r = request(:put) do |req| req.url("ra/apps/#{app_id}/iaps/#{purchase_id}") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end end |
#update_iap_family!(app_id: nil, family_id: nil, data: nil) ⇒ Object
updates an In-App-Purchases-Family
1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1349 def update_iap_family!(app_id: nil, family_id: nil, data: nil) with_tunes_retry do r = request(:put) do |req| req.url("ra/apps/#{app_id}/iaps/family/#{family_id}/") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end end |
#update_member_roles!(member, roles: [], apps: []) ⇒ Object
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 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 598 def update_member_roles!(member, roles: [], apps: []) r = request(:get, "ra/users/itc/#{member.user_id}/roles") data = parse_response(r, 'data') roles << "admin" if roles.length == 0 data["user"]["roles"] = [] roles.each do |role| # find role from template data["roles"].each do |template_role| if template_role["value"]["name"] == role data["user"]["roles"] << template_role end end end if apps.length == 0 data["user"]["userSoftwares"] = { value: { grantAllSoftware: true, grantedSoftwareAdamIds: [] } } else data["user"]["userSoftwares"] = { value: { grantAllSoftware: false, grantedSoftwareAdamIds: apps } } end # send the changes back to Apple r = request(:post) do |req| req.url("ra/users/itc/#{member.user_id}/roles") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#update_price_tier!(app_id, price_tier) ⇒ Object
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 658 def update_price_tier!(app_id, price_tier) r = request(:get, "ra/apps/#{app_id}/pricing/intervals") data = parse_response(r, 'data') # preOrder isn't needed for for the request and has some # values that can cause a failure (invalid dates) so we are removing it data.delete('preOrder') first_price = (data["pricingIntervalsFieldTO"]["value"] || []).count == 0 # first price data["pricingIntervalsFieldTO"]["value"] ||= [] data["pricingIntervalsFieldTO"]["value"] << {} if data["pricingIntervalsFieldTO"]["value"].count == 0 data["pricingIntervalsFieldTO"]["value"].first["tierStem"] = price_tier.to_s effective_date = (first_price ? nil : Time.now.to_i * 1000) data["pricingIntervalsFieldTO"]["value"].first["priceTierEffectiveDate"] = effective_date data["pricingIntervalsFieldTO"]["value"].first["priceTierEndDate"] = nil data["countriesChanged"] = first_price data["theWorld"] = true if first_price # first price, need to set all countries data["countries"] = supported_countries.collect do |c| c.delete('region') # we don't care about le region c end end # send the changes back to Apple r = request(:post) do |req| req.url("ra/apps/#{app_id}/pricing/intervals") req.body = data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end |
#update_recurring_iap_pricing!(app_id: nil, purchase_id: nil, pricing_intervals: nil) ⇒ Object
1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1372 def update_recurring_iap_pricing!(app_id: nil, purchase_id: nil, pricing_intervals: nil) with_tunes_retry do r = request(:post) do |req| pricing_data = {} req.url("ra/apps/#{app_id}/iaps/#{purchase_id}/pricing/subscriptions") pricing_data["subscriptions"] = pricing_intervals req.body = pricing_data.to_json req.headers['Content-Type'] = 'application/json' end handle_itc_response(r.body) end end |
#upload_app_review_attachment(app_version, upload_attachment_file) ⇒ JSON
Uploads a attachment file
997 998 999 1000 1001 1002 1003 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 997 def (app_version, ) raise "app_version is required" unless app_version raise "app_version must be live version" if app_version.is_live? raise "upload_attachment_file is required" unless du_client.(app_version, , content_provider_id, sso_token_for_image) end |
#upload_geojson(app_version, upload_file) ⇒ JSON
Uploads the transit app file
959 960 961 962 963 964 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 959 def upload_geojson(app_version, upload_file) raise "app_version is required" unless app_version raise "upload_file is required" unless upload_file du_client.upload_geojson(app_version, upload_file, content_provider_id, sso_token_for_image) end |
#upload_large_icon(app_version, upload_image) ⇒ JSON
Uploads a large icon
861 862 863 864 865 866 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 861 def upload_large_icon(app_version, upload_image) raise "app_version is required" unless app_version raise "upload_image is required" unless upload_image du_client.upload_large_icon(app_version, upload_image, content_provider_id, sso_token_for_image) end |
#upload_messages_screenshot(app_version, upload_image, device) ⇒ JSON
Uploads an iMessage screenshot
947 948 949 950 951 952 953 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 947 def (app_version, upload_image, device) raise "app_version is required" unless app_version raise "upload_image is required" unless upload_image raise "device is required" unless device du_client.(app_version, upload_image, content_provider_id, sso_token_for_image, device) end |
#upload_purchase_merch_screenshot(app_id, upload_image) ⇒ JSON
Uploads an In-App-Purchase Promotional image
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 882 def upload_purchase_merch_screenshot(app_id, upload_image) data = du_client.upload_purchase_merch_screenshot(app_id, upload_image, content_provider_id, sso_token_for_image) { "images" => [ { "id" => nil, "image" => { "value" => { "assetToken" => data["token"], "originalFileName" => upload_image.file_name, "height" => data["height"], "width" => data["width"], "checksum" => data["md5"] }, "isEditable" => true, "isREquired" => false, "errorKeys" => nil }, "status" => "proposed" } ], "showByDefault" => true, "isActive" => false } end |
#upload_purchase_review_screenshot(app_id, upload_image) ⇒ JSON
Uploads an In-App-Purchase Review screenshot
912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 912 def upload_purchase_review_screenshot(app_id, upload_image) data = du_client.upload_purchase_review_screenshot(app_id, upload_image, content_provider_id, sso_token_for_image) { "value" => { "assetToken" => data["token"], "sortOrder" => 0, "type" => du_client.get_picture_type(upload_image), "originalFileName" => upload_image.file_name, "size" => data["length"], "height" => data["height"], "width" => data["width"], "checksum" => data["md5"] } } end |
#upload_screenshot(app_version, upload_image, device, is_messages) ⇒ JSON
Uploads a screenshot
934 935 936 937 938 939 940 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 934 def upload_screenshot(app_version, upload_image, device, ) raise "app_version is required" unless app_version raise "upload_image is required" unless upload_image raise "device is required" unless device du_client.upload_screenshot(app_version, upload_image, content_provider_id, sso_token_for_image, device, ) end |
#upload_trailer(app_version, upload_trailer) ⇒ JSON
Uploads the transit app file
970 971 972 973 974 975 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 970 def upload_trailer(app_version, upload_trailer) raise "app_version is required" unless app_version raise "upload_trailer is required" unless upload_trailer du_client.upload_trailer(app_version, upload_trailer, content_provider_id, sso_token_for_video) end |
#upload_trailer_preview(app_version, upload_trailer_preview, device) ⇒ JSON
Uploads the trailer preview
982 983 984 985 986 987 988 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 982 def upload_trailer_preview(app_version, upload_trailer_preview, device) raise "app_version is required" unless app_version raise "upload_trailer_preview is required" unless upload_trailer_preview raise "device is required" unless device du_client.upload_trailer_preview(app_version, upload_trailer_preview, content_provider_id, sso_token_for_image, device) end |
#upload_watch_icon(app_version, upload_image) ⇒ JSON
Uploads a watch icon
872 873 874 875 876 877 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 872 def upload_watch_icon(app_version, upload_image) raise "app_version is required" unless app_version raise "upload_image is required" unless upload_image du_client.upload_watch_icon(app_version, upload_image, content_provider_id, sso_token_for_image) end |
#version_states_history(app_id, platform, version_id) ⇒ Object
1555 1556 1557 1558 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1555 def version_states_history(app_id, platform, version_id) r = request(:get, "ra/apps/#{app_id}/versions/#{version_id}/stateHistory?platform=#{platform}") parse_response(r, 'data') end |
#versions_history(app_id, platform) ⇒ Object
1550 1551 1552 1553 |
# File 'spaceship/lib/spaceship/tunes/tunes_client.rb', line 1550 def versions_history(app_id, platform) r = request(:get, "ra/apps/#{app_id}/stateHistory?platform=#{platform}") parse_response(r, 'data')['versions'] end |