Class: FIR::AliUploader
- Inherits:
-
AppUploader
- Object
- AppUploader
- FIR::AliUploader
- Defined in:
- lib/fir/util/ali_uploader.rb
Constant Summary
Constants included from Config
Config::API_YML_PATH, Config::APP_FILE_TYPE, Config::APP_INFO_PATH, Config::CONFIG_PATH, Config::XCODE_WRAPPER_PATH
Instance Attribute Summary
Attributes inherited from AppUploader
#app_info, #options, #uploading_info, #user_info
Instance Method Summary collapse
Methods inherited from AppUploader
Methods included from Config
#bughd_api, #config, #current_token, #fir_api, #reload_config, #write_app_info, #write_config
Constructor Details
This class inherits a constructor from FIR::AppUploader
Instance Method Details
#upload_binary ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fir/util/ali_uploader.rb', line 28 def upload_binary try_to_action 'upload binary ...' do binary_url = uploading_info[:cert][:binary][:upload_url] binary_info = uploading_binary_info logger.debug "binary_url = #{binary_url}, binary_info = #{binary_info}" headers = uploading_info[:cert][:binary][:custom_headers] headers_copy = { 'CONTENT-DISPOSITION' => headers[:"CONTENT-DISPOSITION"], 'Content-Type' => headers[:"content-type"], 'date' => headers[:date], 'x-oss-date' => headers[:"x-oss-date"], 'authorization' => headers[:authorization] } if @options[:user_download_file_name] != nil # 处理中文问题, 使之支持 CONTENT-DISPOSITION 的要求 headers_copy["CONTENT-DISPOSITION"] = "attachment; filename=#{URI.encode_www_form_component @options[:user_download_file_name]}" end logger.debug headers_copy put_file(binary_url, binary_info, headers_copy) callback_to_api(callback_url, callback_binary_information) end rescue StandardError => e logger.error "binary upload to ali fail, #{e.}" exit 1 end |
#upload_icon ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fir/util/ali_uploader.rb', line 9 def upload_icon if skip_update_icon? logger.info 'skip update icon...' return end try_to_action('upload icon') do # 拿到 icon 的授权 icon_url = uploading_info[:cert][:icon][:upload_url] icon_info = uploading_icon_info logger.debug "icon_url = #{icon_url}, icon_info = #{icon_info}" put_file(icon_url, uploading_icon_info, uploading_info[:cert][:icon][:custom_headers], false) callback_to_api(callback_url, callback_icon_information) end rescue StandardError => e # ignore icon error logger.info "ignore icon upload error #{e.}" end |