Skip to content

Commit dbfbbb3

Browse files
authored
Merge pull request #37 from FreeClimbAPI/fix-percl-generation
Fix PerCL generation
2 parents 5a15d2c + 16edede commit dbfbbb3

File tree

10 files changed

+82
-41
lines changed

10 files changed

+82
-41
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
99

1010
None
1111

12+
<a name="4.2.1"></a>
13+
## [4.2.1] - 2023-04-27
14+
15+
### Changed
16+
17+
- Fix the PerCL generation (using attribute map to ensure keys are cased correctly)
18+
1219
<a name="4.2.0"></a>
1320

1421
## [4.2.0] - 2023-04-03

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FreeClimb is a cloud-based application programming interface (API) that puts the
44
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
55

66
- API version: 1.0.0
7-
- Package version: 4.2.0
7+
- Package version: 4.2.1
88
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
99
For more information, please visit [https://www.freeclimb.com/support/](https://www.freeclimb.com/support/)
1010

@@ -313,6 +313,7 @@ Class | Method | HTTP request | Description
313313

314314
- **Type**: HTTP basic authentication
315315

316+
316317
<a name="documentation-for-verify-request-signature"></a>
317318

318319
## Documentation for verifying request signature
@@ -338,6 +339,7 @@ Class | Method | HTTP request | Description
338339
request_header = "t=1679944186,v1=c3957749baf61df4b1506802579cc69a74c77a1ae21447b930e5a704f9ec4120,v1=1ba18712726898fbbe48cd862dd096a709f7ad761a5bab14bda9ac24d963a6a8"
339340
RequestVerifier.verify_request_signature(request_body, request_header, signing_secret, tolerance)
340341
```
342+
341343
## Author
342344

343345
@@ -361,4 +363,3 @@ import freeclimb
361363
from freeclimb.apis import *
362364
from freeclimb.models import *
363365
```
364-

freeclimb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212

1313

14-
__version__ = "4.2.0"
14+
__version__ = "4.2.1"
1515

1616
# import ApiClient
1717
from freeclimb.api_client import ApiClient

freeclimb/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7777
self.default_headers[header_name] = header_value
7878
self.cookie = cookie
7979
# Set default User-Agent.
80-
self.user_agent = 'OpenAPI-Generator/4.2.0/python'
80+
self.user_agent = 'OpenAPI-Generator/4.2.1/python'
8181

8282
def __enter__(self):
8383
return self

freeclimb/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ def to_debug_report(self):
405405
"OS: {env}\n"\
406406
"Python Version: {pyversion}\n"\
407407
"Version of the API: 1.0.0\n"\
408-
"SDK Package Version: 4.2.0".\
408+
"SDK Package Version: 4.2.1".\
409409
format(env=sys.platform, pyversion=sys.version)
410410

411411
def get_host_settings(self):

freeclimb/model/percl_script.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,17 @@ def to_percl_dict(self, percl_command_inst):
271271
attributes = [attribute for attribute in percl_command_inst.openapi_types if attribute != 'command']
272272
attribute_map = {}
273273
for attribute in attributes:
274+
key = percl_command_inst.attribute_map.get(attribute)
274275
val = percl_command_inst.get(attribute)
275276
if val is None:
276277
continue
277278
if hasattr(val, 'command'):
278-
attribute_map[attribute] = self.to_percl_dict(val)
279+
attribute_map[key] = self.to_percl_dict(val)
279280
continue
280281
if isinstance(val, list):
281-
attribute_map[attribute] = [self.to_percl_dict(item) if hasattr(item, 'command') else item for item in val]
282+
attribute_map[key] = [self.to_percl_dict(item) if hasattr(item, 'command') else item for item in val]
282283
continue
283-
attribute_map[attribute] = val
284+
attribute_map[key] = val
284285
percl_dict = {
285286
command: attribute_map
286287
}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from setuptools import setup, find_packages # noqa: H301
1313

1414
NAME = "FreeClimb"
15-
VERSION = "4.2.0"
15+
VERSION = "4.2.1"
1616
# To install the library, run the following
1717
#
1818
# python setup.py install

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
pytest~=4.6.7 # needed for python 2.7+3.4
1+
pytest~=7.3.1 # needed for python 2.7+3.4
22
pytest-cov>=2.8.1
33
pytest-randomly==1.2.3 # needed for python 2.7+3.4

test/manual/test_percl_generation.py

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
"""
3+
FreeClimb API
4+
5+
This is a manually implemented test to validate the
6+
contents of https://github.com/FreeClimbAPI/Python-Getting-Started-Tutorial/blob/master/python-getting-started.py
7+
are functioning as expected
8+
"""
9+
10+
import unittest
11+
12+
import freeclimb
13+
import json
14+
15+
16+
class TestQuickStart(unittest.TestCase):
17+
def setUp(self):
18+
pass
19+
20+
def tearDown(self):
21+
pass
22+
23+
def testPerclGeneration(self):
24+
message = "Hello, FreeClimb!"
25+
say = freeclimb.Say(text=message)
26+
get_speech = freeclimb.GetSpeech(
27+
action_url="http://example.com/actionurl/getspeech", prompts=[say], grammar_file="grammar.xml")
28+
record_utterance = freeclimb.RecordUtterance(
29+
action_url="http://example.actionurl/recordutterance", silence_timeout_ms=1000)
30+
script = freeclimb.PerclScript(commands=[say, get_speech, record_utterance])
31+
data = script.to_json()
32+
expected_json = json.dumps(
33+
[
34+
{
35+
"Say": {
36+
"text": "Hello, FreeClimb!"
37+
}
38+
},
39+
{
40+
"GetSpeech": {
41+
"actionUrl": "http://example.com/actionurl/getspeech",
42+
"grammarFile": "grammar.xml",
43+
"prompts": [
44+
{
45+
"Say": {
46+
"text": "Hello, FreeClimb!"
47+
}
48+
}
49+
]
50+
}
51+
},
52+
{
53+
"RecordUtterance": {
54+
"actionUrl": "http://example.actionurl/recordutterance",
55+
"silenceTimeoutMs": 1000
56+
}
57+
}
58+
])
59+
self.assertEqual(data, expected_json)
60+
61+
62+
if __name__ == '__main__':
63+
unittest.main()

test/test_quickstart.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)