Skip to content

Commit b8cd1ee

Browse files
authored
Merge pull request #74 from sendwithus/add-locale-on-create-customer
Add locale on create customer and some CI housekeeping
2 parents 8ae50d5 + a5f5a8c commit b8cd1ee

6 files changed

Lines changed: 23 additions & 14 deletions

File tree

.travis.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ language: python
22

33
matrix:
44
include:
5-
- python: 2.6
6-
env:
7-
- TOXENV='py26'
85
- python: 2.7
96
env:
107
- TOXENV='py27'
@@ -14,7 +11,16 @@ matrix:
1411
- python: 3.5
1512
env:
1613
- TOXENV='py35'
17-
- python: 3.5
14+
- python: 3.6
15+
env:
16+
- TOXENV='py36'
17+
- python: 3.7
18+
env:
19+
- TOXENV='py37'
20+
- python: 3.8
21+
env:
22+
- TOXENV='py38'
23+
- python: 3.8
1824
env:
1925
- TOXENV='lint'
2026

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,17 +437,17 @@ api.customer_details(
437437
)
438438
```
439439

440-
### Create/Update Customer
440+
### Create/Update Customer Locale
441441

442-
You can use the same endpoint to create or update a customer. Sendwithus
443-
will perform a merge of the data on the customer profile, preferring the new data.
442+
You can use the same endpoint to create or update a customer. This is primarily
443+
used to associate a locale with an email address so Sendwithus can
444+
automatically send them the correct template. Note that if your templates are
445+
only in one language then you don't need to use this feature.
444446

445447
```python
446448
api.customer_create(
447449
'customer@example.com',
448-
data={
449-
'first_name': 'Matt'
450-
}
450+
locale="fr-FR"
451451
)
452452
```
453453

sendwithus/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ def send(
565565
timeout=timeout
566566
)
567567

568-
def customer_create(self, email, data=None, timeout=None):
568+
def customer_create(self, email, data=None, locale=None, timeout=None):
569569
if not data:
570570
data = {}
571571

@@ -574,6 +574,9 @@ def customer_create(self, email, data=None, timeout=None):
574574
'data': data
575575
}
576576

577+
if locale:
578+
payload["locale"] = locale
579+
577580
return self._api_request(
578581
self.CUSTOMER_CREATE_ENDPOINT,
579582
self.HTTP_POST,

sendwithus/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '5.1.0'
1+
version = '5.2.0'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
setup(
88
name='sendwithus',
9-
version='5.1.0',
9+
version='5.2.0',
1010
author='sendwithus',
1111
author_email='us@sendwithus.com',
1212
packages=find_packages(),

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{26,27,34,35}, lint
2+
envlist = py{27,34,35,36,37,38}, lint
33
skip_missing_interpreters = true
44

55
[testenv]

0 commit comments

Comments
 (0)