Class: Fuyou::Ca

Inherits:
Object
  • Object
show all
Extended by:
Base
Defined in:
lib/fuyou/ca.rb

Class Method Summary collapse

Methods included from Base

connection, format_response, http_get, http_post, refresh_token, sign

Class Method Details

.sign_inObject

CA 签到



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fuyou/ca.rb', line 7

def 
  pfx_string = read_pfx_string
  ca_key = Digest::MD5.hexdigest(Fuyou.config.ca_key)
  password_key = Digest::MD5.hexdigest(Fuyou.config.password_key)

  options = {
    pfxstr: des_encrypt(pfx_string, ca_key),
    customId: Fuyou.config.custom_id,
    password: des_encrypt(Fuyou.config.ca_password, password_key)
  }

  response = http_post('/FuyouRest/sign/signIn', options, skip_sign: true)
  Fuyou.config.token = response['data']['key']
  Fuyou.config.expired_at = DateTime.now + 11.5.hour
end

.sign_outObject

CA 签退



24
25
26
# File 'lib/fuyou/ca.rb', line 24

def sign_out
  http_post('/FuyouRest/sign/signOut', customNo: Fuyou.config.custom_id)
end