elastly 0.1.0__tar.gz → 0.1.1__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 (56) hide show
  1. {elastly-0.1.0 → elastly-0.1.1}/PKG-INFO +1 -1
  2. {elastly-0.1.0 → elastly-0.1.1}/elastly/__init__.py +1 -1
  3. {elastly-0.1.0 → elastly-0.1.1}/elastly/api_client.py +1 -1
  4. {elastly-0.1.0 → elastly-0.1.1}/elastly/configuration.py +1 -1
  5. {elastly-0.1.0 → elastly-0.1.1}/elastly.egg-info/PKG-INFO +1 -1
  6. {elastly-0.1.0 → elastly-0.1.1}/elastly.egg-info/SOURCES.txt +2 -1
  7. {elastly-0.1.0 → elastly-0.1.1}/pyproject.toml +1 -1
  8. {elastly-0.1.0 → elastly-0.1.1}/setup.py +1 -1
  9. elastly-0.1.1/tests/test_prices.py +74 -0
  10. {elastly-0.1.0 → elastly-0.1.1}/LICENSE +0 -0
  11. {elastly-0.1.0 → elastly-0.1.1}/README.md +0 -0
  12. {elastly-0.1.0 → elastly-0.1.1}/elastly/api/__init__.py +0 -0
  13. {elastly-0.1.0 → elastly-0.1.1}/elastly/api/ingest_api.py +0 -0
  14. {elastly-0.1.0 → elastly-0.1.1}/elastly/api/prices_api.py +0 -0
  15. {elastly-0.1.0 → elastly-0.1.1}/elastly/api/writebacks_api.py +0 -0
  16. {elastly-0.1.0 → elastly-0.1.1}/elastly/api_response.py +0 -0
  17. {elastly-0.1.0 → elastly-0.1.1}/elastly/exceptions.py +0 -0
  18. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/__init__.py +0 -0
  19. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/ack_writebacks_response.py +0 -0
  20. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/api_error.py +0 -0
  21. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/api_error_error.py +0 -0
  22. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/batch_created_response.py +0 -0
  23. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/batch_status_response.py +0 -0
  24. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/claim_writebacks_request.py +0 -0
  25. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/claim_writebacks_response.py +0 -0
  26. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/claim_writebacks_response_tasks_inner.py +0 -0
  27. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/commit_batch_response.py +0 -0
  28. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/prices_request.py +0 -0
  29. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/prices_request_lines_inner.py +0 -0
  30. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/prices_response.py +0 -0
  31. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/prices_response_lines_inner.py +0 -0
  32. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/prices_response_lines_inner_one_of.py +0 -0
  33. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/prices_response_lines_inner_one_of1.py +0 -0
  34. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/prices_response_lines_inner_one_of_explanation.py +0 -0
  35. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/prices_response_lines_inner_one_of_explanation_drivers_inner.py +0 -0
  36. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/prices_response_lines_inner_one_of_reason_inner.py +0 -0
  37. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request.py +0 -0
  38. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of.py +0 -0
  39. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of1.py +0 -0
  40. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of1_records_inner.py +0 -0
  41. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of2.py +0 -0
  42. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of2_records_inner.py +0 -0
  43. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of2_records_inner_lines_inner.py +0 -0
  44. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of3.py +0 -0
  45. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of3_records_inner.py +0 -0
  46. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of3_records_inner_lines_inner.py +0 -0
  47. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_request_one_of_records_inner.py +0 -0
  48. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/stage_records_response.py +0 -0
  49. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/writeback_ack_request.py +0 -0
  50. {elastly-0.1.0 → elastly-0.1.1}/elastly/models/writeback_ack_request_results_inner.py +0 -0
  51. {elastly-0.1.0 → elastly-0.1.1}/elastly/py.typed +0 -0
  52. {elastly-0.1.0 → elastly-0.1.1}/elastly/rest.py +0 -0
  53. {elastly-0.1.0 → elastly-0.1.1}/elastly.egg-info/dependency_links.txt +0 -0
  54. {elastly-0.1.0 → elastly-0.1.1}/elastly.egg-info/requires.txt +0 -0
  55. {elastly-0.1.0 → elastly-0.1.1}/elastly.egg-info/top_level.txt +0 -0
  56. {elastly-0.1.0 → elastly-0.1.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elastly
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Elastly API
5
5
  Home-page: https://elastly.io/docs/sdk
6
6
  Author: Elastly
@@ -15,7 +15,7 @@
15
15
  """ # noqa: E501
16
16
 
17
17
 
18
- __version__ = "0.1.0"
18
+ __version__ = "0.1.1"
19
19
 
20
20
  # Define package exports
21
21
  __all__ = [
@@ -92,7 +92,7 @@ class ApiClient:
92
92
  self.default_headers[header_name] = header_value
93
93
  self.cookie = cookie
94
94
  # Set default User-Agent.
95
- self.user_agent = 'OpenAPI-Generator/0.1.0/python'
95
+ self.user_agent = 'OpenAPI-Generator/0.1.1/python'
96
96
  self.client_side_validation = configuration.client_side_validation
97
97
 
98
98
  def __enter__(self):
@@ -534,7 +534,7 @@ class Configuration:
534
534
  "OS: {env}\n"\
535
535
  "Python Version: {pyversion}\n"\
536
536
  "Version of the API: 1.0.0\n"\
537
- "SDK Package Version: 0.1.0".\
537
+ "SDK Package Version: 0.1.1".\
538
538
  format(env=sys.platform, pyversion=sys.version)
539
539
 
540
540
  def get_host_settings(self) -> List[HostSetting]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: elastly
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Elastly API
5
5
  Home-page: https://elastly.io/docs/sdk
6
6
  Author: Elastly
@@ -51,4 +51,5 @@ elastly/models/stage_records_request_one_of3_records_inner_lines_inner.py
51
51
  elastly/models/stage_records_request_one_of_records_inner.py
52
52
  elastly/models/stage_records_response.py
53
53
  elastly/models/writeback_ack_request.py
54
- elastly/models/writeback_ack_request_results_inner.py
54
+ elastly/models/writeback_ack_request_results_inner.py
55
+ tests/test_prices.py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "elastly"
3
- version = "0.1.0"
3
+ version = "0.1.1"
4
4
  description = "Elastly API"
5
5
  authors = [
6
6
  {name = "Elastly",email = "support@elastly.io"},
@@ -20,7 +20,7 @@ from setuptools import setup, find_packages # noqa: H301
20
20
  # prerequisite: setuptools
21
21
  # http://pypi.python.org/pypi/setuptools
22
22
  NAME = "elastly"
23
- VERSION = "0.1.0"
23
+ VERSION = "0.1.1"
24
24
  PYTHON_REQUIRES = ">= 3.10"
25
25
  REQUIRES = [
26
26
  "urllib3 >= 2.1.0, < 3.0.0",
@@ -0,0 +1,74 @@
1
+ import json
2
+
3
+ from elastly import (
4
+ ApiClient,
5
+ Configuration,
6
+ IngestApi,
7
+ PricesApi,
8
+ PricesRequest,
9
+ PricesRequestLinesInner,
10
+ PricesResponse,
11
+ WritebacksApi,
12
+ )
13
+ from elastly.models.prices_response_lines_inner_one_of import PricesResponseLinesInnerOneOf
14
+ from elastly.models.prices_response_lines_inner_one_of1 import PricesResponseLinesInnerOneOf1
15
+
16
+ # Canonical GET /v1/prices 200 body: one priced line and one failed line.
17
+ CANONICAL_PRICES_200_BODY = """
18
+ {"lines":[
19
+ {"ok":true,"priceCents":1299,"currency":"USD","pricingDecisionId":"pd-A","reason":[{"param":"base","marginDeltaBps":120}],"reasonSummary":"Base margin","explanation":{"short":"held","drivers":[{"param":"base","label":"Base","points":1.2,"direction":"up"}],"stance":"standard","marginPct":18.5,"targetMarginPct":19,"confidence":"high"},"guardrailsApplied":[],"confidence":"high","confidenceScore":0.91},
20
+ {"ok":false,"code":"unknown_product","message":"Unknown product."}
21
+ ]}
22
+ """
23
+
24
+
25
+ def test_prices_response_resolves_priced_and_error_variants():
26
+ # REGRESSION GUARD: `ok` is a boolean `const` discriminator. An earlier
27
+ # contract bug stringified it ("true"/"false"), which made every /v1/prices
28
+ # line fail to deserialize into its oneOf variant. This asserts the two
29
+ # variants resolve from real JSON booleans so that class of bug cannot
30
+ # return silently.
31
+ response = PricesResponse.from_json(CANONICAL_PRICES_200_BODY)
32
+
33
+ assert len(response.lines) == 2
34
+
35
+ priced = response.lines[0].actual_instance
36
+ assert isinstance(priced, PricesResponseLinesInnerOneOf)
37
+ assert priced.ok is True
38
+ assert priced.price_cents == 1299
39
+ assert priced.currency == "USD"
40
+ assert priced.pricing_decision_id == "pd-A"
41
+
42
+ error = response.lines[1].actual_instance
43
+ assert isinstance(error, PricesResponseLinesInnerOneOf1)
44
+ assert error.ok is False
45
+ assert error.code == "unknown_product"
46
+ assert error.message == "Unknown product."
47
+
48
+
49
+ def test_prices_request_serializes_line_fields():
50
+ request = PricesRequest(lines=[PricesRequestLinesInner(product_sku="SKU-1", quantity=25)])
51
+
52
+ payload = json.loads(request.to_json())
53
+ line = payload["lines"][0]
54
+ assert line["productSku"] == "SKU-1"
55
+ assert line["quantity"] == 25
56
+
57
+ round_tripped = PricesRequest.from_json(request.to_json())
58
+ assert round_tripped.lines[0].product_sku == "SKU-1"
59
+ assert round_tripped.lines[0].quantity == 25
60
+
61
+
62
+ def test_api_classes_construct_with_configuration_access_token():
63
+ configuration = Configuration(access_token="elastly_live_testtoken")
64
+ client = ApiClient(configuration)
65
+
66
+ prices = PricesApi(client)
67
+ ingest = IngestApi(client)
68
+ writebacks = WritebacksApi(client)
69
+
70
+ for api in (prices, ingest, writebacks):
71
+ assert api.api_client is client
72
+ assert api.api_client.configuration.access_token == "elastly_live_testtoken"
73
+
74
+ assert configuration.auth_settings()["apiKey"]["value"] == "Bearer elastly_live_testtoken"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes