revox 0.1.0 → 0.2.0

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 (89) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +71 -0
  3. data/README.md +39 -14
  4. data/lib/revox/client.rb +15 -1
  5. data/lib/revox/internal/transport/base_client.rb +5 -0
  6. data/lib/revox/internal/util.rb +22 -7
  7. data/lib/revox/models/assistant_create_params.rb +1038 -13
  8. data/lib/revox/models/assistant_create_response.rb +1071 -11
  9. data/lib/revox/models/assistant_list_response.rb +1070 -11
  10. data/lib/revox/models/assistant_retrieve_response.rb +1066 -11
  11. data/lib/revox/models/assistant_update_params.rb +1038 -13
  12. data/lib/revox/models/assistant_update_response.rb +1097 -12
  13. data/lib/revox/models/call_create_params.rb +1065 -13
  14. data/lib/revox/models/call_create_response.rb +1813 -101
  15. data/lib/revox/models/call_retrieve_response.rb +1815 -101
  16. data/lib/revox/models/campaign_create_params.rb +67 -2
  17. data/lib/revox/models/campaign_create_response.rb +1314 -59
  18. data/lib/revox/models/campaign_get_rows_params.rb +1 -46
  19. data/lib/revox/models/campaign_get_rows_response.rb +1837 -129
  20. data/lib/revox/models/campaign_list_response.rb +1312 -59
  21. data/lib/revox/models/campaign_retrieve_response.rb +1312 -56
  22. data/lib/revox/models/users/me_retrieve_response.rb +13 -1
  23. data/lib/revox/models/users/me_update_response.rb +13 -1
  24. data/lib/revox/models/voice_list_response.rb +55 -1
  25. data/lib/revox/models/voice_preview_params.rb +49 -1
  26. data/lib/revox/models.rb +0 -2
  27. data/lib/revox/resources/assistants.rb +116 -8
  28. data/lib/revox/resources/call.rb +0 -29
  29. data/lib/revox/resources/campaigns.rb +12 -17
  30. data/lib/revox/resources/voices.rb +16 -10
  31. data/lib/revox/version.rb +1 -1
  32. data/lib/revox.rb +0 -2
  33. data/rbi/revox/internal/util.rbi +8 -0
  34. data/rbi/revox/models/assistant_create_params.rbi +2138 -103
  35. data/rbi/revox/models/assistant_create_response.rbi +2454 -199
  36. data/rbi/revox/models/assistant_list_response.rbi +2448 -195
  37. data/rbi/revox/models/assistant_retrieve_response.rbi +2401 -210
  38. data/rbi/revox/models/assistant_update_params.rbi +2138 -103
  39. data/rbi/revox/models/assistant_update_response.rbi +2504 -198
  40. data/rbi/revox/models/call_create_params.rbi +2382 -225
  41. data/rbi/revox/models/call_create_response.rbi +4104 -384
  42. data/rbi/revox/models/call_retrieve_response.rbi +4104 -382
  43. data/rbi/revox/models/campaign_create_params.rbi +136 -0
  44. data/rbi/revox/models/campaign_create_response.rbi +2911 -231
  45. data/rbi/revox/models/campaign_get_rows_params.rbi +2 -82
  46. data/rbi/revox/models/campaign_get_rows_response.rbi +4135 -410
  47. data/rbi/revox/models/campaign_list_response.rbi +2904 -230
  48. data/rbi/revox/models/campaign_retrieve_response.rbi +2911 -231
  49. data/rbi/revox/models/users/me_retrieve_response.rbi +13 -3
  50. data/rbi/revox/models/users/me_update_response.rbi +13 -3
  51. data/rbi/revox/models/voice_list_response.rbi +105 -3
  52. data/rbi/revox/models/voice_preview_params.rbi +69 -0
  53. data/rbi/revox/models.rbi +0 -2
  54. data/rbi/revox/resources/assistants.rbi +284 -8
  55. data/rbi/revox/resources/call.rbi +0 -21
  56. data/rbi/revox/resources/campaigns.rbi +12 -19
  57. data/rbi/revox/resources/voices.rbi +17 -9
  58. data/sig/revox/internal/util.rbs +4 -0
  59. data/sig/revox/models/assistant_create_params.rbs +844 -11
  60. data/sig/revox/models/assistant_create_response.rbs +860 -3
  61. data/sig/revox/models/assistant_list_response.rbs +860 -3
  62. data/sig/revox/models/assistant_retrieve_response.rbs +859 -3
  63. data/sig/revox/models/assistant_update_params.rbs +844 -11
  64. data/sig/revox/models/assistant_update_response.rbs +886 -6
  65. data/sig/revox/models/call_create_params.rbs +847 -13
  66. data/sig/revox/models/call_create_response.rbs +1514 -34
  67. data/sig/revox/models/call_retrieve_response.rbs +1514 -34
  68. data/sig/revox/models/campaign_create_params.rbs +54 -0
  69. data/sig/revox/models/campaign_create_response.rbs +1034 -6
  70. data/sig/revox/models/campaign_get_rows_params.rbs +2 -64
  71. data/sig/revox/models/campaign_get_rows_response.rbs +1522 -54
  72. data/sig/revox/models/campaign_list_response.rbs +1034 -6
  73. data/sig/revox/models/campaign_retrieve_response.rbs +1034 -6
  74. data/sig/revox/models/users/me_retrieve_response.rbs +8 -3
  75. data/sig/revox/models/users/me_update_response.rbs +8 -3
  76. data/sig/revox/models/voice_list_response.rbs +45 -3
  77. data/sig/revox/models/voice_preview_params.rbs +42 -1
  78. data/sig/revox/models.rbs +0 -2
  79. data/sig/revox/resources/assistants.rbs +56 -2
  80. data/sig/revox/resources/call.rbs +0 -7
  81. data/sig/revox/resources/campaigns.rbs +2 -5
  82. data/sig/revox/resources/voices.rbs +4 -0
  83. metadata +2 -8
  84. data/lib/revox/models/call_list_params.rb +0 -52
  85. data/lib/revox/models/call_list_response.rb +0 -259
  86. data/rbi/revox/models/call_list_params.rbi +0 -94
  87. data/rbi/revox/models/call_list_response.rbi +0 -563
  88. data/sig/revox/models/call_list_params.rbs +0 -63
  89. data/sig/revox/models/call_list_response.rbs +0 -226
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 665d2197b2774b34796d5e9acd358118f3148e7711386209395d3cbf7bc6b36c
4
- data.tar.gz: 9053cc3a625b2164be340a4cf0b305ea4fa3cfc701ff7234780f2d4bbd58b2e0
3
+ metadata.gz: 8049f2cfd29f2b0b6a033f073e9c827b037fef2cc88d401a346bde3a52173c08
4
+ data.tar.gz: d4af5e75bc76ba13ba56f86ba56e5f2daf96d3c77a6113988b8b02f4f322217e
5
5
  SHA512:
6
- metadata.gz: f89828b3e79ed23b2dca0a18a53f73a23212202dba7c96e5c30e0b171a62badc763aa6a293798c3405c0c39aec25133bd1d5cd8a802c8c8e613554ecd3b412b5
7
- data.tar.gz: 572fed5f3e6e978f6839c0671a02972d60d151ce9c84731b4398ffb08334240c060eb6014e9e882e789e6e65ed61a75bed763e85b8c91df56657b2546223ab09
6
+ metadata.gz: c0c51795ea8733fc8abb5357d5602a497598e56791b11a648c5d3c623ca0a9d320a9535709c966a13c059d4297af3605dd5b25c118b8b11604707846649dd58f
7
+ data.tar.gz: bd43d8479786f0e3e77814fd88977b47132b0c0dca1082e4a0b1f77e53c312b18e46c1b40a4d6ef31e93d017909cde93d6827fbea020a26aa361307cb82d5741
data/CHANGELOG.md CHANGED
@@ -1,5 +1,76 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 (2026-07-15)
4
+
5
+ Full Changelog: [v0.1.0...v0.2.0](https://github.com/revoxai/revox-ruby/compare/v0.1.0...v0.2.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([8d240fd](https://github.com/revoxai/revox-ruby/commit/8d240fd35dc183da20d0247a33a0c6582b5db2db))
10
+ * **api:** api update ([9869b36](https://github.com/revoxai/revox-ruby/commit/9869b369d43989b2995febe9b198b1b604f33d8b))
11
+ * **api:** api update ([bf56a5b](https://github.com/revoxai/revox-ruby/commit/bf56a5bd81e2193a2eb43da9b946cb7a9b3603b1))
12
+ * **api:** api update ([112fcd3](https://github.com/revoxai/revox-ruby/commit/112fcd3dcf9982385791fd1168bab051745d0dd7))
13
+ * **api:** api update ([f5df56d](https://github.com/revoxai/revox-ruby/commit/f5df56da8ace157558e6947038496d43dab68af1))
14
+ * **api:** api update ([a7c53f8](https://github.com/revoxai/revox-ruby/commit/a7c53f83552e293123cbf007fb4968bbcf3d49a9))
15
+ * **api:** api update ([b513a69](https://github.com/revoxai/revox-ruby/commit/b513a69717d58eaf5c58b9bc1fb9a4d2eca40ad4))
16
+ * **api:** api update ([dddd00e](https://github.com/revoxai/revox-ruby/commit/dddd00e1b4341c123d49ea76573ae366ebc4516c))
17
+ * **api:** api update ([cde9973](https://github.com/revoxai/revox-ruby/commit/cde997321aa9ff51c1974e5cad84f1318870d235))
18
+ * **api:** api update ([5763976](https://github.com/revoxai/revox-ruby/commit/57639762cfe583bc79138ce9b023f42bf7038287))
19
+ * **api:** api update ([d666984](https://github.com/revoxai/revox-ruby/commit/d66698403b95d717d22db5f3aa7f1310f123c333))
20
+ * **api:** api update ([ca78762](https://github.com/revoxai/revox-ruby/commit/ca78762207935c2aaf2dad44836d310f744cdb40))
21
+ * **api:** api update ([cca54ce](https://github.com/revoxai/revox-ruby/commit/cca54ce1442922c21bfacc4ff0b15083c3b2d299))
22
+ * **api:** api update ([44f5157](https://github.com/revoxai/revox-ruby/commit/44f5157ef688fedba8214ae20bc0b10d38915bb7))
23
+ * **api:** api update ([ce7732a](https://github.com/revoxai/revox-ruby/commit/ce7732a68adef161474be5a89d59098522569408))
24
+ * **api:** api update ([05f0099](https://github.com/revoxai/revox-ruby/commit/05f0099da266211d30eb80ec4a3fc156d95f39d7))
25
+ * **api:** api update ([479acad](https://github.com/revoxai/revox-ruby/commit/479acad28f2524d1d3704442051fab3699a799cf))
26
+ * **api:** api update ([c56b37b](https://github.com/revoxai/revox-ruby/commit/c56b37b31501d7c2e6011df204ecacf4101b65b6))
27
+ * **api:** api update ([502e3cc](https://github.com/revoxai/revox-ruby/commit/502e3cca917fbab0044e6dabbcced3e4ba855e7e))
28
+ * **api:** api update ([3fbceb1](https://github.com/revoxai/revox-ruby/commit/3fbceb15567d3e619e3d67dcb2a2d4590476744c))
29
+ * **api:** api update ([d6283f7](https://github.com/revoxai/revox-ruby/commit/d6283f75a22b6df40ff16627973e8bb48233eb7f))
30
+ * **api:** api update ([7d52591](https://github.com/revoxai/revox-ruby/commit/7d5259112e7bf7527f85d20538e0cd5369c5f885))
31
+ * **api:** api update ([91f11fe](https://github.com/revoxai/revox-ruby/commit/91f11fea2ef847f8580f8b24595d891047ac0e02))
32
+ * **api:** api update ([6c778a4](https://github.com/revoxai/revox-ruby/commit/6c778a48d14822330ad9c068b79ba62222eb8547))
33
+ * **api:** api update ([0b8dc76](https://github.com/revoxai/revox-ruby/commit/0b8dc76c64992e49d67392a993cf3e518d449c59))
34
+ * **api:** api update ([3881854](https://github.com/revoxai/revox-ruby/commit/3881854b74cac11c732ac8770c8fedf9977aceb5))
35
+ * **api:** api update ([c160447](https://github.com/revoxai/revox-ruby/commit/c16044750e3c229cd5ff5731da1b36e7f3ce0911))
36
+ * **api:** api update ([2dd7e29](https://github.com/revoxai/revox-ruby/commit/2dd7e29c003c94e1a8fc54150ed018dee6fed4de))
37
+ * **api:** api update ([bcbccec](https://github.com/revoxai/revox-ruby/commit/bcbccecae3495b6167ea7b6a65270876b51c89e9))
38
+ * **api:** api update ([abce6d8](https://github.com/revoxai/revox-ruby/commit/abce6d8a69e93b724c4dd20c85e478c5f7a4bfc4))
39
+ * **api:** api update ([15e065f](https://github.com/revoxai/revox-ruby/commit/15e065f097f616b859c791b2d7308292be644c1e))
40
+ * **api:** api update ([90a90e5](https://github.com/revoxai/revox-ruby/commit/90a90e51673ff39e3eaa82ff1d1f34000e47ad0a))
41
+ * **api:** api update ([50bed77](https://github.com/revoxai/revox-ruby/commit/50bed77d93f041ec736e1f655bccd51acea5cf28))
42
+ * **api:** api update ([4d644b1](https://github.com/revoxai/revox-ruby/commit/4d644b1170d8fc3eaf3c612a7466badef78bb08e))
43
+ * **api:** api update ([06f4b29](https://github.com/revoxai/revox-ruby/commit/06f4b296792c0b210eb7bd3306ebbc135ae92da3))
44
+ * **api:** api update ([4aa4421](https://github.com/revoxai/revox-ruby/commit/4aa44212415460e534dda3f198087d2ce5a95827))
45
+ * **api:** api update ([0613739](https://github.com/revoxai/revox-ruby/commit/0613739387759e50815d005e58abc7f00ed85ac6))
46
+ * **api:** api update ([9869a45](https://github.com/revoxai/revox-ruby/commit/9869a4559dce66130f9929a24fb57332a89a99e4))
47
+ * **api:** api update ([1380dfb](https://github.com/revoxai/revox-ruby/commit/1380dfbc958d5f9b4ff72b3362d883c6509e7aa5))
48
+ * **api:** api update ([53ff933](https://github.com/revoxai/revox-ruby/commit/53ff9331c97f09223c69cb2de7dab148b478f36d))
49
+ * **api:** api update ([31b7dfe](https://github.com/revoxai/revox-ruby/commit/31b7dfe97b9c31e2549961ad0cc963f33976fe46))
50
+ * **api:** api update ([446753b](https://github.com/revoxai/revox-ruby/commit/446753b7dca2c432116d5d90b2e6914ae09d6a4c))
51
+ * support setting headers via env ([b4924cb](https://github.com/revoxai/revox-ruby/commit/b4924cb118f746f48dd79a6aec93e38d985f8f72))
52
+
53
+
54
+ ### Bug Fixes
55
+
56
+ * align path encoding with RFC 3986 section 3.3 ([12227d4](https://github.com/revoxai/revox-ruby/commit/12227d4d3b83941377114ff2f66ae8238a76c733))
57
+ * **client:** elide content type header on requests without body ([b066b04](https://github.com/revoxai/revox-ruby/commit/b066b049ed1abb7f0dad50b4655d869a93b0903f))
58
+ * **client:** send content-type header for requests with an omitted optional body ([d66d881](https://github.com/revoxai/revox-ruby/commit/d66d881b34056e539370711607d3cbc1a750a597))
59
+ * **internal:** correct multipart form field name encoding ([aad53d6](https://github.com/revoxai/revox-ruby/commit/aad53d61705ebb6f8787c539f5fea50591872394))
60
+ * multipart encoding for file arrays ([41edad7](https://github.com/revoxai/revox-ruby/commit/41edad7843f71bd02744d02326363a1aa766c9a7))
61
+ * variable name typo ([001a5e9](https://github.com/revoxai/revox-ruby/commit/001a5e9e03531812acaa8cff9544d85c5339b042))
62
+
63
+
64
+ ### Chores
65
+
66
+ * **ci:** skip lint on metadata-only changes ([38ff917](https://github.com/revoxai/revox-ruby/commit/38ff917c34e21ea87963b6a0e0d63e71a2a327a5))
67
+ * **ci:** support opting out of skipping builds on metadata-only commits ([bd897b8](https://github.com/revoxai/revox-ruby/commit/bd897b816c651cbc299e8936f8f722353b9d7495))
68
+ * configure new SDK language ([7966f1a](https://github.com/revoxai/revox-ruby/commit/7966f1a260dc020f620a46a11b3bc72085dd4b4f))
69
+ * **internal:** bound formatter parallelism to CPU count ([f159e56](https://github.com/revoxai/revox-ruby/commit/f159e567d712775a9f812692efd6bd51fe6874b4))
70
+ * **internal:** more robust bootstrap script ([b1b49f1](https://github.com/revoxai/revox-ruby/commit/b1b49f14eeaaa9a9fc609d651ee51c408d7d1219))
71
+ * **internal:** tweak CI branches ([cbb8d65](https://github.com/revoxai/revox-ruby/commit/cbb8d6531f3319c56ed3bd2a7411fae875815b42))
72
+ * **internal:** update gitignore ([1327cee](https://github.com/revoxai/revox-ruby/commit/1327ceea6b00fb9dc9879cc242147a2ba4bd12a1))
73
+
3
74
  ## 0.1.0 (2026-03-11)
4
75
 
5
76
  Full Changelog: [v0.0.2...v0.1.0](https://github.com/revoxai/revox-ruby/compare/v0.0.2...v0.1.0)
data/README.md CHANGED
@@ -4,6 +4,15 @@ The Revox Ruby library provides convenient access to the Revox REST API from any
4
4
 
5
5
  It is generated with [Stainless](https://www.stainless.com/).
6
6
 
7
+ ## MCP Server
8
+
9
+ Use the Revox MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
10
+
11
+ [![Add to Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=%40revoxai%2Fsdk-mcp&config=eyJuYW1lIjoiQHJldm94YWkvc2RrLW1jcCIsInRyYW5zcG9ydCI6Imh0dHAiLCJ1cmwiOiJodHRwczovL3Jldm94LW1jcC5zdGxtY3AuY29tIiwiaGVhZGVycyI6eyJ4LXJldm94LWFwaS1rZXkiOiJNeSBBUEkgS2V5In19)
12
+ [![Install in VS Code](https://img.shields.io/badge/_-Add_to_VS_Code-blue?style=for-the-badge&logo=data:image/svg%2bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHBhdGggZmlsbD0iI0VFRSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMzAuMjM1IDM5Ljg4NGEyLjQ5MSAyLjQ5MSAwIDAgMS0xLjc4MS0uNzNMMTIuNyAyNC43OGwtMy40NiAyLjYyNC0zLjQwNiAyLjU4MmExLjY2NSAxLjY2NSAwIDAgMS0xLjA4Mi4zMzggMS42NjQgMS42NjQgMCAwIDEtMS4wNDYtLjQzMWwtMi4yLTJhMS42NjYgMS42NjYgMCAwIDEgMC0yLjQ2M0w3LjQ1OCAyMCA0LjY3IDE3LjQ1MyAxLjUwNyAxNC41N2ExLjY2NSAxLjY2NSAwIDAgMSAwLTIuNDYzbDIuMi0yYTEuNjY1IDEuNjY1IDAgMCAxIDIuMTMtLjA5N2w2Ljg2MyA1LjIwOUwyOC40NTIuODQ0YTIuNDg4IDIuNDg4IDAgMCAxIDEuODQxLS43MjljLjM1MS4wMDkuNjk5LjA5MSAxLjAxOS4yNDVsOC4yMzYgMy45NjFhMi41IDIuNSAwIDAgMSAxLjQxNSAyLjI1M3YuMDk5LS4wNDVWMzMuMzd2LS4wNDUuMDk1YTIuNTAxIDIuNTAxIDAgMCAxLTEuNDE2IDIuMjU3bC04LjIzNSAzLjk2MWEyLjQ5MiAyLjQ5MiAwIDAgMS0xLjA3Ny4yNDZabS43MTYtMjguOTQ3LTExLjk0OCA5LjA2MiAxMS45NTIgOS4wNjUtLjAwNC0xOC4xMjdaIi8+PC9zdmc+)](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40revoxai%2Fsdk-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Frevox-mcp.stlmcp.com%22%2C%22headers%22%3A%7B%22x-revox-api-key%22%3A%22My%20API%20Key%22%7D%7D)
13
+
14
+ > Note: You may need to set environment variables in your MCP client.
15
+
7
16
  ## Documentation
8
17
 
9
18
  Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/revox).
@@ -15,7 +24,7 @@ To use this gem, install via Bundler by adding the following to your application
15
24
  <!-- x-release-please-start-version -->
16
25
 
17
26
  ```ruby
18
- gem "revox", "~> 0.1.0"
27
+ gem "revox", "~> 0.2.0"
19
28
  ```
20
29
 
21
30
  <!-- x-release-please-end -->
@@ -33,7 +42,9 @@ revox = Revox::Client.new(
33
42
  campaign = revox.campaigns.create(
34
43
  assistant_id: "REPLACE_ME",
35
44
  contacts: [{prompt_variables: {foo: "string"}, to_phone_number: "to_phone_number"}],
36
- name: "REPLACE_ME"
45
+ launch: true,
46
+ name: "REPLACE_ME",
47
+ type: "regular"
37
48
  )
38
49
 
39
50
  puts(campaign.campaign)
@@ -48,7 +59,9 @@ begin
48
59
  campaign = revox.campaigns.create(
49
60
  assistant_id: "REPLACE_ME",
50
61
  contacts: [{prompt_variables: {foo: "string"}, to_phone_number: "to_phone_number"}],
51
- name: "REPLACE_ME"
62
+ launch: true,
63
+ name: "REPLACE_ME",
64
+ type: "regular"
52
65
  )
53
66
  rescue Revox::Errors::APIConnectionError => e
54
67
  puts("The server could not be reached")
@@ -95,7 +108,9 @@ revox = Revox::Client.new(
95
108
  revox.campaigns.create(
96
109
  assistant_id: "REPLACE_ME",
97
110
  contacts: [{prompt_variables: {foo: "string"}, to_phone_number: "to_phone_number"}],
111
+ launch: true,
98
112
  name: "REPLACE_ME",
113
+ type: "regular",
99
114
  request_options: {max_retries: 5}
100
115
  )
101
116
  ```
@@ -114,7 +129,9 @@ revox = Revox::Client.new(
114
129
  revox.campaigns.create(
115
130
  assistant_id: "REPLACE_ME",
116
131
  contacts: [{prompt_variables: {foo: "string"}, to_phone_number: "to_phone_number"}],
132
+ launch: true,
117
133
  name: "REPLACE_ME",
134
+ type: "regular",
118
135
  request_options: {timeout: 5}
119
136
  )
120
137
  ```
@@ -150,7 +167,9 @@ campaign =
150
167
  revox.campaigns.create(
151
168
  assistant_id: "REPLACE_ME",
152
169
  contacts: [{prompt_variables: {foo: "string"}, to_phone_number: "to_phone_number"}],
170
+ launch: true,
153
171
  name: "REPLACE_ME",
172
+ type: "regular",
154
173
  request_options: {
155
174
  extra_query: {my_query_parameter: value},
156
175
  extra_body: {my_body_parameter: value},
@@ -204,7 +223,9 @@ revox.campaigns.create(
204
223
  to_phone_number: "to_phone_number"
205
224
  )
206
225
  ],
207
- name: "REPLACE_ME"
226
+ launch: true,
227
+ name: "REPLACE_ME",
228
+ type: "regular"
208
229
  )
209
230
  ```
210
231
 
@@ -215,7 +236,9 @@ Or, equivalently:
215
236
  revox.campaigns.create(
216
237
  assistant_id: "REPLACE_ME",
217
238
  contacts: [{prompt_variables: {foo: "string"}, to_phone_number: "to_phone_number"}],
218
- name: "REPLACE_ME"
239
+ launch: true,
240
+ name: "REPLACE_ME",
241
+ type: "regular"
219
242
  )
220
243
 
221
244
  # You can also splat a full Params class:
@@ -227,7 +250,9 @@ params = Revox::CampaignCreateParams.new(
227
250
  to_phone_number: "to_phone_number"
228
251
  )
229
252
  ],
230
- name: "REPLACE_ME"
253
+ launch: true,
254
+ name: "REPLACE_ME",
255
+ type: "regular"
231
256
  )
232
257
  revox.campaigns.create(**params)
233
258
  ```
@@ -237,25 +262,25 @@ revox.campaigns.create(**params)
237
262
  Since this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:
238
263
 
239
264
  ```ruby
240
- # :IVR
241
- puts(Revox::CampaignGetRowsParams::Result::IVR)
265
+ # :regular
266
+ puts(Revox::CampaignCreateParams::Type::REGULAR)
242
267
 
243
- # Revealed type: `T.all(Revox::CampaignGetRowsParams::Result, Symbol)`
244
- T.reveal_type(Revox::CampaignGetRowsParams::Result::IVR)
268
+ # Revealed type: `T.all(Revox::CampaignCreateParams::Type, Symbol)`
269
+ T.reveal_type(Revox::CampaignCreateParams::Type::REGULAR)
245
270
  ```
246
271
 
247
272
  Enum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:
248
273
 
249
274
  ```ruby
250
275
  # Using the enum constants preserves the tagged type information:
251
- revox.campaigns.get_rows(
252
- result: Revox::CampaignGetRowsParams::Result::IVR,
276
+ revox.campaigns.create(
277
+ type: Revox::CampaignCreateParams::Type::REGULAR,
253
278
  # …
254
279
  )
255
280
 
256
281
  # Literal values are also permissible:
257
- revox.campaigns.get_rows(
258
- result: :IVR,
282
+ revox.campaigns.create(
283
+ type: :regular,
259
284
  # …
260
285
  )
261
286
  ```
data/lib/revox/client.rb CHANGED
@@ -70,6 +70,19 @@ module Revox
70
70
  raise ArgumentError.new("api_key is required, and can be set via environ: \"REVOX_API_KEY\"")
71
71
  end
72
72
 
73
+ headers = {}
74
+ custom_headers_env = ENV["REVOX_CUSTOM_HEADERS"]
75
+ unless custom_headers_env.nil?
76
+ parsed = {}
77
+ custom_headers_env.split("\n").each do |line|
78
+ colon = line.index(":")
79
+ unless colon.nil?
80
+ parsed[line[0...colon].strip] = line[(colon + 1)..].strip
81
+ end
82
+ end
83
+ headers = parsed.merge(headers)
84
+ end
85
+
73
86
  @api_key = api_key.to_s
74
87
 
75
88
  super(
@@ -77,7 +90,8 @@ module Revox
77
90
  timeout: timeout,
78
91
  max_retries: max_retries,
79
92
  initial_retry_delay: initial_retry_delay,
80
- max_retry_delay: max_retry_delay
93
+ max_retry_delay: max_retry_delay,
94
+ headers: headers
81
95
  )
82
96
 
83
97
  @campaigns = Revox::Resources::Campaigns.new(client: self)
@@ -306,6 +306,11 @@ module Revox
306
306
  Revox::Internal::Util.deep_merge(*[req[:body], opts[:extra_body]].compact)
307
307
  end
308
308
 
309
+ # Generated methods always pass `req[:body]` for operations that define a
310
+ # request body, so only elide the content-type header when the operation
311
+ # has no body at all, not when an optional body param was omitted.
312
+ headers.delete("content-type") if body.nil? && !req.key?(:body)
313
+
309
314
  url = Revox::Internal::Util.join_parsed_uri(@base_url_components, {**req, path: path, query: query})
310
315
  headers, encoded = Revox::Internal::Util.encode_content(headers, body)
311
316
  {
@@ -157,7 +157,7 @@ module Revox
157
157
  in Hash | nil => coerced
158
158
  coerced
159
159
  else
160
- message = "Expected a #{Hash} or #{Revox::Internal::Type::BaseModel}, got #{data.inspect}"
160
+ message = "Expected a #{Hash} or #{Revox::Internal::Type::BaseModel}, got #{input.inspect}"
161
161
  raise ArgumentError.new(message)
162
162
  end
163
163
  end
@@ -237,6 +237,11 @@ module Revox
237
237
  end
238
238
  end
239
239
 
240
+ # @type [Regexp]
241
+ #
242
+ # https://www.rfc-editor.org/rfc/rfc3986.html#section-3.3
243
+ RFC_3986_NOT_PCHARS = /[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/
244
+
240
245
  class << self
241
246
  # @api private
242
247
  #
@@ -247,6 +252,15 @@ module Revox
247
252
  "#{uri.scheme}://#{uri.host}#{":#{uri.port}" unless uri.port == uri.default_port}"
248
253
  end
249
254
 
255
+ # @api private
256
+ #
257
+ # @param path [String, Integer]
258
+ #
259
+ # @return [String]
260
+ def encode_path(path)
261
+ path.to_s.gsub(Revox::Internal::Util::RFC_3986_NOT_PCHARS) { ERB::Util.url_encode(_1) }
262
+ end
263
+
250
264
  # @api private
251
265
  #
252
266
  # @param path [String, Array<String>]
@@ -259,7 +273,7 @@ module Revox
259
273
  in []
260
274
  ""
261
275
  in [String => p, *interpolations]
262
- encoded = interpolations.map { ERB::Util.url_encode(_1) }
276
+ encoded = interpolations.map { encode_path(_1) }
263
277
  format(p, *encoded)
264
278
  end
265
279
  end
@@ -571,16 +585,15 @@ module Revox
571
585
  y << "Content-Disposition: form-data"
572
586
 
573
587
  unless key.nil?
574
- name = ERB::Util.url_encode(key.to_s)
575
- y << "; name=\"#{name}\""
588
+ y << "; name=\"#{key}\""
576
589
  end
577
590
 
578
591
  case val
579
592
  in Revox::FilePart unless val.filename.nil?
580
- filename = ERB::Util.url_encode(val.filename)
593
+ filename = encode_path(val.filename)
581
594
  y << "; filename=\"#{filename}\""
582
595
  in Pathname | IO
583
- filename = ERB::Util.url_encode(::File.basename(val.to_path))
596
+ filename = encode_path(::File.basename(val.to_path))
584
597
  y << "; filename=\"#{filename}\""
585
598
  else
586
599
  end
@@ -597,6 +610,7 @@ module Revox
597
610
  #
598
611
  # @return [Array(String, Enumerable<String>)]
599
612
  private def encode_multipart_streaming(body)
613
+ # rubocop:disable Style/CaseEquality
600
614
  # RFC 1521 Section 7.2.1 says we should have 70 char maximum for boundary length
601
615
  boundary = SecureRandom.urlsafe_base64(46)
602
616
 
@@ -606,7 +620,7 @@ module Revox
606
620
  in Hash
607
621
  body.each do |key, val|
608
622
  case val
609
- in Array if val.all? { primitive?(_1) }
623
+ in Array if val.all? { primitive?(_1) || Revox::Internal::Type::FileInput === _1 }
610
624
  val.each do |v|
611
625
  write_multipart_chunk(y, boundary: boundary, key: key, val: v, closing: closing)
612
626
  end
@@ -622,6 +636,7 @@ module Revox
622
636
 
623
637
  fused_io = fused_enum(strio) { closing.each(&:call) }
624
638
  [boundary, fused_io]
639
+ # rubocop:enable Style/CaseEquality
625
640
  end
626
641
 
627
642
  # @api private