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.



399
400
401
402
403
404
405
406
407
408
# File 'lib/passport_thrift_client.rb', line 399

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



470
471
472
473
474
475
# File 'lib/passport_thrift_client.rb', line 470

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

#destroyObject



410
411
412
413
414
415
416
417
418
# File 'lib/passport_thrift_client.rb', line 410

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



448
449
450
# File 'lib/passport_thrift_client.rb', line 448

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

#insertDefalutSyncSet(tpUid, thirdpartyName) ⇒ Object



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

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

#insertOrUpdateToDefaultSet(tpUid, thirdpartyName) ⇒ Object



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

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

#noMoreCommentSyncAlert(uid, noMoreAlert) ⇒ Object



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

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

#noMoreFavoriteSyncAlert(uid, noMoreAlert) ⇒ Object



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

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

#queryBindThirdpartySyncSet(bindStatusHashs) ⇒ Object



456
457
458
459
460
461
462
463
464
465
466
467
468
# File 'lib/passport_thrift_client.rb', line 456

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



452
453
454
# File 'lib/passport_thrift_client.rb', line 452

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

#updateOrInsertMultiSyncSetColumn(tpUid, thirdpartyName, types) ⇒ Object



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

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

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



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

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

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



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

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