module Flappy::Util::ClassMethods
Attributes
logger[RW]
Public Instance Methods
check_file_exist(path)
click to toggle source
def fetch_user_uuid(token)
user_info = fetch_user_info(token) user_info[:uuid]
end
# File lib/flappy/util.rb, line 62 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/flappy/util.rb, line 83 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/flappy/util.rb, line 69 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/flappy/util.rb, line 76 def check_token_cannot_be_blank(token) return unless token.blank? logger.error 'Token can not be blank' exit 1 end
fetch_user_info(token)
click to toggle source
# File lib/flappy/util.rb, line 53 def fetch_user_info(token) get fir_api[:user_url], api_token: token end
generate_rqrcode(string, png_file_path)
click to toggle source
# File lib/flappy/util.rb, line 98 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/flappy/util.rb, line 90 def logger_info_blank_line logger.info 'flappy completed!' end
logger_info_dividing_line()
click to toggle source
# File lib/flappy/util.rb, line 94 def logger_info_dividing_line logger.info '✈ -------------------------------------------- ✈' end