growsurf-ruby 1.2.1 → 1.3.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 (118) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/LICENSE +201 -0
  4. data/README.md +1 -1
  5. data/lib/growsurf_ruby/internal/transport/base_client.rb +21 -4
  6. data/lib/growsurf_ruby/models/affiliate_application.rb +249 -0
  7. data/lib/growsurf_ruby/models/affiliate_application_list_response.rb +42 -0
  8. data/lib/growsurf_ruby/models/affiliate_invite.rb +109 -0
  9. data/lib/growsurf_ruby/models/affiliate_invite_list_response.rb +41 -0
  10. data/lib/growsurf_ruby/models/campaign/create.rb +12 -1
  11. data/lib/growsurf_ruby/models/campaign/participant.rb +79 -4
  12. data/lib/growsurf_ruby/models/campaign/participant_analytics_response.rb +28 -17
  13. data/lib/growsurf_ruby/models/campaign/participant_get_payout_destination_params.rb +28 -0
  14. data/lib/growsurf_ruby/models/campaign/participant_get_payout_destination_response.rb +126 -0
  15. data/lib/growsurf_ruby/models/campaign/participant_list_payouts_params.rb +1 -0
  16. data/lib/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_params.rb +50 -0
  17. data/lib/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_response.rb +56 -0
  18. data/lib/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rb +14 -17
  19. data/lib/growsurf_ruby/models/campaign/participant_update_params.rb +25 -9
  20. data/lib/growsurf_ruby/models/campaign/referral_source.rb +3 -0
  21. data/lib/growsurf_ruby/models/campaign/reward.rb +20 -3
  22. data/lib/growsurf_ruby/models/campaign/reward_create_params.rb +3 -3
  23. data/lib/growsurf_ruby/models/campaign/reward_update_params.rb +3 -3
  24. data/lib/growsurf_ruby/models/campaign.rb +2 -2
  25. data/lib/growsurf_ruby/models/campaign_create_affiliate_invite_params.rb +45 -0
  26. data/lib/growsurf_ruby/models/campaign_list_affiliate_applications_params.rb +57 -0
  27. data/lib/growsurf_ruby/models/campaign_list_affiliate_invites_params.rb +58 -0
  28. data/lib/growsurf_ruby/models/campaign_list_payouts_params.rb +1 -0
  29. data/lib/growsurf_ruby/models/campaign_resend_affiliate_invite_params.rb +26 -0
  30. data/lib/growsurf_ruby/models/campaign_retrieve_affiliate_application_params.rb +26 -0
  31. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_params.rb +9 -6
  32. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_response.rb +59 -11
  33. data/lib/growsurf_ruby/models/campaign_review_affiliate_application_params.rb +94 -0
  34. data/lib/growsurf_ruby/models/campaign_revoke_affiliate_invite_params.rb +26 -0
  35. data/lib/growsurf_ruby/models/email_analytics.rb +41 -0
  36. data/lib/growsurf_ruby/models/participant_payout_list.rb +8 -1
  37. data/lib/growsurf_ruby/models/reward_tax_valuation.rb +24 -9
  38. data/lib/growsurf_ruby/models.rb +19 -0
  39. data/lib/growsurf_ruby/resources/campaign/design.rb +14 -12
  40. data/lib/growsurf_ruby/resources/campaign/options.rb +7 -7
  41. data/lib/growsurf_ruby/resources/campaign/participant.rb +96 -11
  42. data/lib/growsurf_ruby/resources/campaign/rewards.rb +2 -2
  43. data/lib/growsurf_ruby/resources/campaign.rb +231 -4
  44. data/lib/growsurf_ruby/version.rb +1 -1
  45. data/lib/growsurf_ruby.rb +16 -0
  46. data/rbi/growsurf_ruby/models/affiliate_application.rbi +431 -0
  47. data/rbi/growsurf_ruby/models/affiliate_application_list_response.rbi +70 -0
  48. data/rbi/growsurf_ruby/models/affiliate_invite.rbi +167 -0
  49. data/rbi/growsurf_ruby/models/affiliate_invite_list_response.rbi +70 -0
  50. data/rbi/growsurf_ruby/models/campaign/create.rbi +17 -0
  51. data/rbi/growsurf_ruby/models/campaign/participant.rbi +169 -3
  52. data/rbi/growsurf_ruby/models/campaign/participant_activity_logs_response.rbi +3 -5
  53. data/rbi/growsurf_ruby/models/campaign/participant_analytics_response.rbi +35 -20
  54. data/rbi/growsurf_ruby/models/campaign/participant_bulk_delete_response.rbi +3 -1
  55. data/rbi/growsurf_ruby/models/campaign/participant_get_payout_destination_params.rbi +48 -0
  56. data/rbi/growsurf_ruby/models/campaign/participant_get_payout_destination_response.rbi +243 -0
  57. data/rbi/growsurf_ruby/models/campaign/participant_list_payouts_params.rbi +5 -0
  58. data/rbi/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_params.rbi +100 -0
  59. data/rbi/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_response.rbi +118 -0
  60. data/rbi/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbi +22 -52
  61. data/rbi/growsurf_ruby/models/campaign/participant_update_params.rbi +67 -11
  62. data/rbi/growsurf_ruby/models/campaign/referral_source.rbi +9 -0
  63. data/rbi/growsurf_ruby/models/campaign/reward.rbi +23 -2
  64. data/rbi/growsurf_ruby/models/campaign/reward_create_params.rbi +4 -4
  65. data/rbi/growsurf_ruby/models/campaign/reward_update_params.rbi +4 -4
  66. data/rbi/growsurf_ruby/models/campaign.rbi +2 -2
  67. data/rbi/growsurf_ruby/models/campaign_create_affiliate_invite_params.rbi +74 -0
  68. data/rbi/growsurf_ruby/models/campaign_list_affiliate_applications_params.rbi +130 -0
  69. data/rbi/growsurf_ruby/models/campaign_list_affiliate_invites_params.rbi +135 -0
  70. data/rbi/growsurf_ruby/models/campaign_list_payouts_params.rbi +5 -0
  71. data/rbi/growsurf_ruby/models/campaign_resend_affiliate_invite_params.rbi +46 -0
  72. data/rbi/growsurf_ruby/models/campaign_retrieve_affiliate_application_params.rbi +46 -0
  73. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_params.rbi +15 -10
  74. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_response.rbi +68 -18
  75. data/rbi/growsurf_ruby/models/campaign_review_affiliate_application_params.rbi +167 -0
  76. data/rbi/growsurf_ruby/models/campaign_revoke_affiliate_invite_params.rbi +46 -0
  77. data/rbi/growsurf_ruby/models/email_analytics.rbi +200 -0
  78. data/rbi/growsurf_ruby/models/participant_payout_list.rbi +17 -3
  79. data/rbi/growsurf_ruby/models/reward_tax_valuation.rbi +66 -9
  80. data/rbi/growsurf_ruby/models.rbi +25 -0
  81. data/rbi/growsurf_ruby/resources/campaign/design.rbi +9 -8
  82. data/rbi/growsurf_ruby/resources/campaign/options.rbi +7 -7
  83. data/rbi/growsurf_ruby/resources/campaign/participant.rbi +89 -13
  84. data/rbi/growsurf_ruby/resources/campaign/rewards.rbi +4 -4
  85. data/rbi/growsurf_ruby/resources/campaign.rbi +188 -10
  86. data/sig/growsurf_ruby/models/affiliate_application.rbs +192 -0
  87. data/sig/growsurf_ruby/models/affiliate_application_list_response.rbs +39 -0
  88. data/sig/growsurf_ruby/models/affiliate_invite.rbs +92 -0
  89. data/sig/growsurf_ruby/models/affiliate_invite_list_response.rbs +39 -0
  90. data/sig/growsurf_ruby/models/campaign/create.rbs +7 -0
  91. data/sig/growsurf_ruby/models/campaign/participant.rbs +62 -2
  92. data/sig/growsurf_ruby/models/campaign/participant_activity_logs_response.rbs +2 -11
  93. data/sig/growsurf_ruby/models/campaign/participant_analytics_response.rbs +12 -12
  94. data/sig/growsurf_ruby/models/campaign/participant_get_payout_destination_params.rbs +30 -0
  95. data/sig/growsurf_ruby/models/campaign/participant_get_payout_destination_response.rbs +107 -0
  96. data/sig/growsurf_ruby/models/campaign/participant_list_payouts_params.rbs +2 -1
  97. data/sig/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_params.rbs +49 -0
  98. data/sig/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_response.rbs +57 -0
  99. data/sig/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbs +5 -13
  100. data/sig/growsurf_ruby/models/campaign/participant_update_params.rbs +21 -7
  101. data/sig/growsurf_ruby/models/campaign/referral_source.rbs +4 -1
  102. data/sig/growsurf_ruby/models/campaign/reward.rbs +12 -0
  103. data/sig/growsurf_ruby/models/campaign_create_affiliate_invite_params.rbs +40 -0
  104. data/sig/growsurf_ruby/models/campaign_list_affiliate_applications_params.rbs +61 -0
  105. data/sig/growsurf_ruby/models/campaign_list_affiliate_invites_params.rbs +62 -0
  106. data/sig/growsurf_ruby/models/campaign_list_payouts_params.rbs +2 -1
  107. data/sig/growsurf_ruby/models/campaign_resend_affiliate_invite_params.rbs +28 -0
  108. data/sig/growsurf_ruby/models/campaign_retrieve_affiliate_application_params.rbs +28 -0
  109. data/sig/growsurf_ruby/models/campaign_retrieve_analytics_response.rbs +36 -16
  110. data/sig/growsurf_ruby/models/campaign_review_affiliate_application_params.rbs +79 -0
  111. data/sig/growsurf_ruby/models/campaign_revoke_affiliate_invite_params.rbs +28 -0
  112. data/sig/growsurf_ruby/models/email_analytics.rbs +92 -0
  113. data/sig/growsurf_ruby/models/participant_payout_list.rbs +12 -4
  114. data/sig/growsurf_ruby/models/reward_tax_valuation.rbs +26 -4
  115. data/sig/growsurf_ruby/models.rbs +18 -0
  116. data/sig/growsurf_ruby/resources/campaign/participant.rbs +16 -2
  117. data/sig/growsurf_ruby/resources/campaign.rbs +53 -0
  118. metadata +54 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3f7355b6a4f09692cd4f02923eda76fe0887f88b647f0cfdc461b93e36337f6
