module FIR::Util::ClassMethods
Attributes
logger[RW]
Public Instance Methods
check_file_exist(path)
click to toggle source
# File lib/fir/util.rb, line 44 def check_file_exist(path) return if File.file?(path) logger.error 'File does not exist' exit 1 end
check_logined()
click to toggle source
# File lib/fir/util.rb, line 64 def check_logined return unless current_token.blank? logger.error 'Please use `fir login` first' exit 1 end
check_supported_file(path)
click to toggle source
# File lib/fir/util.rb, line 51 def check_supported_file(path) return if APP_FILE_TYPE.include?(File.extname(path)) logger.error 'Unsupported file type' exit 1 end
check_token_cannot_be_blank(token)
click to toggle source
# File lib/fir/util.rb, line 58 def check_token_cannot_be_blank(token) return unless token.blank? logger.error 'Token can not be blank' end
fetch_user_info(token)
click to toggle source
# File lib/fir/util.rb, line 35 def fetch_user_info(token) get fir_api[:user_url], api_token: token end
fetch_user_uuid(token)
click to toggle source
# File lib/fir/util.rb, line 39 def fetch_user_uuid(token) user_info = fetch_user_info(token) user_info[:uuid] end
generate_rqrcode(string, png_file_path)
click to toggle source
# File lib/fir/util.rb, line 79 def generate_rqrcode(string, png_file_path) qrcode = ::RQRCode::QRCode.new(string.to_s) qrcode.as_png(size: 500, border_modules: 2, file: png_file_path) png_file_path end
logger_info_blank_line()
click to toggle source
# File lib/fir/util.rb, line 71 def logger_info_blank_line logger.info '' end
logger_info_dividing_line()
click to toggle source
# File lib/fir/util.rb, line 75 def logger_info_dividing_line logger.info '✈ -------------------------------------------- ✈' end