.. ibires documentation master file, created by sphinx-quickstart on Mon Oct 3 21:15:57 2016. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. Build an SMS Service with Infobip ================================= ibires (:ref:`Installation `) is a set of building blocks to * design a SMS service from scratch. * follow a `test-driven`_ approach. * simulate `Infobip`_'s `single SMS`_ server behaviour. You want this if you want to get your code right before sending your first SMS. ibires is short for InfoBIp REport Simulator. .. _Infobip: http://www.infobip.com .. _single SMS: https://dev.infobip.com/docs/send-single-sms .. _test-driven: https://en.wikipedia.org/wiki/Test-driven_development Overview -------- 1. Write the test. 2. Get your function right until the test passes. 3. Your function will work with the real server as the test resembles the server's functionality. You * don't risk to send any real SMS (as long you don't forget ``@responses.activate``) * don't need an account with `Infobip`_. * don't need a web connection. Since your test passes, you can safely assume that your function will work out of the box from the very first SMS on (presuming your login and balance permit). En Détail --------- .. literalinclude:: ../src/python/ibires/test/example_test.py Run ``py.test`` to see whether the test passes. If it does, your function ``send_messages()`` is likely to run without any glitches right from the very first message. Access the Report Generators Directly ===================================== You may want to generate the report's directly:: from ibires.reports import gen_accepted, gen_dlr # The report you get when you post the message goes like: >>> gen_accepted(error = False) {'messages': [{'messageId': '68506e2f-f6fb-48bb-ae26-f342ccfd0e16', 'smsCount': 1, 'status': {'description': 'Message sent to next instance', 'groupId': 1, 'groupName': 'PENDING', 'id': 7, 'name': 'PENDING_ENROUTE'}, 'to': '919999999999'}]} # The final delivery report (either we pull it or it is pushed to a URI): >>> gen_dlr(delivered = True) {'results': [{'doneAt': '2016-10-04 12:14:24.079+0200', 'error': {'description': 'No error', 'groupId': 0, 'groupName': 'OK', 'id': 0, 'name': 'NO_ERROR', 'permanent': False}, 'messageId': 'be2606e9-087f-4885-87bb-5d0fa10acd1f', 'price': {'currency': 'EUR', 'pricePerMessage': 0.01}, 'sentAt': '2016-10-04 12:14:24.079+0200', 'smsCount': 1, 'status': {'description': 'Message delivered to operator', 'groupId': 3, 'groupName': 'DELIVERED', 'id': 2, 'name': 'DELIVERED_TO_OPERATOR'}, 'to': '919999999999'}]} # Oh, here, things have gone wrong: >>> gen_dlr(delivered = False) {'results': [{'doneAt': '2016-10-04 12:14:24.079+0200', 'error': {'description': 'Operator error occured.', 'groupId': 3, 'groupName': 'OPERATOR_ERRORS', 'id': 20, 'name': 'EC_SS_INCOMPATIBILITY', 'permanent': False}, 'messageId': '598b5d9b-328f-42c9-9b08-adc7baa18b56', 'price': {'currency': 'EUR', 'pricePerMessage': 0.01}, 'sentAt': '2016-10-04 12:14:24.079+0200', 'smsCount': 1, 'status': {'description': 'Route not available', 'groupId': 5, 'groupName': 'REJECTED', 'id': 19, 'name': 'REJECTED_ROUTE_NOT_AVAILABLE'}, 'to': '919999999999'}]} Contents ======== .. toctree:: :maxdepth: 2 install api Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search`