lib/bumeran.rb in bumeran-0.3.4 vs lib/bumeran.rb in bumeran-0.3.5

- old
+ new

@@ -84,21 +84,23 @@ end end def self.invalidate_access_token! @@access_token = nil + @@access_token_updated_at = nil end def self.revalidate_access_token Bumeran.invalidate_access_token! Bumeran.initialize end def self.has_valid_access_token? if @@access_token && @@access_token_updated_at && @@expires_in - (Time.now < @@access_token_updated_at + @@expires_in.seconds + 10.seconds) + (Time.current < @@access_token_updated_at + @@expires_in.seconds + 5.minutes) else + Bumeran.invalidate_access_token! false end end # Publicaciones / Avisos @@ -596,10 +598,10 @@ if Parser.parse_response_to_json(response) # "All good!" @@access_token = response["accessToken"] @@token_type = response["tokenType"] @@expires_in = response["expiresIn"] - @@access_token_updated_at = Time.now + @@access_token_updated_at = Time.current return @@access_token end end