lib/vkontakte_api/client.rb in vkontakte_api-1.3.1 vs lib/vkontakte_api/client.rb in vkontakte_api-1.4
- old
+ new
@@ -25,13 +25,19 @@
}
# An access token needed by authorized requests.
# @return [String]
attr_reader :token
+
# Current user id.
# @return [Integer]
attr_reader :user_id
+
+ # Current user email.
+ # @return [String]
+ attr_reader :email
+
# Token expiration time
# @return [Time]
attr_reader :expires_at
# A new API client.
@@ -42,9 +48,10 @@
def initialize(token = nil)
if token.respond_to?(:token) && token.respond_to?(:params)
# token is an OAuth2::AccessToken
@token = token.token
@user_id = token.params['user_id']
+ @email = token.params['email']
@expires_at = Time.at(token.expires_at) unless token.expires_at.nil?
else
# token is a String or nil
@token = token
end