Class: Lanmao::Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options_arg) ⇒ Client

Returns a new instance of Client.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/lanmao/client.rb', line 25

def initialize(options_arg)
  options = Utils.symbolize_keys(options_arg)
  @config = {
    path: options[:path],
    platform_no: options[:platform_no],
    key_serial: options[:key_serial],
    private_key: OpenSSL::PKey::RSA.new(options[:private_key]),
    public_key: OpenSSL::PKey::RSA.new(options[:public_key]),
  }

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

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

Instance Attribute Details

#configObject

Returns the value of attribute config.



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

def config
  @config
end

Instance Method Details

#verify_data?(data) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/lanmao/client.rb', line 42

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