Skip to content
This repository has been archived by the owner on Aug 29, 2019. It is now read-only.

Commit

Permalink
Merge pull request #10 from aweber/move-subscriber-changes
Browse files Browse the repository at this point in the history
Move subscriber changes
  • Loading branch information
pianoman19372 committed Dec 10, 2012
2 parents 5a04d00 + d3bb7fc commit 4e52916
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
---------
2012-05-30: v1.1.2
2012-12-10: v1.1.3
* Added a parameter to the Move Subscriber method for last followup message number sent.
* to support version 1.0.16 of the API. See https://labs.aweber.com/docs/changelog

2012-05-30: v1.1.2
* Fixed SSL Certificate validation issue with httplib >= 0.7.0

2011-10-04: v1.1.1
Expand Down
5 changes: 3 additions & 2 deletions aweber_api/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def delete(self):
self.adapter.request('DELETE', self.url, response='status')
return True

def move(self, list_):
def move(self, list_, **kwargs):
"""Invoke the API method to MOVE an entry resource to a
different List.
Expand All @@ -55,8 +55,9 @@ def move(self, list_):
"""
params = {'ws.op': 'move',
'list_link': list_.self_link}
params.update(kwargs)
response = self.adapter.request('POST', self.url, params,
response='headers')
response='headers')

new_resource = response['location']
self._diff = {}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='aweber_api',
version='1.1.2',
version='1.1.3',
packages=find_packages(exclude=['tests']),
url='https://github.com/aweber/AWeber-API-Python-Library',
install_requires = [
Expand Down
10 changes: 9 additions & 1 deletion tests/test_aweber_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ def setUp(self):
self.subscriber = self.aweber.load_from_url(subscriber_url)
self.subscriber._diff['name'] = 'Joe Schmoe'
self.list = self.aweber.load_from_url(new_list_url)
self.move_subscriber()

def move_subscriber(self, **kwargs):
self.aweber.adapter.requests = []
self.resp = self.subscriber.move(self.list)
self.resp = self.subscriber.move(self.list, **kwargs)
self.move_req = self.aweber.adapter.requests[0]
self.get_req = self.aweber.adapter.requests[1]

Expand Down Expand Up @@ -182,6 +184,12 @@ def test_should_refresh_subscriber_resource(self):
def test_should_reset_diff(self):
self.assertEqual(self.subscriber._diff, {})

def test_should_accept_last_followup_message_number_sent(self):
self.move_subscriber(last_followup_message_number_sent=999)
expected_params = {'ws.op': 'move', 'list_link': self.list.self_link,
'last_followup_message_number_sent': 999}

self.assertEqual(self.move_req['data'], expected_params)

class TestSavingSubscriberData(SubscriberTestCase):

Expand Down

0 comments on commit 4e52916

Please sign in to comment.