Class: Wechat::Api
- Includes:
- Concern::Common, Concern::Draft
- Defined in:
- lib/wechat/api.rb
Constant Summary
Constants inherited from ApiBase
Wechat::ApiBase::API_BASE, Wechat::ApiBase::DATACUBE_BASE, Wechat::ApiBase::MP_BASE, Wechat::ApiBase::OAUTH2_BASE, Wechat::ApiBase::QYAPI_BASE, Wechat::ApiBase::TCB_BASE, Wechat::ApiBase::WXA_BASE
Instance Attribute Summary
Attributes inherited from ApiBase
#access_token, #client, #jsapi_ticket, #qcloud
Instance Method Summary collapse
- #add_message_template(template_id_short) ⇒ Object
- #del_message_template(template_id) ⇒ Object
-
#initialize(appid, secret, token_file, network_setting, jsapi_ticket_file, record = nil) ⇒ Api
constructor
A new instance of Api.
- #list_message_template ⇒ Object
- #template_message_send(message) ⇒ Object
Methods included from Concern::Draft
#draft_add, #draft_batchget, #draft_count, #draft_delete, #draft_get, #draft_switch, #draft_update
Methods included from Concern::Common
#addvoicetorecofortext, #custom_message_send, #customservice_getonlinekflist, #get_material, #getusercumulate, #getusersummary, #group_create, #group_delete, #group_update, #groups, #material, #material_add, #material_add_news, #material_count, #material_delete, #material_list, #menu, #menu_addconditional, #menu_create, #menu_delconditional, #menu_delete, #menu_trymatch, #message_mass_delete, #message_mass_get, #message_mass_preview, #message_mass_sendall, #qrcode_create_limit_scene, #qrcode_create_scene, #queryrecoresultfortext, #shorturl, #tag, #tag_add_user, #tag_create, #tag_del_user, #tag_delete, #tag_update, #tags, #translatecontent, #user, #user_batchget, #user_change_group, #user_group, #user_update_remark, #users, #web_access_token, #web_auth_access_token, #web_refresh_access_token, #web_userinfo, #wxa_create_qrcode, #wxa_generate_shortlink, #wxa_generate_urllink, #wxa_get_user_phone_number, #wxa_get_wxacode, #wxa_get_wxacode_unlimit, #wxa_msg_sec_check
Methods inherited from ApiBase
#callbackip, #clear_quota, #media, #media_create, #media_hq, #media_uploadimg, #media_uploadnews, #qrcode
Constructor Details
#initialize(appid, secret, token_file, network_setting, jsapi_ticket_file, record = nil) ⇒ Api
Returns a new instance of Api.
5 6 7 8 9 10 11 |
# File 'lib/wechat/api.rb', line 5 def initialize(appid, secret, token_file, network_setting, jsapi_ticket_file, record = nil) super() @client = HttpClient.new(Wechat::Api::API_BASE, network_setting) @access_token = Token::PublicAccessToken.new(@client, appid, secret, token_file, record) @jsapi_ticket = Ticket::PublicJsapiTicket.new(@client, @access_token, jsapi_ticket_file) @qcloud = nil end |
Instance Method Details
#add_message_template(template_id_short) ⇒ Object
24 25 26 |
# File 'lib/wechat/api.rb', line 24 def (template_id_short) post 'template/api_add_template', JSON.generate(template_id_short: template_id_short) end |
#del_message_template(template_id) ⇒ Object
28 29 30 |
# File 'lib/wechat/api.rb', line 28 def (template_id) post 'template/del_private_template', JSON.generate(template_id: template_id) end |
#list_message_template ⇒ Object
20 21 22 |
# File 'lib/wechat/api.rb', line 20 def get 'template/get_all_private_template' end |
#template_message_send(message) ⇒ Object
16 17 18 |
# File 'lib/wechat/api.rb', line 16 def () post 'message/template/send', .to_json, content_type: :json end |