Skip to content

Commit

Permalink
Merge pull request #38 from aydrian/ISSUE-34
Browse files Browse the repository at this point in the history
Renamed transmission to transmissions retaining backwards compatibility
  • Loading branch information
aydrian committed Aug 21, 2015
2 parents 95e8048 + 303ccda commit 56fbe5f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Here at SparkPost, our messages are known as transmissions. Let's use the underl
sp = SparkPost()
response = sp.transmission.send(
response = sp.transmissions.send(
recipients=['someone@somedomain.com'],
html='<p>Hello world</p>',
from_email='test@sparkpostbox.com',
Expand Down
7 changes: 5 additions & 2 deletions sparkpost/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from .exceptions import SparkPostException
from .metrics import Metrics
from .transmission import Transmission
from .transmissions import Transmissions


__version__ = '1.0.0.dev1'
Expand All @@ -26,4 +26,7 @@ def __init__(self, api_key=None, base_uri='https://api.sparkpost.com',
self.api_key = api_key

self.metrics = Metrics(self.base_uri, self.api_key)
self.transmission = Transmission(self.base_uri, self.api_key)
self.transmissions = Transmissions(self.base_uri, self.api_key)
# Keeping self.transmission for backwards compatibility.
# Will be removed in a future release.
self.transmission = self.transmissions
2 changes: 1 addition & 1 deletion sparkpost/transmission.py → sparkpost/transmissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .base import Resource


class Transmission(Resource):
class Transmissions(Resource):
"""
Transmission class used to send, list and get transmissions. For detailed
request and response formats, see the `Transmissions API documentation
Expand Down
6 changes: 3 additions & 3 deletions test/test_transmission.py → test/test_transmissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import responses

from sparkpost import SparkPost
from sparkpost import Transmission
from sparkpost import Transmissions
from sparkpost.exceptions import SparkPostAPIException


def test_translate_keys_with_list():
t = Transmission('uri', 'key')
t = Transmissions('uri', 'key')
results = t._translate_keys(recipient_list='test')
assert results['return_path'] == 'default@sparkpostmail.com'
assert results['options']['open_tracking'] is True
Expand All @@ -17,7 +17,7 @@ def test_translate_keys_with_list():


def test_translate_keys_with_recips():
t = Transmission('uri', 'key')
t = Transmissions('uri', 'key')
results = t._translate_keys(recipients=['test',
{'key': 'value'}, 'foobar'])
assert results['recipients'] == [{'address': {'email': 'test'}},
Expand Down

0 comments on commit 56fbe5f

Please sign in to comment.