예제 #1
0
class NotificationService:

	def __init__(self):
		self.smsService = SmsService()
		self.facebookService = FacebookService()
		self.twitterService = TwitterService()

	def notifyAll(self, message):
		self.smsService.sendEmail(message)
		self.smsService.sendText(message)
		self.facebookService.postToWall(message)
		self.twitterService.tweet(message)

	def notifySocialServices(self, message):
		self.facebookService.postToWall(message)
		self.twitterService.tweet(message)

	def notifyPersonalServices(self, message):
		self.smsService.sendMail(message)
		self.smsService.sendText(message)

	def notifySpecificService(self, service, message):
		{'facebook': self.facebookService.postToWall(message),
		 'twitter': self.twitterService.tweet(message),
		 'email': self.smsService.sendMail(message),
		 'text': self.smsService.sendText(message),
		 }[service]
예제 #2
0
	def __init__(self):
		self.smsService = SmsService()
		self.facebookService = FacebookService()
		self.twitterService = TwitterService()