Module: WxExt::Api::Js
Overview
User api of weixin.
Instance Method Summary collapse
-
#get_jsapi_config(access_token, url, app_id) ⇒ Hash
Get js api config hash.
-
#get_jsapi_ticket(access_token) ⇒ Hash
Get js api ticket.
Instance Method Details
#get_jsapi_config(access_token, url, app_id) ⇒ Hash
Get js api config hash.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/wx_ext/api/js.rb', line 30 def get_jsapi_config(access_token, url, app_id) config_hash = {} jsapi_ticket_hash = get_jsapi_ticket(access_token) = noncestr = set_noncestr if jsapi_ticket_hash['errcode'] == 0 jsapi_ticket = jsapi_ticket_hash['ticket'] str = "jsapi_ticket=#{jsapi_ticket}&noncestr=#{noncestr}×tamp=#{}&url=#{url}" signature = Digest::SHA1.hexdigest(str) config_hash = { app_id: app_id, timestamp: , noncestr: noncestr, signature: signature, jsapi_ticket: jsapi_ticket, url: url, str: str } end config_hash end |