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::AppleTimeoutError, 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, client_with_authorization_from, #cookie, #detect_most_common_errors_and_raise_exceptions, #fastlane_user_dir, #fetch_olympus_session, #handle_two_factor, #handle_two_step, #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, #raise_insufficient_permission_error!, #request, #select_device, #send_shared_login_request, 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



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

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

Instance Method Details

#get_picture_type(upload_file) ⇒ Object



48
49
50
51
52
53
54
55
56
# File 'spaceship/lib/spaceship/du/du_client.rb', line 48

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_geojson(app_version, upload_file, content_provider_id, sso_token_for_image) ⇒ Object



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

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



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

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_review_screenshot(app_id, upload_file, content_provider_id, sso_token_for_image) ⇒ Object



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

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



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

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



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

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



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

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



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

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