Module: WeixinAuthorize::Api::Qrcode

Included in:
Client
Defined in:
lib/weixin_authorize/api/qrcode.rb

Instance Method Summary collapse

Instance Method Details

#create_qr_limit_scene(options) ⇒ Object

永久二维码 options: scene_id, scene_str



25
26
27
28
29
30
# File 'lib/weixin_authorize/api/qrcode.rb', line 25

def create_qr_limit_scene(options)
  scene_id = options[:scene_id]
  qrcode_infos = {action_name: "QR_LIMIT_SCENE"}
  qrcode_infos.merge!(action_info(scene_id))
  http_post(qrcode_base_url, qrcode_infos)
end

#create_qr_limit_str_scene(options) ⇒ Object

为永久的字符串参数值 options: scene_str



34
35
36
37
38
39
# File 'lib/weixin_authorize/api/qrcode.rb', line 34

def create_qr_limit_str_scene(options)
  scene_str = options[:scene_str]
  qrcode_infos = {action_name: "QR_LIMIT_STR_SCENE"}
  qrcode_infos.merge!(action_info(nil, scene_str))
  http_post(qrcode_base_url, qrcode_infos)
end

#create_qr_scene(scene_id, expire_seconds = 1800) ⇒ Object

临时二维码



8
9
10
11
12
# File 'lib/weixin_authorize/api/qrcode.rb', line 8

def create_qr_scene(scene_id, expire_seconds=1800)
  qrcode_infos = {action_name: "QR_SCENE", expire_seconds: expire_seconds}
  qrcode_infos.merge!(action_info(scene_id))
  http_post(qrcode_base_url, qrcode_infos)
end

#create_qr_str_scene(options, expire_seconds = 1800) ⇒ Object

临时字符串参数二维码



15
16
17
18
19
20
# File 'lib/weixin_authorize/api/qrcode.rb', line 15

def create_qr_str_scene(options, expire_seconds=1800)
  scene_str = options[:scene_str]
  qrcode_infos = {action_name: "QR_STR_SCENE", expire_seconds: expire_seconds}
  qrcode_infos.merge!(action_info(nil, scene_str))
  http_post(qrcode_base_url, qrcode_infos)
end

#qr_code_url(ticket) ⇒ Object

通过ticket换取二维码, 直接访问即可显示!



43
44
45
# File 'lib/weixin_authorize/api/qrcode.rb', line 43

def qr_code_url(ticket)
  WeixinAuthorize.mp_endpoint("/showqrcode?ticket=#{ticket}")
end