4
- data.tar.gz: 16ae21e1f33b5f0ffead7caf1f93d80758fbffce09c3d634d0350f5cde7e1e36
3
+ metadata.gz: 493b71b685dcab98c1c2633ab0c32d9339609bba972dafb665607039a0079142
4
+ data.tar.gz: 75af6a27ec19b8f9e1cc8cdf8b412c4c70f9405276f444f69b305c901ca51893
5
5
  SHA512:
6
- metadata.gz: c58b6e6dd858d7c7e419bd5d96d605b27d8de8518d3c9c2ff2c4dd121473404a6843f0e62dc6c4b0190c02ae7bed3821542b73ab5ebf9bf3646ee343783a92ee
7
- data.tar.gz: d98124e2a70ebb54f25757c814342a2ee6f4d5595c3713ebb26386b9157474eaee6ad35825ad091f5b180455d89d9a334972fd37e53593c1c066d3d3d7b7f553
6
+ metadata.gz: 50054ac45d5711ca710ae6f4c16d24d4c10954fc7c0f17e99f279531e318c86663ffd866cbf263380ccc8697a902ffd3c7d78389f11a31ec74ac4c046e09fbf2
7
+ data.tar.gz: 6de111fb82f96ea5dbdd3c43c5c98f039f3a250c71ebd193a9ae3244f3896df02eb3bd82a6f0143ed947bee2456a8cc1f7f08da8ef48b69da0860904730e0966
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.3.0](https://github.com/growsurf/growsurf-ruby/compare/v1.2.1...v1.3.0) (2026-08-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** add affiliate and payout destination APIs ([1b34978](https://github.com/growsurf/growsurf-ruby/commit/1b34978709f715124c85d8bf77c25b6bb6488e77))
9
+ * **api:** add affiliate and payout destination APIs ([c2ffa2c](https://github.com/growsurf/growsurf-ruby/commit/c2ffa2cb4c0247044dcfcda433d64a824f261e79))
10
+ * v1.3.0 — safer retries, analytics additions, packaging and CI updates ([70bf8c3](https://github.com/growsurf/growsurf-ruby/commit/70bf8c3e858c692bfa8836ea04c0f81218926631))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * **api:** align analytics reward status models ([28bd123](https://github.com/growsurf/growsurf-ruby/commit/28bd123324b6d21547abc511e0be864a0a998f8e))
16
+
3
17
  ## [1.2.1](https://github.com/growsurf/growsurf-ruby/compare/v1.2.0...v1.2.1) (2026-07-14)
4
18
 
5
19
 
data/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Growsurf
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "growsurf-ruby", "~> 1.2.1"
20
+ gem "growsurf-ruby", "~> 1.3.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -67,6 +67,15 @@ module GrowsurfRuby
67
67
  end
68
68
  end
69
69
 
70
+ # @api private
71
+ #
72
+ # Returns whether replaying this request cannot duplicate a customer-visible mutation.
73
+ def retry_safe_request?(request)
74
+ method, operation_path = request.fetch_values(:method, :operation_path)
75
+ %w[get head].include?(method.to_s.downcase) ||
76
+ (method.to_s.casecmp?("post") && operation_path == "/api-key/rotate")
77
+ end
78
+
70
79
  # @api private
71
80
  #
72
81
  # @param request [Hash{Symbol=>Object}] .
@@ -75,6 +84,8 @@ module GrowsurfRuby
75
84
  #
76
85
  # @option request [URI::Generic] :url
77
86
  #
87
+ # @option request [String] :operation_path
88
+ #
78
89
  # @option request [Hash{String=>String}] :headers
79
90
  #
80
91
  # @option request [Object] :body
@@ -281,9 +292,11 @@ module GrowsurfRuby
281
292
  opts[:extra_headers].to_h
282
293
  )
283
294
 
295
+ normalized_path = "/#{path.sub(%r{/$}, '').delete_prefix('/')}"
296
+ retry_safe_rotation = method.to_s.casecmp?("post") && normalized_path == "/api-key/rotate"
284
297
  if @idempotency_header &&
285
298
  !headers.key?(@idempotency_header) &&
286
- (!Net::HTTP::IDEMPOTENT_METHODS_.include?(method.to_s.upcase) || opts.key?(:idempotency_key))
299
+ (retry_safe_rotation || opts.key?(:idempotency_key))
287
300
  headers[@idempotency_header] = opts.fetch(:idempotency_key) { generate_idempotency_key }
288
301
  end
289
302
 
@@ -319,6 +332,7 @@ module GrowsurfRuby
319
332
  {
320
333
  method: method,
321
334
  url: url,
335
+ operation_path: normalized_path,
322
336
  headers: headers,
323
337
  body: encoded,
324
338
  max_retries: opts.fetch(:max_retries, @max_retries),
@@ -347,7 +361,7 @@ module GrowsurfRuby
347
361
  end
348
362
  return span if span
349
363
 
350
- scale = retry_count**2
364
+ scale = 2**retry_count
351
365
  jitter = 1 - (0.25 * rand)
352
366
  (@initial_retry_delay * scale * jitter).clamp(0, @max_retry_delay)
353
367
  end
@@ -409,9 +423,12 @@ module GrowsurfRuby
409
423
  retry_count: retry_count,
410
424
  send_retry_header: send_retry_header
411
425
  )
412
- in GrowsurfRuby::Errors::APIConnectionError if retry_count >= max_retries
426
+ in GrowsurfRuby::Errors::APIConnectionError if retry_count >= max_retries ||
427
+ !self.class.retry_safe_request?(request)
413
428
  raise status
414
- in (400..) if retry_count >= max_retries || !self.class.should_retry?(status, headers: headers)
429
+ in (400..) if retry_count >= max_retries ||
430
+ !self.class.retry_safe_request?(request) ||
431
+ !self.class.should_retry?(status, headers: headers)
415
432
  decoded = Kernel.then do
416
433
  GrowsurfRuby::Internal::Util.decode_content(headers, stream: stream, suppress_error: true)
417
434
  ensure
@@ -0,0 +1,249 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ # @see GrowsurfRuby::Resources::Campaign#retrieve_affiliate_application
6
+ class AffiliateApplication < GrowsurfRuby::Internal::Type::BaseModel
7
+ # @!attribute answers
8
+ # The applicant's answers to the saved application form.
9
+ #
10
+ # @return [Array<GrowsurfRuby::Models::AffiliateApplication::Answer>]
11
+ required :answers, -> { GrowsurfRuby::Internal::Type::ArrayOf[GrowsurfRuby::AffiliateApplication::Answer] }
12
+
13
+ # @!attribute created_at
14
+ # When the application was submitted, in Unix milliseconds.
15
+ #
16
+ # @return [Integer]
17
+ required :created_at, Integer, api_name: :createdAt
18
+
19
+ # @!attribute decided_at
20
+ # When the decision was made, in Unix milliseconds. `null` while pending.
21
+ #
22
+ # @return [Integer, nil]
23
+ required :decided_at, Integer, api_name: :decidedAt, nil?: true
24
+
25
+ # @!attribute email
26
+ # Required applicant email address, or `null` after applicant data is removed
27
+ # under the Program's retention policy.
28
+ #
29
+ # @return [String, nil]
30
+ required :email, String, nil?: true
31
+
32
+ # @!attribute first_name
33
+ # Required applicant first name, or `null` after applicant data is removed under
34
+ # the Program's retention policy.
35
+ #
36
+ # @return [String, nil]
37
+ required :first_name, String, api_name: :firstName, nil?: true
38
+
39
+ # @!attribute id
40
+ # Application ID.
41
+ #
42
+ # @return [String]
43
+ required :id, String
44
+
45
+ # @!attribute last_name
46
+ # Required applicant last name, or `null` after applicant data is removed under
47
+ # the Program's retention policy.
48
+ #
49
+ # @return [String, nil]
50
+ required :last_name, String, api_name: :lastName, nil?: true
51
+
52
+ # @!attribute participant_id
53
+ # ID of the participant created or upgraded by approval. `null` until the
54
+ # application is approved.
55
+ #
56
+ # @return [String, nil]
57
+ required :participant_id, String, api_name: :participantId, nil?: true
58
+
59
+ # @!attribute reapply_allowed_at
60
+ # When a denied applicant may apply again, in Unix milliseconds. `null` when not
61
+ # applicable.
62
+ #
63
+ # @return [Integer, nil]
64
+ required :reapply_allowed_at, Integer, api_name: :reapplyAllowedAt, nil?: true
65
+
66
+ # @!attribute rejection_reason
67
+ # The structured reason recorded when the application was denied. `null` until
68
+ # then.
69
+ #
70
+ # @return [String, nil]
71
+ required :rejection_reason, String, api_name: :rejectionReason, nil?: true
72
+
73
+ # @!attribute reviewed_at
74
+ # When the application was reviewed, in Unix milliseconds. `null` while pending.
75
+ #
76
+ # @return [Integer, nil]
77
+ required :reviewed_at, Integer, api_name: :reviewedAt, nil?: true
78
+
79
+ # @!attribute risk_level
80
+ # GrowSurf risk assessment. Applications that are not `LOW` risk are held for
81
+ # manual review; `null` means no assessment was recorded.
82
+ #
83
+ # @return [Symbol, GrowsurfRuby::Models::AffiliateApplication::RiskLevel, nil]
84
+ required :risk_level,
85
+ enum: -> { GrowsurfRuby::AffiliateApplication::RiskLevel },
86
+ api_name: :riskLevel,
87
+ nil?: true
88
+
89
+ # @!attribute status
90
+ # Where the application is in review. Only `PENDING` applications can be decided.
91
+ #
92
+ # @return [Symbol, GrowsurfRuby::Models::AffiliateApplication::Status]
93
+ required :status, enum: -> { GrowsurfRuby::AffiliateApplication::Status }
94
+
95
+ # @!attribute terms_accepted_at
96
+ # When the applicant accepted the Program Terms, in Unix milliseconds, or `null`
97
+ # when acceptance was not required.
98
+ #
99
+ # @return [Integer, nil]
100
+ required :terms_accepted_at, Integer, api_name: :termsAcceptedAt, nil?: true
101
+
102
+ # @!method initialize(answers: nil, created_at: nil, decided_at: nil, email: nil, first_name: nil, id: nil, last_name: nil, participant_id: nil, reapply_allowed_at: nil, rejection_reason: nil, reviewed_at: nil, risk_level: nil, status: nil, terms_accepted_at: nil)
103
+ # Some parameter documentations has been truncated, see
104
+ # {GrowsurfRuby::Models::AffiliateApplication} for more details.
105
+ #
106
+ # @param answers [Array<GrowsurfRuby::Models::AffiliateApplication::Answer>] The applicant's answers to the saved application form.
107
+ #
108
+ # @param created_at [Integer] When the application was submitted, in Unix milliseconds.
109
+ #
110
+ # @param decided_at [Integer, nil] When the decision was made, in Unix milliseconds. `null` while pending.
111
+ #
112
+ # @param email [String, nil] Required applicant email address, or `null` after applicant data is removed
113
+ #
114
+ # @param first_name [String, nil] Required applicant first name, or `null` after applicant data is removed under
115
+ #
116
+ # @param id [String] Application ID.
117
+ #
118
+ # @param last_name [String, nil] Required applicant last name, or `null` after applicant data is removed under
119
+ #
120
+ # @param participant_id [String, nil] ID of the participant created or upgraded by approval. `null` until the
121
+ #
122
+ # @param reapply_allowed_at [Integer, nil] When a denied applicant may apply again, in Unix milliseconds. `null` when not
123
+ #
124
+ # @param rejection_reason [String, nil] The structured reason recorded when the application was denied. `null` until
125
+ #
126
+ # @param reviewed_at [Integer, nil] When the application was reviewed, in Unix milliseconds. `null` while pending.
127
+ #
128
+ # @param risk_level [Symbol, GrowsurfRuby::Models::AffiliateApplication::RiskLevel, nil] GrowSurf risk assessment. Applications that are not `LOW` risk are held for
129
+ #
130
+ # @param status [Symbol, GrowsurfRuby::Models::AffiliateApplication::Status] Where the application is in review. Only `PENDING` applications can be decided.
131
+ #
132
+ # @param terms_accepted_at [Integer, nil] When the applicant accepted the Program Terms, in Unix milliseconds, or `null`
133
+ #
134
+ class Answer < GrowsurfRuby::Internal::Type::BaseModel
135
+ # @!attribute field_id
136
+ # Stable key of the saved application-form field this answer belongs to.
137
+ #
138
+ # @return [String]
139
+ required :field_id, String, api_name: :fieldId
140
+
141
+ # @!attribute label
142
+ # Customer-configured field label captured when the applicant submitted.
143
+ #
144
+ # @return [String]
145
+ required :label, String
146
+
147
+ # @!attribute type
148
+ # Saved field type that determined how the scalar answer was validated.
149
+ #
150
+ # @return [Symbol, GrowsurfRuby::Models::AffiliateApplication::Answer::Type]
151
+ required :type, enum: -> { GrowsurfRuby::AffiliateApplication::Answer::Type }
152
+
153
+ # @!attribute value
154
+ # Applicant answer represented as one validated string, number, or boolean.
155
+ #
156
+ # @return [String, Integer, Float, Boolean]
157
+ required :value, -> { GrowsurfRuby::AffiliateApplication::Answer::Value }
158
+
159
+ # @!method initialize(field_id: nil, label: nil, type: nil, value: nil)
160
+ # Some parameter documentations has been truncated, see
161
+ # {GrowsurfRuby::Models::AffiliateApplication::Answer} for more details.
162
+ #
163
+ # @param field_id [String] Stable key of the saved application-form field this answer belongs to.
164
+ #
165
+ # @param label [String] Customer-configured field label captured when the applicant submitted.
166
+ #
167
+ # @param type [Symbol, GrowsurfRuby::Models::AffiliateApplication::Answer::Type] Saved field type that determined how the scalar answer was validated.
168
+ #
169
+ # @param value [String, Integer, Float, Boolean] Applicant answer represented as one validated scalar.
170
+
171
+ class Value
172
+ extend GrowsurfRuby::Internal::Type::Converter
173
+ extend GrowsurfRuby::Internal::Util::SorbetRuntimeSupport
174
+
175
+ private_class_method :new
176
+
177
+ def self.===(other)
178
+ scalar?(other)
179
+ end
180
+
181
+ def self.coerce(value, state:)
182
+ matches = scalar?(value)
183
+ state.fetch(:exactness)[matches ? :yes : :no] += 1
184
+ state[:error] = ArgumentError.new("expected a string, number, or boolean") unless matches
185
+ value
186
+ end
187
+
188
+ def self.to_sorbet_type
189
+ T.any(String, Integer, Float, T::Boolean)
190
+ end
191
+
192
+ def self.scalar?(value)
193
+ value.is_a?(String) ||
194
+ value.is_a?(Integer) ||
195
+ value.is_a?(Float) ||
196
+ value == true ||
197
+ value == false
198
+ end
199
+ private_class_method :scalar?
200
+ end
201
+
202
+ module Type
203
+ extend GrowsurfRuby::Internal::Type::Enum
204
+
205
+ TEXT = :text
206
+ TEXTAREA = :textarea
207
+ URL = :url
208
+ COUNTRY = :country
209
+ NUMBER = :number
210
+ DROPDOWN = :dropdown
211
+ RADIO = :radio
212
+ CHECKBOX = :checkbox
213
+
214
+ # @!method self.values
215
+ # @return [Array<Symbol>]
216
+ end
217
+ end
218
+
219
+ # GrowSurf risk assessment. Applications that are not `LOW` risk are held for
220
+ # manual review; `null` means no assessment was recorded.
221
+ #
222
+ # @see GrowsurfRuby::Models::AffiliateApplication#risk_level
223
+ module RiskLevel
224
+ extend GrowsurfRuby::Internal::Type::Enum
225
+
226
+ LOW = :LOW
227
+ MEDIUM = :MEDIUM
228
+ HIGH = :HIGH
229
+
230
+ # @!method self.values
231
+ # @return [Array<Symbol>]
232
+ end
233
+
234
+ # Where the application is in review. Only `PENDING` applications can be decided.
235
+ #
236
+ # @see GrowsurfRuby::Models::AffiliateApplication#status
237
+ module Status
238
+ extend GrowsurfRuby::Internal::Type::Enum
239
+
240
+ PENDING = :PENDING
241
+ APPROVED = :APPROVED
242
+ DENIED = :DENIED
243
+
244
+ # @!method self.values
245
+ # @return [Array<Symbol>]
246
+ end
247
+ end
248
+ end
249
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ # @see GrowsurfRuby::Resources::Campaign#list_affiliate_applications
6
+ class AffiliateApplicationListResponse < GrowsurfRuby::Internal::Type::BaseModel
7
+ # @!attribute applications
8
+ # One page of the program's applications, newest first.
9
+ #
10
+ # @return [Array<GrowsurfRuby::Models::AffiliateApplication>]
11
+ required :applications,
12
+ -> { GrowsurfRuby::Internal::Type::ArrayOf[GrowsurfRuby::AffiliateApplication] }
13
+
14
+ # @!attribute total
15
+ # Total number of applications matching the filter.
16
+ #
17
+ # @return [Integer]
18
+ required :total, Integer
19
+
20
+ # @!attribute limit
21
+ # The page size used.
22
+ #
23
+ # @return [Integer, nil]
24
+ optional :limit, Integer
25
+
26
+ # @!attribute offset
27
+ # The offset this page started at.
28
+ #
29
+ # @return [Integer, nil]
30
+ optional :offset, Integer
31
+
32
+ # @!method initialize(applications:, total:, limit: nil, offset: nil)
33
+ # @param applications [Array<GrowsurfRuby::Models::AffiliateApplication>] One page of the program's applications, newest first.
34
+ #
35
+ # @param total [Integer] Total number of applications matching the filter.
36
+ #
37
+ # @param limit [Integer] The page size used.
38
+ #
39
+ # @param offset [Integer] The offset this page started at.
40
+ end
41
+ end
42
+ end