Class: Passport::Thrift::ThriftLoginService

Inherits:
Object
  • Object
show all
Defined in:
lib/passport_thrift_client.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ ThriftLoginService

Returns a new instance of ThriftLoginService.



209
210
211
212
213
214
215
216
217
218
# File 'lib/passport_thrift_client.rb', line 209

def initialize(config = {})
  if config['servers'].nil? 
    raise 'servers must be determined!'
    return
  end
  config = DEFAULT_CONFIG.merge(config)
  config['client_class'] = 'Passport::Thrift::RemoteLoginService::Client'
  @thriftClient = ThriftClient.new(config)
  @@logger = LoggerFactory.getLogger("ThriftLoginService")
end

Instance Method Details

#checkLogin(token, rememberMe, loginHelpInfoHash) ⇒ Object



230
231
232
233
# File 'lib/passport_thrift_client.rb', line 230

def checkLogin(token, rememberMe, loginHelpInfoHash)
  loginHelpInfo = LoginHelpInfo.new(loginHelpInfoHash)
  @thriftClient.checkLogin(token, rememberMe, loginHelpInfo)
end

#destroyObject



220
221
222
223
224
225
226
227
228
# File 'lib/passport_thrift_client.rb', line 220

def destroy
  @@logger.error("before ThriftLoginService destroy")
  begin
    @thriftClient.destroy
  rescue Exception => e
    @@logger.error("ThriftLoginService destroy error !! #{e.message}" + "\n" + e.backtrace.join("\n"))
  end
  @@logger.error("ThriftLoginService destroyed!")
end

#login(loginInfoHash, loginHelpInfoHash) ⇒ Object



235
236
237
238
239
240
241
242
243
# File 'lib/passport_thrift_client.rb', line 235

def (loginInfoHash, loginHelpInfoHash)
  loginHelpInfo = LoginHelpInfo.new(loginHelpInfoHash)
  loginInfo = LoginInfo.new(loginInfoHash)
  mobileLoginInfo = @thriftClient.(info, loginHelpInfo)
  unless mobileLoginInfo.nil?
    return mobileLoginInfo.to_hash
  end
  return nil
end

#logout(mobileLoginInfoHash, deviceToken) ⇒ Object



245
246
247
248
# File 'lib/passport_thrift_client.rb', line 245

def logout(mobileLoginInfoHash, deviceToken)
  mobileLoginInfo = MobileLoginInfo(mobileLoginInfoHash)
  @thriftClient.logout(mobileLoginInfo, deviceToken)
end