"""
Copyright (c) 2012 Anant Bhardwaj

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
from abc import ABCMeta, abstractmethod
from google_voice.main import GoogleVoice
from africa_talking.main import AfricaTalking
import config

'''
@author: anant bhardwaj
@date: Oct 4, 2012

VoiceX public APIs
'''	

class VoiceX:
	def __init__(self, client=config.GV):
		__metaclass__ = ABCMeta
		if(client == config.GV):
			self.client = GoogleVoice(config.GV['username'], config.GV['password'], d = False)
		elif(client == config.AT):
			self.client = AfricaTalking(config.AP['username'], config.GV['api_key'])
		else:
			raise
	
	@abstractmethod	
	def set_callback(self, callback):
		self.client.set_callback(callback)

	@abstractmethod
	def sms(self, to, text):
		self.client.sms(to, text)

	@abstractmethod
	def mark_read(self, msg):
		self.client.mark_read(msg)

	@abstractmethod
	def mark_unread(self, msg):
		self.client.mark_unread(msg)

	@abstractmethod
	def delete(self, msg):
		self.client.delete(msg)

	@abstractmethod
	def fetch_unread_sms():
		self.client.fetch_unread_sms()

	@abstractmethod
	def fetch_all_sms(self):
		self.client.fetch_all_sms()

class Test():
	def __init__(self):		
		self.client = VoiceX()
		self.client.set_callback(callback = self.msg_new)

	def msg_new(self, msg):
		print "Got text [ %s ] from [%s]." %(msg['text'], msg['from'])
		print self.client.mark_read(msg)
		print self.client.sms(msg['from'], "Ack :" + msg['text'])
		print self.client.delete(msg)

def main():	
	Test()



if __name__ == "__main__":
	main()

@@ -1063,48 +1063,9 @@
 %22%22%22%0A
-from abc import ABCMeta, abstractmethod
 %0A
+
 from
@@ -1293,34 +1293,8 @@
 V):%0A
-%09%09__metaclass__ = ABCMeta%0A
 %09%09if
@@ -1527,28 +1527,29 @@
 aise
-%0A%09%0A%09@abstractmethod%09
+ NotImplementedError%0A
 %0A%09de
@@ -1618,33 +1618,16 @@
 lback)%0A%0A
-%09@abstractmethod%0A
 %09def sms
@@ -1673,33 +1673,16 @@
  text)%0A%0A
-%09@abstractmethod%0A
 %09def mar
@@ -1730,33 +1730,16 @@
 d(msg)%0A%0A
-%09@abstractmethod%0A
 %09def mar
@@ -1791,33 +1791,16 @@
 d(msg)%0A%0A
-%09@abstractmethod%0A
 %09def del
@@ -1842,33 +1842,16 @@
 e(msg)%0A%0A
-%09@abstractmethod%0A
 %09def fet
@@ -1905,25 +1905,8 @@
 ()%0A%0A
-%09@abstractmethod%0A
 %09def
@@ -2304,16 +2304,16 @@
 ain():%09%0A
+
 %09Test()%0A
@@ -2313,18 +2313,16 @@
 Test()%0A%0A
-%0A%0A
 if __nam

remove all un-necessary abstractions