Created
March 20, 2017 10:43
-
-
Save yutannihilation/8638417b71b361abfee7439bb07db883 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| TokenSony <- R6::R6Class("TokenSony", inherit = Token2.0, list( | |
| init_credentials = function() { | |
| super$init_credentials() | |
| # expires_inは秒数なので、POSIXctにしておく | |
| self$credentials$expires_timestamp <- Sys.time() + self$credentials$expires_in | |
| }, | |
| refresh = function() { | |
| super$refresh() | |
| self$credentials$expires_timestamp <- Sys.time() + self$credentials$expires_in | |
| }, | |
| sign = function(method, url) { | |
| # 現在時刻がexpiresを超えていたらいったんrefresh() | |
| if(Sys.time() > self$credentials$expires_timestamp) self$refresh() | |
| super$sign(method, url) | |
| } | |
| )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment