Sha256: a0e28ac2dcb7a39b908fdc4d81b111cc1b450b50e6a125cd097bdaa8dca2420e
Contents?: true
Size: 729 Bytes
Versions: 11
Compression:
Stored size: 729 Bytes
Contents
module SolidusMe class Account < ApplicationRecord def check_token return if client_id.blank? || client_secret.blank? || refresh_token.blank? return if (token_expires_in - 1.day) > DateTime.now refresh end def refresh refresh_json = MeApi::Client.new.refresh_token( client_id: client_id, client_secret: client_secret, refresh_token: refresh_token ).json access_token = refresh_json["access_token"] refresh_token = refresh_json["refresh_token"] token_expires_in = DateTime.now.utc + refresh_json["expires_in"].seconds update(access_token: access_token, refresh_token: refresh_token, token_expires_in: token_expires_in) end end end
Version data entries
11 entries across 11 versions & 1 rubygems