Module: Wechatpay::Api

Defined in:
lib/wechatpay/api.rb,
lib/wechatpay/api/v3/cert.rb,
lib/wechatpay/api/version.rb,
lib/wechatpay/api/v3/jsapi.rb,
lib/wechatpay/api/v3/trade.rb,
lib/wechatpay/api/v3/client.rb

Defined Under Namespace

Modules: V3 Classes: Error

Constant Summary collapse

VERSION =
'0.2.1'

Class Method Summary collapse

Class Method Details

.client(appid = 'origin_id') ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/wechatpay/api.rb', line 6

def self.client(appid = 'origin_id')
  var = "@v#{appid}"
  if block_given?
    c = yield(V3::Client)
    instance_variable_set var, c
  elsif instance_variable_defined?(var)
    instance_variable_get(var)
  else
    raise Error, :not_initialized
  end
end