Class: FIR::QiniuUploader

Inherits:
AppUploader show all
Defined in:
lib/fir/util/qiniu_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

#initialize, #upload

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_binaryObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fir/util/qiniu_uploader.rb', line 31

def upload_binary
  try_to_action 'upload binary ...' do
    binary_url = uploading_info[:cert][:binary][:upload_url]
    binary_info = uploading_binary_info

    _uploaded_info = post(binary_url, binary_info.merge(manual_callback: true),
                          params_to_json: false,
                          header: nil)

    callback_to_api(callback_url, callback_binary_information)
  end
rescue StandardError => e
  logger.error "binary upload to qiniu fail, #{e.message}"
  exit 1
end

#upload_iconObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fir/util/qiniu_uploader.rb', line 8

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}"

    _uploaded_info = post(icon_url, icon_info.merge(manual_callback: true),
                          params_to_json: false,
                          header: nil)

    callback_to_api(callback_url, callback_icon_information)
  end
rescue StandardError => e
  # ignore icon error
  logger.info "ignore icon upload error #{e.message}"
end