Sha256: 2a7c74aff9afa50674df1f7af43f2bf4a34db61d649913d3abce3fad42446e55

Contents?: true

Size: 875 Bytes

Versions: 4

Compression:

Stored size: 875 Bytes

Contents

module Rongcloud
  module Service
    class User < Rongcloud::Service::Model
      attr_accessor :user_id
      attr_accessor :name
      attr_accessor :portrait_uri
      attr_accessor :token

      #获取用户的token
      def get_token
        post = {uri: Rongcloud::Service::API_URI[:USER_GET_TOKEN],
                params: optional_params({userId: self.user_id, name: self.name, portraitUri: self.portrait_uri})
        }
        res = Rongcloud::Service.req_post(post)
        self.token = res[:token]
        res[:token]
      end

      #刷新用户信息
      def refresh
        post = {uri: Rongcloud::Service::API_URI[:USER_REFRESH],
                params: optional_params({userId: self.user_id, name: self.name, portraitUri: self.portrait_uri})
        }
        res = Rongcloud::Service.req_post(post)
        res[:code]==200
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rongcloud-0.1.7 lib/rongcloud/service/user.rb
rongcloud-0.1.6 lib/rongcloud/service/user.rb
rongcloud-0.1.5 lib/rongcloud/service/user.rb
rongcloud-0.1.4 lib/rongcloud/service/user.rb