Class: Zhima::Score

Inherits:
Object
  • Object
show all
Defined in:
lib/zhima/score.rb

Constant Summary collapse

AUTHORIZE_METHOD =
'zhima.auth.info.authorize'.freeze
SCORE_METHOD =
'zhima.credit.score.get'.freeze
AUTH_QUERY_METHOD =
'zhima.auth.info.authquery'.freeze

Class Method Summary collapse

Class Method Details

.auth_query(params, sys_options = {}) ⇒ Object



21
22
23
# File 'lib/zhima/score.rb', line 21

def self.auth_query(params, sys_options = {})
  Request.new(params, sys_options.merge(method: AUTH_QUERY_METHOD)).execute
end

.auth_url(params, sys_options = {}) ⇒ Object

params参数 请参考 b.zmxy.com.cn/technology/openDoc.htm?id=67 系统参数 SYSTEM_OPTIONS,可自己传入,一般只需要配置channel参数(与auth_code不对应芝麻信用会报错)



11
12
13
# File 'lib/zhima/score.rb', line 11

def self.auth_url(params, sys_options = {})
  Request.new(params, sys_options.merge(method: AUTHORIZE_METHOD)).url
end

.get(params, sys_options = {}) ⇒ Object



16
17
18
# File 'lib/zhima/score.rb', line 16

def self.get(params, sys_options = {})
  Request.new(params, sys_options.merge(method: SCORE_METHOD)).execute
end

.param_decrypt(params_str) ⇒ Object

芝麻callback url中的params参数解密方法



26
27
28
29
# File 'lib/zhima/score.rb', line 26

def self.param_decrypt(params_str)
  decrypted_str = Param.decrypt(params_str)
  URI.decode_www_form(URI.decode URI.escape(decrypted_str)).to_h
end