Class: Passport::Thrift::ThriftStatUserTrackService

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

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ ThriftStatUserTrackService

Returns a new instance of ThriftStatUserTrackService.



344
345
346
347
348
349
350
351
352
353
# File 'lib/passport_thrift_client.rb', line 344

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

Instance Method Details

#convert_stat_track_model_to_hash(statTrackModel) ⇒ Object



381
382
383
384
385
386
387
# File 'lib/passport_thrift_client.rb', line 381

def convert_stat_track_model_to_hash(statTrackModel)
  unless statTrackModel.nil?
    statTrackModel = statTrackModel.to_hash
    return statTrackModel
  end
  return nil
end

#destroyObject



355
356
357
358
359
360
361
362
363
# File 'lib/passport_thrift_client.rb', line 355

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

#getStatTrack(uid) ⇒ Object



373
374
375
# File 'lib/passport_thrift_client.rb', line 373

def getStatTrack(uid)
  convert_stat_track_model_to_hash(@thriftClient.getStatTrack(uid))
end

#getUserNewTrack(uid) ⇒ Object



365
366
367
# File 'lib/passport_thrift_client.rb', line 365

def getUserNewTrack(uid)
  @thriftClient.getUserNewTrack(uid)
end

#getUserNewTracks(uids) ⇒ Object



377
378
379
# File 'lib/passport_thrift_client.rb', line 377

def getUserNewTracks(uids)
  @thriftClient.getUserNewTracks(uids)
end

#getUserTotalTime(uid) ⇒ Object



369
370
371
# File 'lib/passport_thrift_client.rb', line 369

def getUserTotalTime(uid)
  @thriftClient.getUserTotalTime(uid)
end