Class: Weibo::AccessToken

Inherits:
OAuth2::AccessToken
  • Object
show all
Defined in:
lib/weibo_focus/access_token.rb

Instance Method Summary collapse

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/weibo_focus/access_token.rb', line 8

def expired?
  expires? && (expires_at < time_convertion(Time.now, '+08:00').to_i)
end

#time_convertion(time, time_zone) ⇒ Object

Convert Time from a time zone to another time zone ‘+08:00’ or ‘-08:00’ return Time



16
17
18
# File 'lib/weibo_focus/access_token.rb', line 16

def time_convertion(time, time_zone)
  time.getutc.getlocal(time_zone)
end

#validated?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/weibo_focus/access_token.rb', line 4

def validated?
  !!@expires_at && !expired?
end