class SimpleWechat::Client

Attributes

appid[R]
secret[R]

Public Class Methods

new(appid, secret) click to toggle source
# File lib/simple_wechat/client.rb, line 16
def initialize(appid, secret)
  @appid, @secret = appid, secret  
end

Public Instance Methods

connection() click to toggle source
# File lib/simple_wechat/client.rb, line 29
def connection
  @connection ||= begin
                    conn = Faraday.new do |faraday|
                      faraday.adapter  Faraday.default_adapter
                    end
                  end
end
get_access_token() click to toggle source
# File lib/simple_wechat/client.rb, line 20
def get_access_token
  response = connection.get("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=#{appid}&secret=#{secret}")
  AccessToken.new MultiJson.load(response.body)
end
get_auth_client() click to toggle source
# File lib/simple_wechat/client.rb, line 25
def get_auth_client
  AuthClient.new(appid, secret)
end