Sha256: 54a7dea7abe9250acc1ef0beb4ee566239f6492ff46740b0c2c0696d4f45a01d
Contents?: true
Size: 443 Bytes
Versions: 3
Compression:
Stored size: 443 Bytes
Contents
module Wechat module Api class JsTicket attr_reader :client, :ticket, :expires_at def initialize(client) @client = client end def refresh js = client.js_ticket @ticket = js['ticket'] @expires_at = DateTime.now + Rational(js['expires_in'].to_i, 3600 * 24) self end def expired? expires_at.nil? || DateTime.now > expires_at end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wechat-api-0.4.3 | lib/wechat/api/js_ticket.rb |
wechat-api-0.4.2 | lib/wechat/api/js_ticket.rb |
wechat-api-0.4.1 | lib/wechat/api/js_ticket.rb |