You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/lib/wechat/lib/wechat.rb

36 lines
778 B

require 'wechat/cache_file.rb'
require 'wechat/api_loader'
require 'wechat/api'
require 'wechat/corp_api'
require 'action_controller/wechat_responder'
module Wechat
autoload :Message, 'wechat/message'
autoload :Responder, 'wechat/responder'
autoload :Cipher, 'wechat/cipher'
autoload :WechatLog, 'wechat/wechat_log'
autoload :Pay, 'wechat/pay'
class AccessTokenExpiredError < StandardError; end
class ResponseError < StandardError
attr_reader :error_code
def initialize(errcode, errmsg)
@error_code = errcode
super "#{errmsg}(#{error_code})"
end
end
def self.config
ApiLoader.config
end
def self.api
@wechat_api ||= ApiLoader.with({})
end
def self.pay
@wechat_pay ||= Pay.new(self.config)
end
end