lib/spaceship/tunes/tunes_client.rb in spaceship-0.37.0 vs lib/spaceship/tunes/tunes_client.rb in spaceship-0.38.0

- old
+ new

@@ -127,10 +127,11 @@ # user didn't specify a team... #thisiswhywecanthavenicethings loop do puts "Multiple iTunes Connect teams found, please enter the number of the team you want to use: " puts "Note: to automatically choose the team, provide either the iTunes 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" first_team = teams.first["contentProvider"] puts "" puts " itc_team_id \"#{first_team['contentProviderId']}\"" puts "" puts "or" @@ -263,20 +264,22 @@ # @param sku (String): A unique ID for your app that is not visible on the App Store. # @param bundle_id (String): The bundle ID must match the one you used in Xcode. It # can't be changed after you submit your first build. def create_application!(name: nil, primary_language: nil, version: nil, sku: nil, bundle_id: nil, bundle_id_suffix: nil, company_name: nil) # First, we need to fetch the data from Apple, which we then modify with the user's values + primary_language ||= "English" app_type = 'ios' r = request(:get, "ra/apps/create/v2/?platformString=#{app_type}") data = parse_response(r, 'data') # Now fill in the values we have # some values are nil, that's why there is a hash data['versionString'] = { value: version } data['name'] = { value: name } data['bundleId'] = { value: bundle_id } - data['primaryLanguage'] = { value: primary_language || 'English' } + data['primaryLanguage'] = { value: primary_language } + data['primaryLocaleCode'] = { value: primary_language.to_language_code } data['vendorId'] = { value: sku } data['bundleIdSuffix'] = { value: bundle_id_suffix } data['companyName'] = { value: company_name } if company_name data['enabledPlatformsForCreation'] = { value: [app_type] } @@ -326,18 +329,18 @@ ##################################################### # @!group AppVersions ##################################################### - def app_version(app_id, is_live) + 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) + 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 @@ -482,19 +485,33 @@ # Uploads a screenshot # @param app_version (AppVersion): The version of your app # @param upload_image (UploadFile): The image to upload # @param device (string): The target device + # @param is_messages (Bool): True if the screenshot is for iMessage # @return [JSON] the response - def upload_screenshot(app_version, upload_image, device) + def upload_screenshot(app_version, upload_image, device, is_messages) 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) + du_client.upload_screenshot(app_version, upload_image, content_provider_id, sso_token_for_image, device, is_messages) end + # Uploads an iMessage screenshot + # @param app_version (AppVersion): The version of your app + # @param upload_image (UploadFile): The image to upload + # @param device (string): The target device + # @return [JSON] the response + def upload_messages_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_messages_screenshot(app_version, upload_image, content_provider_id, sso_token_for_image, device) + end + # Uploads the transit app file # @param app_version (AppVersion): The version of your app # @param upload_file (UploadFile): The image to upload # @return [JSON] the response def upload_geojson(app_version, upload_file) @@ -556,13 +573,15 @@ ##################################################### # @!group Build Trains ##################################################### # @param (testing_type) internal or external - def build_trains(app_id, testing_type) + def build_trains(app_id, testing_type, platform: nil) raise "app_id is required" unless app_id - r = request(:get, "ra/apps/#{app_id}/trains/?testingType=#{testing_type}") + url = "ra/apps/#{app_id}/trains/?testingType=#{testing_type}" + url += "&platform=#{platform}" unless platform.nil? + r = request(:get, url) parse_response(r, 'data') end def update_build_trains!(app_id, testing_type, data) raise "app_id is required" unless app_id @@ -587,16 +606,18 @@ end handle_itc_response(r.body) end # All build trains, even if there is no TestFlight - def all_build_trains(app_id: nil, platform: nil) - r = request(:get, "ra/apps/#{app_id}/buildHistory?platform=#{platform || 'ios'}") + 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 - def all_builds_for_train(app_id: nil, train: nil, platform: nil) - r = request(:get, "ra/apps/#{app_id}/trains/#{train}/buildHistory?platform=#{platform || 'ios'}") + 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 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")