Class: Spaceship::DUClient

Inherits:
Client
  • Object
show all
Defined in:
spaceship/lib/spaceship/du/du_client.rb

Overview

This class is used to upload Digital files (Images, Videos, JSON files) onto the du-itc service. Its implementation is tied to the tunes module (in particular using AppVersion instances)

Constant Summary

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::USER_AGENT, Client::UnauthorizedAccessError, Client::UnexpectedResponse

Instance Attribute Summary

Attributes inherited from Client

#client, #csrf_tokens, #logger, #provider, #user, #user_email

Init and Login collapse

Images collapse

Methods inherited from Client

#UI, #ask_for_2fa_code, #choose_phone_number, client_with_authorization_from, #cookie, #detect_most_common_errors_and_raise_exceptions, #fastlane_user_dir, #fetch_olympus_session, #fetch_program_license_agreement_messages, #handle_two_factor, #handle_two_step, #handle_two_step_for_device, #handle_two_step_or_factor, #initialize, #itc_service_key, #load_session_from_env, #load_session_from_file, login, #login, #page_size, #paging, #parse_response, #persistent_cookie_path, #phone_id_from_masked_number, #phone_id_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, #update_request_headers, #user_details_data, #with_retry

Constructor Details

This class inherits a constructor from Spaceship::Client

Class Method Details

.hostnameObject



13
14
15
# File 'spaceship/lib/spaceship/du/du_client.rb', line 13

def self.hostname
  "https://du-itc.itunes.apple.com"
end

Instance Method Details

#get_picture_type(upload_file) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'spaceship/lib/spaceship/du/du_client.rb', line 57

def get_picture_type(upload_file)
  resolution = Utilities.resolution(upload_file.file_path)
  result = device_resolution_map.find do |key, resolutions|
    resolutions.include?(resolution)
  end
  raise "Unknown device for screen resolution #{resolution}" if result.nil?

  picture_type_map[result[0]]
end

#upload_app_review_attachment(app_version, upload_file, content_provider_id, sso_token_for_attachment) ⇒ Object



53
54
55
# File 'spaceship/lib/spaceship/du/du_client.rb', line 53

def upload_app_review_attachment(app_version, upload_file, content_provider_id, sso_token_for_attachment)
  upload_file(app_version: app_version, upload_file: upload_file, path: '/upload/app-resolution-file', content_provider_id: content_provider_id, sso_token: sso_token_for_attachment)
end

#upload_geojson(app_version, upload_file, content_provider_id, sso_token_for_image) ⇒ Object



41
42
43
# File 'spaceship/lib/spaceship/du/du_client.rb', line 41

def upload_geojson(app_version, upload_file, 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

#upload_large_icon(app_version, upload_file, content_provider_id, sso_token_for_image) ⇒ Object



33
34
35
# File 'spaceship/lib/spaceship/du/du_client.rb', line 33

def upload_large_icon(app_version, upload_file, content_provider_id, sso_token_for_image)
  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

#upload_purchase_merch_screenshot(app_id, upload_file, content_provider_id, sso_token_for_image) ⇒ Object



25
26
27
# File 'spaceship/lib/spaceship/du/du_client.rb', line 25

def upload_purchase_merch_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.MerchandisingIAPIcon')
end

#upload_purchase_review_screenshot(app_id, upload_file, content_provider_id, sso_token_for_image) ⇒ Object



29
30
31
# File 'spaceship/lib/spaceship/du/du_client.rb', line 29

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: get_picture_type(upload_file))
end

#upload_screenshot(app_version, upload_file, content_provider_id, sso_token_for_image, device, is_messages) ⇒ Object



21
22
23
# File 'spaceship/lib/spaceship/du/du_client.rb', line 21

def upload_screenshot(app_version, upload_file, content_provider_id, sso_token_for_image, 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

#upload_trailer(app_version, upload_file, content_provider_id, sso_token_for_video) ⇒ Object



45
46
47
# File 'spaceship/lib/spaceship/du/du_client.rb', line 45

def upload_trailer(app_version, upload_file, 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

#upload_trailer_preview(app_version, upload_file, content_provider_id, sso_token_for_image, device) ⇒ Object



49
50
51
# File 'spaceship/lib/spaceship/du/du_client.rb', line 49

def upload_trailer_preview(app_version, upload_file, content_provider_id, sso_token_for_image, device)
  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, nil))
end

#upload_watch_icon(app_version, upload_file, content_provider_id, sso_token_for_image) ⇒ Object



37
38
39
# File 'spaceship/lib/spaceship/du/du_client.rb', line 37

def upload_watch_icon(app_version, upload_file, content_provider_id, sso_token_for_image)
  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