Class: Passport::Thrift::ThriftThirdpartySyncSetService

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

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ ThriftThirdpartySyncSetService

Returns a new instance of ThriftThirdpartySyncSetService.



391
392
393
394
395
396
397
398
399
400
# File 'lib/passport_thrift_client.rb', line 391

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

Instance Method Details

#convert_sync_set_to_hash(sync_set) ⇒ Object



462
463
464
465
466
467
# File 'lib/passport_thrift_client.rb', line 462

def convert_sync_set_to_hash(sync_set)
  unless sync_set.nil?
    return sync_set.to_hash
  end
  return nil
end

#destroyObject



402
403
404
405
406
407
408
409
410
# File 'lib/passport_thrift_client.rb', line 402

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

#getSyncSetByType(tpUid, thirdpartyName, syncType) ⇒ Object



440
441
442
# File 'lib/passport_thrift_client.rb', line 440

def getSyncSetByType(tpUid, thirdpartyName, syncType)
  @thriftClient.getSyncSetByType(tpUid, thirdpartyName, syncType)
end

#insertDefalutSyncSet(tpUid, thirdpartyName) ⇒ Object



412
413
414
# File 'lib/passport_thrift_client.rb', line 412

def insertDefalutSyncSet(tpUid, thirdpartyName)
  convert_sync_set_to_hash(@thriftClient.insertDefalutSyncSet(tpUid, thirdpartyName))
end

#insertOrUpdateToDefaultSet(tpUid, thirdpartyName) ⇒ Object



416
417
418
# File 'lib/passport_thrift_client.rb', line 416

def insertOrUpdateToDefaultSet(tpUid, thirdpartyName)
  convert_sync_set_to_hash(@thriftClient.insertOrUpdateToDefaultSet(tpUid, thirdpartyName))
end

#noMoreCommentSyncAlert(uid, noMoreAlert) ⇒ Object



432
433
434
# File 'lib/passport_thrift_client.rb', line 432

def noMoreCommentSyncAlert(uid, noMoreAlert)
  @thriftClient.noMoreCommentSyncAlert(uid, noMoreAlert)
end

#noMoreFavoriteSyncAlert(uid, noMoreAlert) ⇒ Object



436
437
438
# File 'lib/passport_thrift_client.rb', line 436

def noMoreFavoriteSyncAlert(uid, noMoreAlert)
  @thriftClient.noMoreFavoriteSyncAlert(uid, noMoreAlert)
end

#queryBindThirdpartySyncSet(bindStatusHashs) ⇒ Object



448
449
450
451
452
453
454
455
456
457
458
459
460
# File 'lib/passport_thrift_client.rb', line 448

def queryBindThirdpartySyncSet(bindStatusHashs)
  unless bindStatusHashs.nil?
    bindStatus = []
    bindStatusHashs.each{ |t| bindStatus << BindStatus.new(t) }
    syncSets = @thriftClient.queryBindThirdpartySyncSet(bindStatus)
    unless syncSets.nil?
      sync_set_hashs = []
      syncSets.each { |t| sync_set_hashs << convert_sync_set_to_hash(t)}
      return sync_set_hashs
    end
  end
  return []
end

#queryByTpUid(tpUid, thirdpartyName) ⇒ Object



444
445
446
# File 'lib/passport_thrift_client.rb', line 444

def queryByTpUid(tpUid, thirdpartyName)
  convert_sync_set_to_hash(@thriftClient.queryByTpUid(tpUid, thirdpartyName))
end

#updateOrInsertMultiSyncSetColumn(tpUid, thirdpartyName, types) ⇒ Object



424
425
426
# File 'lib/passport_thrift_client.rb', line 424

def updateOrInsertMultiSyncSetColumn(tpUid, thirdpartyName, types)
  @thriftClient.updateOrInsertMultiSyncSetColumn(tpUid, thirdpartyName, types)
end

#updateOrInsertMultiSyncSetColumnSelective(tpUid, thirdpartyName, checkedTypes, unCheckedTypes) ⇒ Object



428
429
430
# File 'lib/passport_thrift_client.rb', line 428

def updateOrInsertMultiSyncSetColumnSelective(tpUid, thirdpartyName, checkedTypes, unCheckedTypes)
  @thriftClient.updateOrInsertMultiSyncSetColumnSelective(tpUid, thirdpartyName, checkedTypes, unCheckedTypes)
end

#updateOrInsertSyncSet(tpUid, thirdpartyName, syncType, isChecked) ⇒ Object



420
421
422
# File 'lib/passport_thrift_client.rb', line 420

def updateOrInsertSyncSet(tpUid, thirdpartyName, syncType, isChecked)
  @thriftClient.updateOrInsertSyncSet(tpUid, thirdpartyName, syncType, isChecked)
end