spaceship/lib/spaceship/du/du_client.rb in fastlane-2.13.0 vs spaceship/lib/spaceship/du/du_client.rb in fastlane-2.14.0
- old
+ new
@@ -13,62 +13,72 @@
#####################################################
# @!group Images
#####################################################
def upload_screenshot(app_version, upload_file, content_provider_id, sso_token_for_image, device, is_messages)
- upload_file(app_version, upload_file, '/upload/image', content_provider_id, sso_token_for_image, screenshot_picture_type(device, is_messages))
+ upload_file(app_version: app_version, upload_file: upload_file, path: '/upload/image', content_provider_id: content_provider_id, sso_token: sso_token_for_image, du_validation_rule_set: screenshot_picture_type(device, is_messages))
end
+ def upload_purchase_review_screenshot(app_id, upload_file, content_provider_id, sso_token_for_image)
+ upload_file(app_id: app_id, upload_file: upload_file, path: '/upload/image', content_provider_id: content_provider_id, sso_token: sso_token_for_image, du_validation_rule_set: 'MZPFT.SortedScreenShot')
+ end
+
def upload_large_icon(app_version, upload_file, content_provider_id, sso_token_for_image)
- upload_file(app_version, upload_file, '/upload/image', content_provider_id, sso_token_for_image, 'MZPFT.LargeApplicationIcon')
+ upload_file(app_version: app_version, upload_file: upload_file, path: '/upload/image', content_provider_id: content_provider_id, sso_token: sso_token_for_image, du_validation_rule_set: 'MZPFT.LargeApplicationIcon')
end
def upload_watch_icon(app_version, upload_file, content_provider_id, sso_token_for_image)
- upload_file(app_version, upload_file, '/upload/image', content_provider_id, sso_token_for_image, 'MZPFT.GizmoAppIcon')
+ upload_file(app_version: app_version, upload_file: upload_file, path: '/upload/image', content_provider_id: content_provider_id, sso_token: sso_token_for_image, du_validation_rule_set: 'MZPFT.GizmoAppIcon')
end
def upload_geojson(app_version, upload_file, content_provider_id, sso_token_for_image)
- upload_file(app_version, upload_file, '/upload/geo-json', content_provider_id, sso_token_for_image)
+ upload_file(app_version: app_version, upload_file: upload_file, path: '/upload/geo-json', content_provider_id: content_provider_id, sso_token: sso_token_for_image)
end
def upload_trailer(app_version, upload_file, content_provider_id, sso_token_for_video)
- upload_file(app_version, upload_file, '/upload/purple-video', content_provider_id, sso_token_for_video)
+ upload_file(app_version: app_version, upload_file: upload_file, path: '/upload/purple-video', content_provider_id: content_provider_id, sso_token: sso_token_for_video)
end
def upload_trailer_preview(app_version, upload_file, content_provider_id, sso_token_for_image)
- upload_file(app_version, upload_file, '/upload/app-screenshot-image', content_provider_id, sso_token_for_image)
+ upload_file(app_version: app_version, upload_file: upload_file, path: '/upload/app-screenshot-image', content_provider_id: content_provider_id, sso_token: sso_token_for_image)
end
private
- def upload_file(app_version, upload_file, path, content_provider_id, sso_token, du_validation_rule_set = nil)
+ def upload_file(app_version: nil, upload_file: nil, path: nil, content_provider_id: nil, sso_token: nil, du_validation_rule_set: nil, app_id: nil)
raise "File #{upload_file.file_path} is empty" if upload_file.file_size == 0
- version = app_version.version
- app_id = app_version.application.apple_id
- app_type = app_version.app_type
+ if app_id
+ app_id = app_id
+ app_type = nil
+ version = nil
+ referrer = nil
+ else
+ version = app_version.version
+ app_id = app_version.application.apple_id
+ app_type = app_version.app_type
+ referrer = app_version.application.url
+ end
- referrer = app_version.application.url
-
r = request(:post) do |req|
req.url "#{self.class.hostname}#{path}"
req.body = upload_file.bytes
req.headers['Accept'] = 'application/json, text/plain, */*'
req.headers['Content-Type'] = upload_file.content_type
- req.headers['X-Apple-Upload-Referrer'] = referrer
- req.headers['Referrer'] = referrer
+ req.headers['X-Apple-Upload-Referrer'] = referrer if referrer
+ req.headers['Referrer'] = referrer if referrer
req.headers['X-Apple-Upload-AppleId'] = app_id
- req.headers['X-Apple-Jingle-Correlation-Key'] = "#{app_type}:AdamId=#{app_id}:Version=#{version}"
+ req.headers['X-Apple-Jingle-Correlation-Key'] = "#{app_type}:AdamId=#{app_id}:Version=#{version}" if app_type
req.headers['X-Apple-Upload-itctoken'] = sso_token
req.headers['X-Apple-Upload-ContentProviderId'] = content_provider_id
req.headers['X-Original-Filename'] = upload_file.file_name
req.headers['X-Apple-Upload-Validation-RuleSets'] = du_validation_rule_set if du_validation_rule_set
req.headers['Content-Length'] = upload_file.file_size.to_s
req.headers['Connection'] = "keep-alive"
end
if r.status == 500 and r.body.include?("Server Error")
- return upload_file(app_version, upload_file, path, content_provider_id, sso_token, du_validation_rule_set)
+ return upload_file(app_version: app_version, upload_file: upload_file, path: path, content_provider_id: content_provider_id, sso_token: sso_token, du_validation_rule_set: du_validation_rule_set, app_id: app_id)
end
parse_upload_response(r)
end