Module: WxExt::Api::Qrcode
Overview
User api of weixin.
Instance Method Summary collapse
-
#create_ticket(access_token, ticket_hash) ⇒ Hash
Create ticket via post.
-
#get_qrcode_by_ticket(ticket) ⇒ Hash
Get the qrcode via ticket.
-
#long_url_2_short(access_token, action = 'long2short', long_url) ⇒ Hash
Long url to short url via post.
Instance Method Details
#create_ticket(access_token, ticket_hash) ⇒ Hash
Create ticket via post.
19 20 21 22 23 |
# File 'lib/wx_ext/api/msg.rb', line 19 def create_ticket(access_token, ticket_hash) url = 'https://api.weixin.qq.com/cgi-bin/qrcode/create'\ "?access_token=#{access_token}" Helper.http_post(url, ticket_hash.to_json) end |
#get_qrcode_by_ticket(ticket) ⇒ Hash
Get the qrcode via ticket.
29 30 31 32 33 |
# File 'lib/wx_ext/api/msg.rb', line 29 def get_qrcode_by_ticket(ticket) url = 'https://mp.weixin.qq.com/cgi-bin/showqrcode'\ "?ticket=#{ticket}" Helper.http_get url end |
#long_url_2_short(access_token, action = 'long2short', long_url) ⇒ Hash
Long url to short url via post.
41 42 43 44 45 |
# File 'lib/wx_ext/api/msg.rb', line 41 def long_url_2_short(access_token, action='long2short', long_url) url = 'https://api.weixin.qq.com/cgi-bin/shorturl'\ "?access_token=#{access_token}" Helper.http_post(url, { action: action, long_url: long_url }.to_json) end |