masstack-python-client 0.0.3__tar.gz → 0.0.5__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.
Files changed (49) hide show
  1. {masstack_python_client-0.0.3/src/masstack_python_client.egg-info → masstack_python_client-0.0.5}/PKG-INFO +13 -1
  2. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/README.md +12 -0
  3. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/__init__.py +1 -1
  4. masstack_python_client-0.0.5/src/masstack_python_client/resources/catalogue.py +110 -0
  5. masstack_python_client-0.0.5/src/masstack_python_client/resources/enums/__init__.py +0 -0
  6. masstack_python_client-0.0.5/src/masstack_python_client/resources/enums/bundled_product_category.py +12 -0
  7. masstack_python_client-0.0.5/src/masstack_python_client/resources/enums/commercial_segment_name.py +6 -0
  8. masstack_python_client-0.0.5/src/masstack_python_client/resources/enums/customer_segment_name.py +8 -0
  9. masstack_python_client-0.0.5/src/masstack_python_client/resources/enums/customer_type_name.py +6 -0
  10. masstack_python_client-0.0.5/src/masstack_python_client/resources/enums/sale_type_name.py +9 -0
  11. masstack_python_client-0.0.5/src/masstack_python_client/resources/enums/technology.py +7 -0
  12. masstack_python_client-0.0.5/src/masstack_python_client/resources/enums/technology_name.py +6 -0
  13. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/feasibility.py +107 -44
  14. masstack_python_client-0.0.5/src/masstack_python_client/resources/models/bundled.py +58 -0
  15. masstack_python_client-0.0.5/src/masstack_python_client/resources/models/fixed_phone.py +6 -0
  16. masstack_python_client-0.0.5/src/masstack_python_client/resources/models/portability.py +39 -0
  17. masstack_python_client-0.0.5/src/masstack_python_client/resources/provision.py +61 -0
  18. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5/src/masstack_python_client.egg-info}/PKG-INFO +13 -1
  19. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client.egg-info/SOURCES.txt +13 -0
  20. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/LICENSE +0 -0
  21. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/MANIFEST.in +0 -0
  22. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/pyproject.toml +0 -0
  23. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/setup.cfg +0 -0
  24. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/auth/__init__.py +0 -0
  25. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/auth/token.py +0 -0
  26. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/auth/token_manager.py +0 -0
  27. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/auth/token_store.py +0 -0
  28. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/client.py +0 -0
  29. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/data/data_utils.py +0 -0
  30. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/data/province_translation.csv +0 -0
  31. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/data/street_type_translation.csv +0 -0
  32. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/data/unit_translation.csv +0 -0
  33. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/exceptions.py +0 -0
  34. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/__init__.py +0 -0
  35. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/customers.py +0 -0
  36. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/enums/document_type_search.py +0 -0
  37. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/models/address.py +0 -0
  38. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/models/client_address.py +0 -0
  39. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/models/client_attribute.py +0 -0
  40. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/models/client_payment.py +0 -0
  41. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/models/products.py +0 -0
  42. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/models/signup.py +0 -0
  43. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/models/user.py +0 -0
  44. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client/resources/utils/serialize.py +0 -0
  45. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client.egg-info/dependency_links.txt +0 -0
  46. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client.egg-info/requires.txt +0 -0
  47. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/src/masstack_python_client.egg-info/top_level.txt +0 -0
  48. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/tests/test_client.py +0 -0
  49. {masstack_python_client-0.0.3 → masstack_python_client-0.0.5}/tests/test_exceptions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: masstack-python-client
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: This Python API client provides access to masmovil core API domains
5
5
  Author-email: Borja Gimeno <borja.gimeno@somconnexio.coop>
6
6
  License: GPL-3.0-only
@@ -37,6 +37,9 @@ This Python API client provides access to masmovil core API domains.
37
37
  - Units:
38
38
  - get: returns a unit by id with a list of coverages
39
39
  - get_coverage: returns coverage info for a unit id and territory_owner
40
+ - Portability - Checks if a landline portability or an access transfer is allowed
41
+ - PortabilityCheck:
42
+ - check: Returns whether the portability process can be carried out and whether it requires a new installation
40
43
 
41
44
  * Customers
42
45
  - Signups - access to signups new clients
@@ -45,6 +48,15 @@ This Python API client provides access to masmovil core API domains.
45
48
  - returns customer tree data associated to a given document identification, email or number of the client.
46
49
  - returns user data by userId
47
50
 
51
+ * Catalogue
52
+ - bundled_products - access to bundled products
53
+ - get sellable bundled products
54
+
55
+ * Provision inventory network
56
+ - fixed - Obtain fixed numbering for sale
57
+ - get number
58
+
59
+
48
60
  ## Installation
49
61
 
50
62
  ```commandline
@@ -20,6 +20,9 @@ This Python API client provides access to masmovil core API domains.
20
20
  - Units:
21
21
  - get: returns a unit by id with a list of coverages
22
22
  - get_coverage: returns coverage info for a unit id and territory_owner
23
+ - Portability - Checks if a landline portability or an access transfer is allowed
24
+ - PortabilityCheck:
25
+ - check: Returns whether the portability process can be carried out and whether it requires a new installation
23
26
 
24
27
  * Customers
25
28
  - Signups - access to signups new clients
@@ -28,6 +31,15 @@ This Python API client provides access to masmovil core API domains.
28
31
  - returns customer tree data associated to a given document identification, email or number of the client.
29
32
  - returns user data by userId
30
33
 
34
+ * Catalogue
35
+ - bundled_products - access to bundled products
36
+ - get sellable bundled products
37
+
38
+ * Provision inventory network
39
+ - fixed - Obtain fixed numbering for sale
40
+ - get number
41
+
42
+
31
43
  ## Installation
32
44
 
33
45
  ```commandline
@@ -1,4 +1,4 @@
1
- __version__ = "0.0.3"
1
+ __version__ = "0.0.5"
2
2
  __homepage__ = "https://somconnexio.coop/"
3
3
  __author__ = "Borja Gimeno <borja.gimeno@somconnexio.coop>"
4
4
  __license__ = "GPL-3.0-only"
@@ -0,0 +1,110 @@
1
+ from typing import Optional, List
2
+ from masstack_python_client.client import MasstackClient
3
+ from masstack_python_client.resources.enums.bundled_product_category import (
4
+ BundleCategory,
5
+ )
6
+ from masstack_python_client.resources.enums.commercial_segment_name import (
7
+ CommercialSegmentName,
8
+ )
9
+ from masstack_python_client.resources.enums.customer_segment_name import (
10
+ CustomerSegmentName,
11
+ )
12
+ from masstack_python_client.resources.enums.customer_type_name import CustomerTypeName
13
+ from masstack_python_client.resources.enums.sale_type_name import SaleTypeName
14
+ from masstack_python_client.resources.enums.technology_name import TechnologyName
15
+ from masstack_python_client.resources.models.bundled import BundledProduct
16
+
17
+
18
+ class CatalogueResource:
19
+ """Support sales and post-sales operations from catalogue perspective
20
+ https://developers.masstack.com/en/docs/apis_catalogue_doc_swagger/2/apioverview/
21
+ """
22
+
23
+ _api_domain = "catalogue"
24
+
25
+
26
+ class BundledProducts(CatalogueResource):
27
+ _api_path = "bundled_products"
28
+ _version = "v2"
29
+
30
+ @classmethod
31
+ def _get_endpoint(cls, subpath: str) -> str:
32
+ return f"{cls._api_path}/{subpath}"
33
+
34
+ @classmethod
35
+ def _request(
36
+ cls,
37
+ method: str,
38
+ subpath: str,
39
+ params: Optional[dict] = None,
40
+ data: Optional[dict] = None,
41
+ ) -> dict:
42
+ client = MasstackClient()
43
+ func = getattr(client, method)
44
+
45
+ return func(
46
+ api=cls._api_domain,
47
+ version=cls._version,
48
+ endpoint=cls._get_endpoint(subpath),
49
+ params=params,
50
+ data=data,
51
+ )
52
+
53
+
54
+ class Sellable(BundledProducts):
55
+
56
+ _api_subpath = "sellable"
57
+
58
+ @classmethod
59
+ def get(
60
+ cls,
61
+ commercial_profile_name: Optional[str] = None,
62
+ technology_name: Optional[TechnologyName] = None,
63
+ territory_owner_id: Optional[str] = None,
64
+ category: Optional[BundleCategory] = None,
65
+ customer_segment_name: Optional[CustomerSegmentName] = None,
66
+ commercial_segment_name: Optional[CommercialSegmentName] = None,
67
+ customer_type_name: Optional[CustomerTypeName] = None,
68
+ sale_type_name: Optional[SaleTypeName] = None,
69
+ ) -> List[BundledProduct]:
70
+ """Returns an array of sellable bundled products based on input criteria,
71
+ including the mandatory bundled commercial products for each bundled product.
72
+ Provides details for each bundled commercial product about the marketing name.
73
+
74
+ Args:
75
+ commercial_profile_name (str): commercial profile name
76
+ technology_name (TechnologyName): technology name
77
+ territory_owner_id (str): territory owner identifier
78
+ category (BundleCategory): bundled product category
79
+ customer_segment_name (CustomerSegmentName): customer segment name
80
+ commercial_segment_name(CommercialSegmentName): SmallMediumEnterprise or Consumer
81
+ customer_type_name(CustomerTypeName): customer type name
82
+ sale_type_name(SaleTypeName): sale type name
83
+
84
+ Returns:
85
+ BundledProduct
86
+
87
+ """
88
+ params = {
89
+ "commercial_profile_name": commercial_profile_name,
90
+ "technology_name": technology_name,
91
+ "territory_owner_id": territory_owner_id,
92
+ "category": category,
93
+ "customer_segment_name": customer_segment_name,
94
+ "commercial_segment_name": commercial_segment_name,
95
+ "customer_type_name": customer_type_name,
96
+ "sale_type_name": sale_type_name,
97
+ }
98
+ sellable_bundled_products = cls._request(
99
+ "get",
100
+ cls._api_subpath,
101
+ {
102
+ k: (v.value if hasattr(v, "value") else v)
103
+ for k, v in params.items()
104
+ if v is not None
105
+ },
106
+ )
107
+ return [
108
+ BundledProduct.from_dict(**sellable_bundled_product)
109
+ for sellable_bundled_product in sellable_bundled_products
110
+ ]
@@ -0,0 +1,12 @@
1
+ from enum import Enum
2
+
3
+
4
+ class BundleCategory(Enum):
5
+ MOBILE = "Mobile"
6
+ TV = "TV"
7
+ FIXED_BROADBAND = "Fixed+Broadband"
8
+ FIXED_MOBILE = "Fixed+Mobile"
9
+ FIXED_BROADBAND_MOBILE = "Fixed+Broadband+Mobile"
10
+ FIXED_BROADBAND_TV = "Fixed+Broadband+TV"
11
+ FIXED_BROADBAND_MOBILE_NTX = "Fixed+Broadband+Mobile+Netflix"
12
+ FIXED_BROADBAND_MOBILE_TV = "Fixed+Broadband+Mobile+TV"
@@ -0,0 +1,6 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CommercialSegmentName(Enum):
5
+ SME = "SME"
6
+ CONSUMER = "Consumer"
@@ -0,0 +1,8 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CustomerSegmentName(Enum):
5
+ RESIDENTIAL = "RESIDENCIAL"
6
+ COMPANY = "EMPRESA"
7
+ AUTONOMOUS = "AUTONOMO"
8
+ HORECA = "HORECA"
@@ -0,0 +1,6 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CustomerTypeName(Enum):
5
+ NEW = "Nuevo"
6
+ EXISTING = "Existente"
@@ -0,0 +1,9 @@
1
+ from enum import Enum
2
+
3
+
4
+ class SaleTypeName(Enum):
5
+ SALE = "Venta"
6
+ MIGRATION = "Migración"
7
+ ADD_LINE = "Añadir Línea"
8
+ CROSS_SELL = "Cross Sell"
9
+ WALLET = "Cartera"
@@ -0,0 +1,7 @@
1
+ from enum import Enum
2
+
3
+
4
+ class Technology(Enum):
5
+ ADSL = "ADSL"
6
+ FTTH = "FTTH"
7
+ MIFIJO = "MIFIJO"
@@ -0,0 +1,6 @@
1
+ from enum import Enum
2
+
3
+
4
+ class TechnologyName(Enum):
5
+ ADSL = "ADSL"
6
+ FIBRA = "FIBRA"
@@ -1,6 +1,7 @@
1
1
  import os
2
2
  from typing import Optional, List
3
3
  from masstack_python_client.client import MasstackClient
4
+ from masstack_python_client.resources.enums.technology import Technology
4
5
  from masstack_python_client.resources.models.address import (
5
6
  BuildingData,
6
7
  ClarifierData,
@@ -8,6 +9,18 @@ from masstack_python_client.resources.models.address import (
8
9
  StreetData,
9
10
  UnitData,
10
11
  )
12
+ from masstack_python_client.resources.models.portability import PortabilityData
13
+
14
+
15
+ """
16
+ FeasibilityResource
17
+ ├── Coverage
18
+ │ ├── Streets
19
+ │ ├── Buildings
20
+ │ └── Units
21
+ └── Portability
22
+ └── PortabilityCheck
23
+ """
11
24
 
12
25
 
13
26
  class FeasibilityResource:
@@ -17,6 +30,79 @@ class FeasibilityResource:
17
30
 
18
31
  _api_domain = "feasibility"
19
32
 
33
+ @classmethod
34
+ def _get_endpoint(cls, suffix: str) -> str:
35
+ return f"{cls._api_path}/{cls._api_subpath}{suffix}"
36
+
37
+ @classmethod
38
+ def _request(
39
+ cls,
40
+ *,
41
+ method: str,
42
+ suffix: Optional[str] = "",
43
+ header: Optional[dict] = None,
44
+ data: Optional[dict] = None,
45
+ params: Optional[dict] = None,
46
+ ) -> dict | list:
47
+ client = MasstackClient()
48
+ func = getattr(client, method)
49
+
50
+ return func(
51
+ api=cls._api_domain,
52
+ version=cls._version,
53
+ endpoint=cls._get_endpoint(suffix),
54
+ params=params,
55
+ data=data,
56
+ header=header,
57
+ )
58
+
59
+
60
+ class Portability(FeasibilityResource):
61
+
62
+ _api_path = "portability"
63
+ _version = "v2"
64
+
65
+
66
+ class PortabilityCheck(Portability):
67
+
68
+ _api_subpath = "portabilityCheck"
69
+
70
+ @classmethod
71
+ def check(
72
+ cls,
73
+ number: str,
74
+ address_id: str,
75
+ territory_owner: Optional[str] = None,
76
+ technical_id: Optional[str] = None,
77
+ technology: Technology = Technology.FTTH,
78
+ ) -> PortabilityData:
79
+ """Returns whether the portability process can be carried out
80
+ and whether it requires a new installation
81
+
82
+ Args:
83
+ number (str): Fixed number to be ported
84
+ address_id (str): Unique address ID
85
+ territory_owner (str): Territory owner. Not mandatory if technology is MIFIJO
86
+ technical_id (str): Technical id. Not mandatory if technology is MIFIJO. g17 or g37
87
+ technology (Technology): Technology to be provided
88
+
89
+ Returns:
90
+ PortabilityData
91
+
92
+ """
93
+
94
+ portability = cls._request(
95
+ method="post",
96
+ data={
97
+ "number": number,
98
+ "territoryOwner": territory_owner,
99
+ "technicalId": technical_id,
100
+ "addressId": address_id,
101
+ "technology": technology.value,
102
+ },
103
+ )
104
+ return PortabilityData.from_dict(**portability)
105
+
20
106
 
21
107
  class Coverage(FeasibilityResource):
22
108
 
@@ -31,10 +117,6 @@ class Coverage(FeasibilityResource):
31
117
  def _sf_channel() -> str:
32
118
  return os.environ.get("MASSTACK_COVERAGE_CHANNEL", "")
33
119
 
34
- @classmethod
35
- def _get_endpoint(cls, subpath: str) -> str:
36
- return f"{cls._api_path}/{subpath}"
37
-
38
120
  @classmethod
39
121
  def _get_header(cls, uuid: str) -> dict:
40
122
  return {
@@ -44,25 +126,8 @@ class Coverage(FeasibilityResource):
44
126
  }
45
127
 
46
128
  @classmethod
47
- def _request(
48
- cls,
49
- method: str,
50
- subpath: str,
51
- uuid: str,
52
- data: Optional[dict] = None,
53
- params: Optional[dict] = None,
54
- ) -> dict:
55
- client = MasstackClient()
56
- func = getattr(client, method)
57
-
58
- return func(
59
- api=cls._api_domain,
60
- version=cls._version,
61
- endpoint=cls._get_endpoint(subpath),
62
- params=params,
63
- data=data,
64
- header=cls._get_header(uuid),
65
- )
129
+ def _request(cls, *, uuid: str, **kwargs) -> dict | list:
130
+ return super()._request(header=cls._get_header(uuid), **kwargs)
66
131
 
67
132
 
68
133
  class Streets(Coverage):
@@ -83,9 +148,8 @@ class Streets(Coverage):
83
148
 
84
149
  """
85
150
  streets = cls._request(
86
- "get",
87
- cls._api_subpath,
88
- uuid,
151
+ method="get",
152
+ uuid=uuid,
89
153
  params={"search": text},
90
154
  )
91
155
  return [StreetData.from_dict(uuid, lang, **street) for street in streets]
@@ -104,9 +168,9 @@ class Streets(Coverage):
104
168
  ClarifierData
105
169
  """
106
170
  clarifiers = cls._request(
107
- "get",
108
- f"{cls._api_subpath}/clarifiers/{street_id}",
109
- uuid,
171
+ method="get",
172
+ suffix=f"/clarifiers/{street_id}",
173
+ uuid=uuid,
110
174
  )
111
175
 
112
176
  return [ClarifierData(uuid, **clarifier) for clarifier in clarifiers]
@@ -129,9 +193,8 @@ class Buildings(Coverage):
129
193
  BuildingData
130
194
  """
131
195
  buildings = cls._request(
132
- "get",
133
- cls._api_subpath,
134
- uuid,
196
+ method="get",
197
+ uuid=uuid,
135
198
  params={"search": text},
136
199
  )
137
200
  return [
@@ -154,9 +217,9 @@ class Buildings(Coverage):
154
217
  BuildingData
155
218
  """
156
219
  building = cls._request(
157
- "get",
158
- f"{cls._api_subpath}/{id}",
159
- uuid,
220
+ method="get",
221
+ suffix=f"/{id}",
222
+ uuid=uuid,
160
223
  params={"unit_to_data": unit_to_data},
161
224
  )
162
225
  return BuildingData.from_dict(
@@ -193,9 +256,9 @@ class Buildings(Coverage):
193
256
  """
194
257
 
195
258
  buildings = cls._request(
196
- "post",
197
- f"{cls._api_subpath}/search",
198
- uuid,
259
+ method="post",
260
+ suffix="/search",
261
+ uuid=uuid,
199
262
  data={
200
263
  "way_name": way_name,
201
264
  "number": number,
@@ -229,9 +292,9 @@ class Units(Coverage):
229
292
  UnitData
230
293
  """
231
294
  unit = cls._request(
232
- "get",
233
- f"{cls._api_subpath}/{unit_id}",
234
- uuid,
295
+ method="get",
296
+ suffix=f"/{unit_id}",
297
+ uuid=uuid,
235
298
  params={"parent_coverage": parent_coverage},
236
299
  )
237
300
  return UnitData.from_dict(
@@ -257,9 +320,9 @@ class Units(Coverage):
257
320
  CoverageData
258
321
  """
259
322
  unit = cls._request(
260
- "get",
261
- f"{cls._api_subpath}/extra",
262
- uuid,
323
+ method="get",
324
+ suffix="/extra",
325
+ uuid=uuid,
263
326
  params={"id": unit_id, "territory_owner": territory_owner},
264
327
  )
265
328
  return CoverageData.from_dict(
@@ -0,0 +1,58 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass(frozen=True)
5
+ class SubsType:
6
+ id: str
7
+ name: str
8
+ description: str
9
+
10
+
11
+ @dataclass(frozen=True)
12
+ class ComercialProduct:
13
+ id: str
14
+ name: str
15
+
16
+ @classmethod
17
+ def from_dict(cls, commercial_product, **kwargs) -> "ComercialProduct":
18
+ return cls(commercial_product["id"], commercial_product["name"])
19
+
20
+
21
+ @dataclass(frozen=True)
22
+ class BundledProductSubtype:
23
+ id: str
24
+ bundled_commercial_products: list[ComercialProduct]
25
+ subs_type: SubsType
26
+
27
+ @classmethod
28
+ def from_dict(
29
+ cls, id, bundled_commercial_products, subs_type, **kwargs
30
+ ) -> "BundledProductSubtype":
31
+ return cls(
32
+ id,
33
+ bundled_commercial_products=[
34
+ ComercialProduct.from_dict(**bundled_commercial_product)
35
+ for bundled_commercial_product in bundled_commercial_products
36
+ ],
37
+ subs_type=SubsType(**subs_type),
38
+ )
39
+
40
+
41
+ @dataclass(frozen=True)
42
+ class BundledProduct:
43
+ id: str
44
+ name: str
45
+ bundled_product_subs_types: list[BundledProductSubtype]
46
+
47
+ @classmethod
48
+ def from_dict(
49
+ cls, id, name, bundled_product_subs_types, **kwargs
50
+ ) -> "BundledProduct":
51
+ return cls(
52
+ id,
53
+ name,
54
+ bundled_product_subs_types=[
55
+ BundledProductSubtype.from_dict(**bundled_product_subs_type)
56
+ for bundled_product_subs_type in bundled_product_subs_types
57
+ ],
58
+ )
@@ -0,0 +1,6 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass(frozen=True)
5
+ class FixedPhoneData:
6
+ number: str
@@ -0,0 +1,39 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass(frozen=True)
5
+ class InstallationInfoData:
6
+ internalAccess: bool
7
+ iua: str
8
+ brand: str
9
+ number: str
10
+ documentNumber: str
11
+ gescal: str
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class OperatorData:
16
+ code: str
17
+ name: str
18
+
19
+
20
+ @dataclass(frozen=True)
21
+ class PortabilityData:
22
+ internalPortability: bool
23
+ isPortable: bool
24
+ installationRequired: bool
25
+ operator: OperatorData
26
+ installationInfo: InstallationInfoData
27
+
28
+ @classmethod
29
+ def from_dict(
30
+ cls,
31
+ operator,
32
+ installationInformation,
33
+ **kwargs,
34
+ ):
35
+ return cls(
36
+ operator=OperatorData(**operator),
37
+ installationInfo=InstallationInfoData(**installationInformation),
38
+ **kwargs,
39
+ )
@@ -0,0 +1,61 @@
1
+ from typing import Optional
2
+ from masstack_python_client.client import MasstackClient
3
+ from masstack_python_client.resources.models.fixed_phone import FixedPhoneData
4
+
5
+
6
+ "https://provision-inventory-network.sta.masstack.com/v1/orgs/marblanca/fixed/number"
7
+
8
+
9
+ class ProvisionNetworkResource:
10
+ """not documented"""
11
+
12
+ _api_domain = "provision-inventory-network"
13
+
14
+
15
+ class FixedPhone(ProvisionNetworkResource):
16
+ _api_path = "fixed"
17
+ _version = "v1"
18
+
19
+ @classmethod
20
+ def _get_endpoint(cls, subpath: str) -> str:
21
+ return f"{cls._api_path}/{subpath}"
22
+
23
+ @classmethod
24
+ def _request(
25
+ cls,
26
+ method: str,
27
+ subpath: str,
28
+ params: Optional[dict] = None,
29
+ data: Optional[dict] = None,
30
+ ) -> dict:
31
+ client = MasstackClient()
32
+ func = getattr(client, method)
33
+
34
+ return func(
35
+ api=cls._api_domain,
36
+ version=cls._version,
37
+ endpoint=cls._get_endpoint(subpath),
38
+ params=params,
39
+ data=data,
40
+ )
41
+
42
+ @classmethod
43
+ def get_number(cls, postal_code: str, state: str = "new"):
44
+ """Obtain fixed numbering for sale.
45
+
46
+ Args:
47
+ postal_code (str): postal code
48
+ state (str): state
49
+ Returns:
50
+ FixedPhoneData
51
+
52
+ """
53
+ response = cls._request(
54
+ "get",
55
+ "number",
56
+ {
57
+ "postal_code": postal_code,
58
+ "state": state,
59
+ },
60
+ )
61
+ return FixedPhoneData(response["number"])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: masstack-python-client
3
- Version: 0.0.3
3
+ Version: 0.0.5
4
4
  Summary: This Python API client provides access to masmovil core API domains
5
5
  Author-email: Borja Gimeno <borja.gimeno@somconnexio.coop>
6
6
  License: GPL-3.0-only
@@ -37,6 +37,9 @@ This Python API client provides access to masmovil core API domains.
37
37
  - Units:
38
38
  - get: returns a unit by id with a list of coverages
39
39
  - get_coverage: returns coverage info for a unit id and territory_owner
40
+ - Portability - Checks if a landline portability or an access transfer is allowed
41
+ - PortabilityCheck:
42
+ - check: Returns whether the portability process can be carried out and whether it requires a new installation
40
43
 
41
44
  * Customers
42
45
  - Signups - access to signups new clients
@@ -45,6 +48,15 @@ This Python API client provides access to masmovil core API domains.
45
48
  - returns customer tree data associated to a given document identification, email or number of the client.
46
49
  - returns user data by userId
47
50
 
51
+ * Catalogue
52
+ - bundled_products - access to bundled products
53
+ - get sellable bundled products
54
+
55
+ * Provision inventory network
56
+ - fixed - Obtain fixed numbering for sale
57
+ - get number
58
+
59
+
48
60
  ## Installation
49
61
 
50
62
  ```commandline
@@ -19,13 +19,26 @@ src/masstack_python_client/data/province_translation.csv
19
19
  src/masstack_python_client/data/street_type_translation.csv
20
20
  src/masstack_python_client/data/unit_translation.csv
21
21
  src/masstack_python_client/resources/__init__.py
22
+ src/masstack_python_client/resources/catalogue.py
22
23
  src/masstack_python_client/resources/customers.py
23
24
  src/masstack_python_client/resources/feasibility.py
25
+ src/masstack_python_client/resources/provision.py
26
+ src/masstack_python_client/resources/enums/__init__.py
27
+ src/masstack_python_client/resources/enums/bundled_product_category.py
28
+ src/masstack_python_client/resources/enums/commercial_segment_name.py
29
+ src/masstack_python_client/resources/enums/customer_segment_name.py
30
+ src/masstack_python_client/resources/enums/customer_type_name.py
24
31
  src/masstack_python_client/resources/enums/document_type_search.py
32
+ src/masstack_python_client/resources/enums/sale_type_name.py
33
+ src/masstack_python_client/resources/enums/technology.py
34
+ src/masstack_python_client/resources/enums/technology_name.py
25
35
  src/masstack_python_client/resources/models/address.py
36
+ src/masstack_python_client/resources/models/bundled.py
26
37
  src/masstack_python_client/resources/models/client_address.py
27
38
  src/masstack_python_client/resources/models/client_attribute.py
28
39
  src/masstack_python_client/resources/models/client_payment.py
40
+ src/masstack_python_client/resources/models/fixed_phone.py
41
+ src/masstack_python_client/resources/models/portability.py
29
42
  src/masstack_python_client/resources/models/products.py
30
43
  src/masstack_python_client/resources/models/signup.py
31
44
  src/masstack_python_client/resources/models/user.py