Skip to content

Commit 094a911

Browse files
authored
Merge pull request #99 from PurplShip/carrier-tracking-integration-spree
[release] Carrier Tracking integration spree
2 parents aa17664 + c5a0004 commit 094a911

File tree

229 files changed

+10561
-1072
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+10561
-1072
lines changed
Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,30 @@
1-
# Carrier
1+
# purplship.carrier
2+
3+
This package is a [Carrier Name] extension of the [purplship](https://pypi.org/project/purplship) multi carrier shipping SDK.
4+
5+
## Requirements
6+
7+
`Python 3.6+`
8+
9+
## Installation
10+
11+
```bash
12+
pip install purplship.carrier
13+
```
14+
15+
## Usage
16+
17+
```python
18+
import purplship
19+
from purplship.mappers.carrier.settings import Settings
20+
21+
22+
# Initialize a carrier gateway
23+
canadapost = purplship.gateway["[carrier_name]"].create(
24+
Settings(
25+
...
26+
)
27+
)
28+
```
29+
30+
Check the [Purplship Mutli-carrier SDK docs](https://sdk.purplship.com) for Shipping API requests

.templates/extensions/carrier/purplship/mappers/carrier/__init__.py

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

88

99
METADATA = Metadata(
10-
label="[carrier label]",
10+
label="[Carrier Name]",
1111

1212
# Integrations
1313
Mapper=Mapper,
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
"""Purplship [carrier] settings."""
1+
"""Purplship [Carrier Name] settings."""
22

33
import attr
44
from purplship.providers.carrier.utils import Settings as BaseSettings
55

66

77
@attr.s(auto_attribs=True)
88
class Settings(BaseSettings):
9-
"""[carrier] connection settings."""
9+
"""[Carrier Name] connection settings."""
1010

1111
# Carrier specific properties
1212
# username: str
@@ -16,4 +16,4 @@ class Settings(BaseSettings):
1616
# Base properties
1717
id: str = None
1818
test: bool = False
19-
carrier_id: str = "dhl_express"
19+
carrier_id: str = "[carrier_name]"

.templates/extensions/carrier/purplship/providers/carrier/utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
class Settings(BaseSettings):
5-
"""[carrier] connection settings."""
5+
"""[Carrier Name] connection settings."""
66

77
# username: str
88
# password: str
@@ -11,8 +11,12 @@ class Settings(BaseSettings):
1111

1212
@property
1313
def carrier_name(self):
14-
return "carrier"
14+
return "[carrier_name]"
1515

1616
@property
1717
def server_url(self):
18-
return "https://api.carrier.com/"
18+
return (
19+
"https://dev-api.carrier.com"
20+
if self.test
21+
else "https://api.carrier.com"
22+
)

.templates/extensions/carrier/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ classifiers=[
1616
]
1717

1818
[tool.poetry.dependencies]
19-
python = "^3.6"
19+
python = "^3.7"
2020
"purplship" = ""
21-
"carrier.carrier" = "[version]"
21+
"carrier.[carrier]" = ""
2222

2323
[tool.poetry.dev-dependencies]
2424

2525
[build-system]
26-
requires = ["poetry-core>=1.0.0"]
26+
requires = ["poetry-core>=1.0.0", "setuptools!=50.0"]
2727
build-backend = "poetry.core.masonry.api"

.templates/extensions/carrier/setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
from setuptools import setup, find_namespace_packages
44

55
setup(
6-
name='purplship.[carrier]',
7-
version='[version]',
6+
name='purplship.[carrier_name]',
7+
version='0.0.0-dev',
88
license='LGPLv3',
99
packages=find_namespace_packages(),
10-
install_requires=['purplship', 'carrier.carrier_name'],
10+
install_requires=['purplship', 'carrier.[carrier_name]'],
1111
zip_safe=False,
1212
)

.templates/tests/carrier/address.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_create_address_validation_request(self):
2424
)
2525

2626
def test_validate_address(self):
27-
with patch("purplship.mappers.carrier.proxy.http") as mock:
27+
with patch("purplship.mappers.[carrier].proxy.http") as mock:
2828
mock.return_value = "<a></a>"
2929
purplship.Address.validate(self.AddressValidationRequest).from_(gateway)
3030

@@ -34,7 +34,7 @@ def test_validate_address(self):
3434
)
3535

3636
def test_parse_address_validation_response(self):
37-
with patch("purplship.mappers.carrier.proxy.http") as mock:
37+
with patch("purplship.mappers.[carrier].proxy.http") as mock:
3838
mock.return_value = AddressValidationResponseXML
3939
parsed_response = (
4040
purplship.Address.validate(self.AddressValidationRequest)

.templates/tests/carrier/fixture.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import purplship
22

3-
gateway = purplship.gateway["carrier"].create(
3+
gateway = purplship.gateway["[carrier]"].create(
44
dict(
55
# username="user_id",
66
# password="password",

.templates/tests/carrier/pickup.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_create_cancel_pickup_request(self):
3636
self.assertEqual(request.serialize(), PickupCancelRequestXML)
3737

3838
def test_request_pickup(self):
39-
with patch("purplship.mappers.carrier.proxy.http") as mock:
39+
with patch("purplship.mappers.[carrier].proxy.http") as mock:
4040
mock.return_value = "<a></a>"
4141
purplship.Pickup.schedule(self.PickupRequest).from_(gateway)
4242

@@ -46,7 +46,7 @@ def test_request_pickup(self):
4646
)
4747

4848
def test_modify_pickup(self):
49-
with patch("purplship.mappers.carrier.proxy.http") as mocks:
49+
with patch("purplship.mappers.[carrier].proxy.http") as mocks:
5050
mocks.side_effect = [
5151
PickupResponseXML,
5252
]
@@ -60,7 +60,7 @@ def test_modify_pickup(self):
6060
)
6161

6262
def test_cancel_pickup(self):
63-
with patch("purplship.mappers.carrier.proxy.http") as mock:
63+
with patch("purplship.mappers.[carrier].proxy.http") as mock:
6464
mock.return_value = "<a></a>"
6565
purplship.Pickup.cancel(self.PickupCancelRequest).from_(gateway)
6666

@@ -70,7 +70,7 @@ def test_cancel_pickup(self):
7070
)
7171

7272
def test_parse_request_pickup_response(self):
73-
with patch("purplship.mappers.carrier.proxy.http") as mock:
73+
with patch("purplship.mappers.[carrier].proxy.http") as mock:
7474
mock.return_value = PickupResponseXML
7575
parsed_response = (
7676
purplship.Pickup.schedule(self.PickupRequest).from_(gateway).parse()
@@ -79,7 +79,7 @@ def test_parse_request_pickup_response(self):
7979
self.assertEqual(DP.to_dict(parsed_response), DP.to_dict(ParsedPickupResponse))
8080

8181
def test_parse_modify_pickup_response(self):
82-
with patch("purplship.mappers.carrier.proxy.http") as mocks:
82+
with patch("purplship.mappers.[carrier].proxy.http") as mocks:
8383
mocks.side_effect = [
8484
PickupResponseXML,
8585
]
@@ -90,7 +90,7 @@ def test_parse_modify_pickup_response(self):
9090
self.assertEqual(DP.to_dict(parsed_response), DP.to_dict(ParsedPickupResponse))
9191

9292
def test_parse_void_shipment_response(self):
93-
with patch("purplship.mappers.carrier.proxy.http") as mock:
93+
with patch("purplship.mappers.[carrier].proxy.http") as mock:
9494
mock.return_value = PickupCancelResponseXML
9595
parsed_response = (
9696
purplship.Pickup.cancel(self.PickupCancelRequest).from_(gateway).parse()

.templates/tests/carrier/rate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def test_create_rate_request(self):
1717
self.assertEqual(request.serialize(), RateRequestXML)
1818

1919
def test_get_rates(self):
20-
with patch("purplship.mappers.carrier.proxy.http") as mock:
20+
with patch("purplship.mappers.[carrier].proxy.http") as mock:
2121
mock.return_value = "<a></a>"
2222
Rating.fetch(self.RateRequest).from_(gateway)
2323

@@ -27,7 +27,7 @@ def test_get_rates(self):
2727
)
2828

2929
def test_parse_rate_response(self):
30-
with patch("purplship.mappers.carrier.proxy.http") as mock:
30+
with patch("purplship.mappers.[carrier].proxy.http") as mock:
3131
mock.return_value = RateResponseXml
3232
parsed_response = Rating.fetch(self.RateRequest).from_(gateway).parse()
3333

0 commit comments

Comments
 (0)