Class: Pindo::TaskSystem::AppStoreUploadScreenshotTask
- Inherits:
-
AppStoreTask
- Object
- PindoTask
- AppStoreTask
- Pindo::TaskSystem::AppStoreUploadScreenshotTask
- Defined in:
- lib/pindo/module/task/model/appstore/appstore_upload_screenshot_task.rb
Overview
App Store Screenshot 上传任务上传应用截图到 App Store Connect
Instance Attribute Summary collapse
-
#app_id ⇒ Object
readonly
Returns the value of attribute app_id.
-
#screenshot_path ⇒ Object
readonly
Returns the value of attribute screenshot_path.
Attributes inherited from PindoTask
#callbacks_setup, #context, #created_at, #dependencies, #error, #finished_at, #id, #max_retry_count, #metadata, #name, #priority, #result, #retry_count, #retry_delay, #retry_mode, #started_at, #status, #type
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(app_id, screenshot_path, options = {}) ⇒ AppStoreUploadScreenshotTask
constructor
初始化 Screenshot 上传任务.
- #validate ⇒ Object
Methods inherited from AppStoreTask
Methods inherited from PindoTask
#before_retry, #cancel, #cancelled?, #check_cancelled!, #do_task, #execution_time, #finished?, #on, #reset_for_retry, #retryable?, #running?, #should_retry?, task_type
Constructor Details
#initialize(app_id, screenshot_path, options = {}) ⇒ AppStoreUploadScreenshotTask
初始化 Screenshot 上传任务
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/pindo/module/task/model/appstore/appstore_upload_screenshot_task.rb', line 35 def initialize(app_id, screenshot_path, = {}) @app_id = app_id # App Store Connect 应用 ID @screenshot_path = screenshot_path # 截图目录路径 # App Store Connect 认证配置 @apple_id = [:apple_id] @api_key_id = [:api_key_id] @api_issuer_id = [:api_issuer_id] @api_key_path = [:api_key_path] # 截图配置 @locale = [:locale] || "zh-Hans" @device_types = [:device_types] || [] @overwrite = [:overwrite] || false # 设置上传任务的优先级为 LOW(截图上传可以最后执行) [:priority] ||= TaskPriority::LOW super("上传 Screenshot 到 App Store", ) end |
Instance Attribute Details
#app_id ⇒ Object (readonly)
Returns the value of attribute app_id.
9 10 11 |
# File 'lib/pindo/module/task/model/appstore/appstore_upload_screenshot_task.rb', line 9 def app_id @app_id end |
#screenshot_path ⇒ Object (readonly)
Returns the value of attribute screenshot_path.
9 10 11 |
# File 'lib/pindo/module/task/model/appstore/appstore_upload_screenshot_task.rb', line 9 def screenshot_path @screenshot_path end |
Class Method Details
.default_retry_count ⇒ Object
16 17 18 |
# File 'lib/pindo/module/task/model/appstore/appstore_upload_screenshot_task.rb', line 16 def self.default_retry_count 2 # 默认可以重试 2 次 end |
.default_retry_delay ⇒ Object
20 21 22 |
# File 'lib/pindo/module/task/model/appstore/appstore_upload_screenshot_task.rb', line 20 def self.default_retry_delay 15 # 默认延迟 15 秒 end |
.default_retry_mode ⇒ Object
重试配置
12 13 14 |
# File 'lib/pindo/module/task/model/appstore/appstore_upload_screenshot_task.rb', line 12 def self.default_retry_mode RetryMode::DELAYED # 延迟重试 end |
Instance Method Details
#validate ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/pindo/module/task/model/appstore/appstore_upload_screenshot_task.rb', line 56 def validate # 验证基本参数 unless @app_id && !@app_id.empty? @error = "缺少必需参数: app_id" return false end unless @screenshot_path && !@screenshot_path.empty? @error = "缺少必需参数: screenshot_path" return false end # 验证截图路径 unless File.directory?(@screenshot_path) @error = "截图路径不存在或不是目录: #{@screenshot_path}" return false end # 验证认证信息(Apple ID 或 API Key) has_apple_id_auth = @apple_id && !@apple_id.empty? has_api_key_auth = @api_key_id && @api_issuer_id && @api_key_path unless has_apple_id_auth || has_api_key_auth @error = "缺少认证信息:需要提供 Apple ID 或 API Key" return false end true end |