Module: Wechat::Api::Program::Wxaapi

Included in:
Wechat::Api::Program
Defined in:
app/apis/wechat/api/program/wxaapi.rb

Constant Summary collapse

BASE =
'https://api.weixin.qq.com/wxaapi/'

Instance Method Summary collapse

Instance Method Details

#add_template(tid, kid_list, description: 'tst') ⇒ Object



22
23
24
# File 'app/apis/wechat/api/program/wxaapi.rb', line 22

def add_template(tid, kid_list, description: 'tst')
  post 'newtmpl/addtemplate', tid: tid, kidList: kid_list, sceneDesc: description, base: BASE
end

#del_template(template_id) ⇒ Object



26
27
28
# File 'app/apis/wechat/api/program/wxaapi.rb', line 26

def del_template(template_id)
  post 'newtmpl/deltemplate', params: { priTmplId: template_id }, base: BASE
end

#template_key_words(tid) ⇒ Object



17
18
19
20
# File 'app/apis/wechat/api/program/wxaapi.rb', line 17

def template_key_words(tid)
  r = get 'newtmpl/getpubtemplatekeywords', params: { tid: tid }, base: BASE
  r['data']
end

#templatesObject



6
7
8
9
10
11
12
13
14
# File 'app/apis/wechat/api/program/wxaapi.rb', line 6

def templates
  r = get 'newtmpl/gettemplate', base: BASE
  if r['errcode'] === 0
    r['data']
  else
    Rails.logger.info r
    []
  end
end