spaceship/lib/spaceship/tunes/tunes_client.rb in fastlane-2.129.0.beta.20190811200106 vs spaceship/lib/spaceship/tunes/tunes_client.rb in fastlane-2.129.0.beta.20190813200016
- old
+ new
@@ -789,10 +789,39 @@
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
+ # Uploads an In-App-Purchase Promotional image
+ # @param upload_image (UploadFile): The icon to upload
+ # @return [JSON] the image data, ready to be added to an In-App-Purchase
+ 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
+
# Uploads an In-App-Purchase Review screenshot
# @param app_id (AppId): The id of the app
# @param upload_image (UploadFile): The icon to upload
# @return [JSON] the screenshot data, ready to be added to an In-App-Purchase
def upload_purchase_review_screenshot(app_id, upload_image)
@@ -1302,11 +1331,11 @@
r = request(:get, "ra/apps/#{app_id}/iaps/#{purchase_id}/pricing/equalize/#{currency}/#{tier}")
parse_response(r, 'data')
end
# Creates an In-App-Purchases
- def create_iap!(app_id: nil, type: nil, versions: nil, reference_name: nil, product_id: nil, cleared_for_sale: true, review_notes: nil, review_screenshot: nil, pricing_intervals: nil, family_id: nil, subscription_duration: nil, subscription_free_trial: nil)
+ 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')
@@ -1345,9 +1374,16 @@
}
}
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)