Class: WechatPublicApi

Inherits:
Object
  • Object
show all
Includes:
AccessToken, Account, Aes, Kf, Material, Menu, Tp, User, Utils
Defined in:
lib/wechat_public_api/aes.rb,
lib/wechat_public_api.rb,
lib/wechat_public_api/menu.rb,
lib/wechat_public_api/user.rb,
lib/wechat_public_api/utils.rb,
lib/wechat_public_api/account.rb,
lib/wechat_public_api/version.rb,
lib/wechat_public_api/material.rb,
lib/wechat_public_api/kf_message.rb,
lib/wechat_public_api/access_token.rb,
lib/wechat_public_api/templet_message.rb

Overview

微信公众号模板消息相关接口 (About templet message of wechat public) Created by zhangmingxin Date: 2018-05-17 Wechat number: zmx119966

Defined Under Namespace

Modules: AccessToken, Account, Aes, Kf, Material, Menu, Tp, User, Utils

Constant Summary collapse

VERSION =
"0.1.7"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from User

#get_userinfo

Methods included from Tp

#post_template_message, #tp_delete_template, #tp_general_message, #tp_get_all, #tp_miniprogram_message

Methods included from Menu

#create_menu, #delete_menu, #query_menu

Methods included from Material

#upload_image_material, #upload_image_media

Methods included from Kf

#kf_image_message, #kf_mpnews_message, #kf_news_message, #kf_text_message, #kf_voice_message, #post_customer_message

Methods included from Aes

#decrypt, #encrypt

Methods included from Account

#get_qrscene, #get_qrsrtscene, #get_shorturl, #save_qrcode

Methods included from AccessToken

#get_access_token

Constructor Details

#initialize(options = {}) ⇒ WechatPublicApi

Returns a new instance of WechatPublicApi.



33
34
35
36
37
# File 'lib/wechat_public_api.rb', line 33

def initialize(options={})
  @app_id = options[:app_id]
  @app_secret = options[:app_secret]
  @access_token_cache = options[:access_token_cache]
end

Instance Attribute Details

#access_token_cacheObject

默认不缓存 access_token, access_token_cache = True 缓存

> example

wechat_api = WechatPublicApi.new appid: ‘xx’, app_secret: ‘xx’, access_token_cache: true wechat_api.app_id – get appid

api.get_access_token

Parameters:

  • aoptions (hash)


32
33
34
# File 'lib/wechat_public_api.rb', line 32

def access_token_cache
  @access_token_cache
end

#app_idObject

默认不缓存 access_token, access_token_cache = True 缓存

> example

wechat_api = WechatPublicApi.new appid: ‘xx’, app_secret: ‘xx’, access_token_cache: true wechat_api.app_id – get appid

api.get_access_token

Parameters:

  • aoptions (hash)


32
33
34
# File 'lib/wechat_public_api.rb', line 32

def app_id
  @app_id
end

#app_secretObject

默认不缓存 access_token, access_token_cache = True 缓存

> example

wechat_api = WechatPublicApi.new appid: ‘xx’, app_secret: ‘xx’, access_token_cache: true wechat_api.app_id – get appid

api.get_access_token

Parameters:

  • aoptions (hash)


32
33
34
# File 'lib/wechat_public_api.rb', line 32

def app_secret
  @app_secret
end