Class: RockFintech::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rock_fintech/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options_arg) ⇒ Client

Returns a new instance of Client.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rock_fintech/client.rb', line 9

def initialize(options_arg)
  options = Utils.symbolize_keys(options_arg)
  @config = {
    uri: options[:url],
    rft_token: options[:rft_token],
    rft_org: options[:rft_org],
    rft_key: options[:rft_key],
    rft_secret: options[:rft_secret],
    private_key: OpenSSL::PKey::RSA.new(options[:private_key]),
    public_key: OpenSSL::PKey::RSA.new(options[:public_key]),
  }

  # 自动 include api 下的模块
  recursive_include_api('RockFintech::Api')

  # 自动 include form 下的模块
  recursive_include_api('RockFintech::Form')
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



7
8
9
# File 'lib/rock_fintech/client.rb', line 7

def config
  @config
end

Instance Method Details

#verify_data?(data) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/rock_fintech/client.rb', line 28

def verify_data?(data)
  Sign.verify(data, @config)
end