odoo-somconnexio-python-client 0.1.53__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/PKG-INFO +1 -1
- odoo_somconnexio_python_client-0.2.0/odoo_somconnexio_python_client/__init__.py +1 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/client.py +6 -3
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/exceptions.py +8 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/product_catalog.py +4 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/project_task.py +13 -1
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client.egg-info/PKG-INFO +1 -1
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_product_catalog.py +26 -15
- odoo_somconnexio_python_client-0.1.53/odoo_somconnexio_python_client/__init__.py +0 -1
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/LICENSE +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/README.md +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/helpers.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/__init__.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/address.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/broadband_isp_info.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/contract.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/coop_agreement.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/crm_lead.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/crm_lead_line.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/discovery_channel.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/fiber_contracts.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/invoice.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/knowledge.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/mobile_isp_info.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/mobile_offer_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/multimedia_contract.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/odoo_paging.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/one_shot_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/partner.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/provider.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/sponsees.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client/resources/subscription_request.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client.egg-info/SOURCES.txt +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client.egg-info/dependency_links.txt +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client.egg-info/not-zip-safe +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client.egg-info/requires.txt +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/odoo_somconnexio_python_client.egg-info/top_level.txt +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/setup.cfg +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/setup.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/__init__.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_address.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_contract.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_coop_agreement.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_crm_lead.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_discovery_channel.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_fiber_contracts.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_invoice.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_knowledge.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_mobile_offer_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_multimedia_contract.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_one_shot_catalog.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_partner.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_project_task.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_providers.py +0 -0
- {odoo_somconnexio_python_client-0.1.53 → odoo_somconnexio_python_client-0.2.0}/tests/resources/test_subscription_request.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.0"
|
|
@@ -103,6 +103,7 @@ class Client(object):
|
|
|
103
103
|
headers = {
|
|
104
104
|
"Accept": "application/json",
|
|
105
105
|
"API-KEY": self.api_key,
|
|
106
|
+
"HTTP-API-KEY": self.api_key,
|
|
106
107
|
}
|
|
107
108
|
if extra_headers:
|
|
108
109
|
headers.update(extra_headers)
|
|
@@ -128,6 +129,8 @@ class Client(object):
|
|
|
128
129
|
raise exceptions.HTTPError(response.reason)
|
|
129
130
|
if response.status_code == 400 and "sortBy" in params:
|
|
130
131
|
raise exceptions.InvalidSortBy(params["sortBy"])
|
|
131
|
-
if response.status_code
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
if response.status_code in (401, 403):
|
|
133
|
+
raise exceptions.UnauthorizedError(response.status_code, response.text)
|
|
134
|
+
if response.status_code in (200, 201):
|
|
135
|
+
return response.json()
|
|
136
|
+
return None
|
|
@@ -51,3 +51,11 @@ class InvalidSortOrder(Exception):
|
|
|
51
51
|
|
|
52
52
|
def __init__(self):
|
|
53
53
|
super(InvalidSortOrder, self).__init__(self.message)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class UnauthorizedError(Exception):
|
|
57
|
+
message = "Unauthorized ({}): {}"
|
|
58
|
+
|
|
59
|
+
def __init__(self, status_code, body):
|
|
60
|
+
self.message = self.message.format(status_code, body)
|
|
61
|
+
super().__init__(self.message)
|
|
@@ -21,6 +21,7 @@ class Product:
|
|
|
21
21
|
available_for=[],
|
|
22
22
|
has_landline_phone=False,
|
|
23
23
|
offer=None,
|
|
24
|
+
is_featured=False,
|
|
24
25
|
**kwargs
|
|
25
26
|
):
|
|
26
27
|
self.code = code
|
|
@@ -32,6 +33,7 @@ class Product:
|
|
|
32
33
|
self.bandwidth = bandwidth
|
|
33
34
|
self.available_for = available_for
|
|
34
35
|
self.has_landline_phone = has_landline_phone
|
|
36
|
+
self.is_featured = is_featured
|
|
35
37
|
if offer is not None:
|
|
36
38
|
self.offer = Offer(**offer)
|
|
37
39
|
else:
|
|
@@ -50,6 +52,7 @@ class Pack:
|
|
|
50
52
|
fiber_bandwidth="",
|
|
51
53
|
has_land_line=False,
|
|
52
54
|
available_for=[],
|
|
55
|
+
is_featured=False,
|
|
53
56
|
**kwargs
|
|
54
57
|
):
|
|
55
58
|
self.code = code
|
|
@@ -60,6 +63,7 @@ class Pack:
|
|
|
60
63
|
self.mobiles_in_pack = mobiles_in_pack
|
|
61
64
|
self.fiber_bandwidth = fiber_bandwidth
|
|
62
65
|
self.has_landline_phone = has_land_line
|
|
66
|
+
self.is_featured = is_featured
|
|
63
67
|
self.products = [Product(**product) for product in products]
|
|
64
68
|
|
|
65
69
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from odoo_somconnexio_python_client.client import Client
|
|
2
2
|
|
|
3
|
-
from ..exceptions import ResourceNotFound
|
|
3
|
+
from ..exceptions import ResourceNotFound, HTTPError
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class ProjectTask:
|
|
@@ -84,6 +84,12 @@ class ProjectTask:
|
|
|
84
84
|
:return: ProjectTask object (created)
|
|
85
85
|
"""
|
|
86
86
|
response_data = Client().post(cls._url_path, kwargs)
|
|
87
|
+
if not response_data:
|
|
88
|
+
raise HTTPError(
|
|
89
|
+
"Unexpected empty response creating {} with data: {}".format(
|
|
90
|
+
cls.__name__, kwargs
|
|
91
|
+
)
|
|
92
|
+
)
|
|
87
93
|
|
|
88
94
|
return cls(**response_data)
|
|
89
95
|
|
|
@@ -101,5 +107,11 @@ class ProjectTask:
|
|
|
101
107
|
:return: ProjectTask object (updated)
|
|
102
108
|
"""
|
|
103
109
|
response_data = Client().put("{}/{}".format(cls._url_path, id), kwargs)
|
|
110
|
+
if not response_data:
|
|
111
|
+
raise HTTPError(
|
|
112
|
+
"Unexpected empty response creating {} with data: {}".format(
|
|
113
|
+
cls.__name__, kwargs
|
|
114
|
+
)
|
|
115
|
+
)
|
|
104
116
|
|
|
105
117
|
return cls(**response_data)
|
|
@@ -31,8 +31,8 @@ class TariffTests(unittest.TestCase):
|
|
|
31
31
|
if product.code == "SE_SC_REC_MOBILE_T_UNL_30720":
|
|
32
32
|
tariff_offer = product.offer
|
|
33
33
|
|
|
34
|
-
self.assertIn("
|
|
35
|
-
self.assertIn("
|
|
34
|
+
self.assertIn("Fibra 300Mb Sense Fix", tariff_names)
|
|
35
|
+
self.assertIn("SE_SC_REC_BA_F_300_SF", tariff_codes)
|
|
36
36
|
self.assertIn(["member", "coop_agreement", "sponsored"], tariff_available_for)
|
|
37
37
|
|
|
38
38
|
self.assertIsInstance(tariff_offer, Offer)
|
|
@@ -40,17 +40,28 @@ class TariffTests(unittest.TestCase):
|
|
|
40
40
|
self.assertIn("Il·limitades 30 GB (Pack)", tariff_offer.name)
|
|
41
41
|
self.assertEqual(1.0, tariff_offer.price)
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
filter(
|
|
43
|
+
fiber_wo_fix_product = list(
|
|
44
|
+
filter(
|
|
45
|
+
lambda p: p.code == "SE_SC_REC_BA_F_300_SF", pricelist_21IVA.products
|
|
46
|
+
)
|
|
45
47
|
)
|
|
46
|
-
self.assertEqual(len(
|
|
47
|
-
self.assertFalse(
|
|
48
|
+
self.assertEqual(len(fiber_wo_fix_product), 1)
|
|
49
|
+
self.assertFalse(fiber_wo_fix_product[0].has_landline_phone)
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
filter(lambda p: p.code == "
|
|
51
|
+
fiber300_with_fix_product = list(
|
|
52
|
+
filter(lambda p: p.code == "SE_SC_REC_BA_F_300", pricelist_21IVA.products)
|
|
51
53
|
)
|
|
52
|
-
self.assertEqual(len(
|
|
53
|
-
self.assertTrue(
|
|
54
|
+
self.assertEqual(len(fiber300_with_fix_product), 1)
|
|
55
|
+
self.assertTrue(fiber300_with_fix_product[0].has_landline_phone)
|
|
56
|
+
self.assertTrue(fiber300_with_fix_product[0].is_featured)
|
|
57
|
+
|
|
58
|
+
non_featured_product = list(
|
|
59
|
+
filter(
|
|
60
|
+
lambda p: p.code == "SE_SC_REC_MOBILE_T_0_0", pricelist_21IVA.products
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
self.assertEqual(len(non_featured_product), 1)
|
|
64
|
+
self.assertFalse(non_featured_product[0].is_featured)
|
|
54
65
|
|
|
55
66
|
self.assertTrue(pricelist_21IVA.packs)
|
|
56
67
|
|
|
@@ -72,12 +83,12 @@ class TariffTests(unittest.TestCase):
|
|
|
72
83
|
pack_tariff_names.append(product.name)
|
|
73
84
|
pack_tariff_codes.append(product.code)
|
|
74
85
|
|
|
75
|
-
self.assertIn("
|
|
76
|
-
self.assertIn("Fibra 1Gb + Fix +
|
|
86
|
+
self.assertIn("SE_SC_REC_PACK_FIBER_600_UNL_30720", pack_codes)
|
|
87
|
+
self.assertIn("Fibra 1Gb + Fix + 3 mòbils amb 30 GB", pack_names)
|
|
77
88
|
self.assertIn("Fibra 300Mb Sense Fix", pack_tariff_names)
|
|
78
|
-
self.assertIn("
|
|
89
|
+
self.assertIn("SE_SC_REC_MOBILE_PACK_UNL_30720", pack_tariff_codes)
|
|
79
90
|
self.assertIn(2, pack_mobiles_in_pack)
|
|
80
|
-
self.assertIn(
|
|
91
|
+
self.assertIn(300, pack_fiber_bandwidth)
|
|
81
92
|
|
|
82
93
|
add_on_names = []
|
|
83
94
|
add_on_codes = []
|
|
@@ -133,4 +144,4 @@ class TariffTests(unittest.TestCase):
|
|
|
133
144
|
pack_codes = [p.code for p in pricelists[0].packs]
|
|
134
145
|
|
|
135
146
|
self.assertIn("SE_SC_REC_MOBILE_T_UNL_30720", product_codes)
|
|
136
|
-
self.assertIn("
|
|
147
|
+
self.assertIn("SE_SC_REC_PACK_FIBER_300_2_MOBILES_30_EIE", pack_codes)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.53"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|