module Dianyinghao

Constants

VERSION

Public Class Methods

generate_order_uuid() click to toggle source
# File lib/dianyinghao.rb, line 23
def generate_order_uuid
  Date.today.to_s.split('-').join()[2..-1] << generate_utoken(5).upcase
end
generate_password(len = 8) click to toggle source
# File lib/dianyinghao.rb, line 5
def generate_password len = 8
  seed = (0..9).to_a + ('a'..'z').to_a + ('A'..'Z').to_a + ['!', '@', '#', '$', '%', '.', '*'] * 4
  token = ""
  len.times { |t| token << seed.sample.to_s }
  token
end
generate_tplay_id() click to toggle source
# File lib/dianyinghao.rb, line 19
def generate_tplay_id
  Date.today.to_s.split('-')[1..-1].join() << generate_utoken(6).upcase
end
generate_utoken(len = 8) click to toggle source
# File lib/dianyinghao.rb, line 12
def generate_utoken len = 8
  a = lambda { rand(36).to_s(36) }
  token = ""
  len.times { |t| token << a.call.to_s }
  token
end