Sha256: a1b5b035f08eaf97b490eaf1533d1b6dfefeb9aa958f451e93ab3a408ff4beb3
Contents?: true
Size: 610 Bytes
Versions: 1
Compression:
Stored size: 610 Bytes
Contents
module Feed2Gram class RefreshesToken def refresh!(config, config_path) return unless config.access_token_refreshed_at.nil? || config.access_token_refreshed_at < Time.now - (60 * 60) data = Http.get("/oauth/access_token", { grant_type: "fb_exchange_token", client_id: config.facebook_app_id, client_secret: config.facebook_app_secret, fb_exchange_token: config.access_token }) config.access_token = data[:access_token] config.access_token_refreshed_at = Time.now.utc File.write(config_path, config.as_yaml) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
feed2gram-0.0.2 | lib/feed2gram/refreshes_token.rb |