growsurf-ruby 1.3.0 → 1.5.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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/README.md +10 -7
  4. data/lib/growsurf_ruby/internal/transport/base_client.rb +6 -1
  5. data/lib/growsurf_ruby/internal/type/base_model.rb +26 -0
  6. data/lib/growsurf_ruby/internal/type/base_page.rb +6 -0
  7. data/lib/growsurf_ruby/models/account_create_response.rb +3 -3
  8. data/lib/growsurf_ruby/models/analytics_availability.rb +16 -0
  9. data/lib/growsurf_ruby/models/analytics_unavailable_reason.rb +20 -0
  10. data/lib/growsurf_ruby/models/campaign/delete_program_resource_response.rb +12 -0
  11. data/lib/growsurf_ruby/models/campaign/integration.rb +69 -0
  12. data/lib/growsurf_ruby/models/campaign/integration_list_response.rb +24 -0
  13. data/lib/growsurf_ruby/models/campaign/participant_activation_analytics.rb +75 -0
  14. data/lib/growsurf_ruby/models/campaign/participant_analytics_response.rb +11 -0
  15. data/lib/growsurf_ruby/models/campaign/participant_get_payout_destination_response.rb +17 -17
  16. data/lib/growsurf_ruby/models/campaign/participant_record_transaction_params.rb +9 -1
  17. data/lib/growsurf_ruby/models/campaign/participant_refund_transaction_params.rb +17 -1
  18. data/lib/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_response.rb +8 -8
  19. data/lib/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rb +15 -11
  20. data/lib/growsurf_ruby/models/campaign/participant_reward.rb +16 -3
  21. data/lib/growsurf_ruby/models/campaign/program_resource.rb +51 -0
  22. data/lib/growsurf_ruby/models/campaign/program_resource_create_params.rb +32 -0
  23. data/lib/growsurf_ruby/models/campaign/program_resource_delete_params.rb +14 -0
  24. data/lib/growsurf_ruby/models/campaign/program_resource_list_response.rb +12 -0
  25. data/lib/growsurf_ruby/models/campaign/program_resource_update_params.rb +35 -0
  26. data/lib/growsurf_ruby/models/campaign/program_resource_upload_result.rb +33 -0
  27. data/lib/growsurf_ruby/models/campaign/program_resource_upload_ticket.rb +26 -0
  28. data/lib/growsurf_ruby/models/campaign/program_resource_upload_ticket_params.rb +17 -0
  29. data/lib/growsurf_ruby/models/campaign/reward.rb +22 -1
  30. data/lib/growsurf_ruby/models/campaign/reward_create_params.rb +32 -9
  31. data/lib/growsurf_ruby/models/campaign/reward_update_params.rb +32 -9
  32. data/lib/growsurf_ruby/models/campaign.rb +25 -2
  33. data/lib/growsurf_ruby/models/campaign_activation_analytics_response.rb +186 -0
  34. data/lib/growsurf_ruby/models/campaign_create_params.rb +37 -1
  35. data/lib/growsurf_ruby/models/campaign_engagement_analytics.rb +174 -0
  36. data/lib/growsurf_ruby/models/campaign_retrieve_activation_analytics_params.rb +35 -0
  37. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_params.rb +37 -4
  38. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_response.rb +3 -0
  39. data/lib/growsurf_ruby/models/commission_structure.rb +19 -3
  40. data/lib/growsurf_ruby/models/participant_commission_list.rb +24 -6
  41. data/lib/growsurf_ruby/models/participant_payout_list.rb +5 -5
  42. data/lib/growsurf_ruby/models.rb +7 -0
  43. data/lib/growsurf_ruby/resources/account.rb +17 -11
  44. data/lib/growsurf_ruby/resources/campaign/design.rb +11 -5
  45. data/lib/growsurf_ruby/resources/campaign/emails.rb +2 -1
  46. data/lib/growsurf_ruby/resources/campaign/integrations.rb +41 -0
  47. data/lib/growsurf_ruby/resources/campaign/participant.rb +28 -25
  48. data/lib/growsurf_ruby/resources/campaign/program_resources.rb +112 -0
  49. data/lib/growsurf_ruby/resources/campaign/rewards.rb +12 -6
  50. data/lib/growsurf_ruby/resources/campaign.rb +53 -7
  51. data/lib/growsurf_ruby/resources/team.rb +7 -5
  52. data/lib/growsurf_ruby/version.rb +1 -1
  53. data/lib/growsurf_ruby.rb +19 -0
  54. data/rbi/growsurf_ruby/internal/type/base_model.rbi +10 -0
  55. data/rbi/growsurf_ruby/internal/type/base_page.rbi +3 -0
  56. data/rbi/growsurf_ruby/models/analytics_availability.rbi +19 -0
  57. data/rbi/growsurf_ruby/models/analytics_unavailable_reason.rbi +23 -0
  58. data/rbi/growsurf_ruby/models/campaign/delete_program_resource_response.rbi +33 -0
  59. data/rbi/growsurf_ruby/models/campaign/integration.rbi +93 -0
  60. data/rbi/growsurf_ruby/models/campaign/integration_list_response.rbi +46 -0
  61. data/rbi/growsurf_ruby/models/campaign/participant_activation_analytics.rbi +133 -0
  62. data/rbi/growsurf_ruby/models/campaign/participant_analytics_response.rbi +35 -0
  63. data/rbi/growsurf_ruby/models/campaign/participant_get_payout_destination_response.rbi +17 -23
  64. data/rbi/growsurf_ruby/models/campaign/participant_record_transaction_params.rbi +18 -0
  65. data/rbi/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbi +18 -0
  66. data/rbi/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_response.rbi +7 -9
  67. data/rbi/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbi +16 -10
  68. data/rbi/growsurf_ruby/models/campaign/participant_reward.rbi +29 -6
  69. data/rbi/growsurf_ruby/models/campaign/program_resource.rbi +186 -0
  70. data/rbi/growsurf_ruby/models/campaign/program_resource_create_params.rbi +95 -0
  71. data/rbi/growsurf_ruby/models/campaign/program_resource_delete_params.rbi +37 -0
  72. data/rbi/growsurf_ruby/models/campaign/program_resource_list_response.rbi +29 -0
  73. data/rbi/growsurf_ruby/models/campaign/program_resource_update_params.rbi +105 -0
  74. data/rbi/growsurf_ruby/models/campaign/program_resource_upload_result.rbi +94 -0
  75. data/rbi/growsurf_ruby/models/campaign/program_resource_upload_ticket.rbi +57 -0
  76. data/rbi/growsurf_ruby/models/campaign/program_resource_upload_ticket_params.rbi +53 -0
  77. data/rbi/growsurf_ruby/models/campaign/reward.rbi +55 -0
  78. data/rbi/growsurf_ruby/models/campaign/reward_create_params.rbi +97 -24
  79. data/rbi/growsurf_ruby/models/campaign/reward_update_params.rbi +97 -24
  80. data/rbi/growsurf_ruby/models/campaign.rbi +52 -3
  81. data/rbi/growsurf_ruby/models/campaign_activation_analytics_response.rbi +325 -0
  82. data/rbi/growsurf_ruby/models/campaign_create_params.rbi +91 -0
  83. data/rbi/growsurf_ruby/models/campaign_engagement_analytics.rbi +369 -0
  84. data/rbi/growsurf_ruby/models/campaign_retrieve_activation_analytics_params.rbi +59 -0
  85. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_params.rbi +56 -3
  86. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_response.rbi +27 -7
  87. data/rbi/growsurf_ruby/models/commission_structure.rbi +36 -3
  88. data/rbi/growsurf_ruby/models/participant_commission_list.rbi +63 -15
  89. data/rbi/growsurf_ruby/models/participant_payout_list.rbi +15 -15
  90. data/rbi/growsurf_ruby/models.rbi +7 -0
  91. data/rbi/growsurf_ruby/resources/account.rbi +9 -6
  92. data/rbi/growsurf_ruby/resources/campaign/design.rbi +32 -4
  93. data/rbi/growsurf_ruby/resources/campaign/emails.rbi +2 -1
  94. data/rbi/growsurf_ruby/resources/campaign/integrations.rbi +35 -0
  95. data/rbi/growsurf_ruby/resources/campaign/participant.rbi +38 -24
  96. data/rbi/growsurf_ruby/resources/campaign/program_resources.rbi +116 -0
  97. data/rbi/growsurf_ruby/resources/campaign/rewards.rbi +35 -16
  98. data/rbi/growsurf_ruby/resources/campaign.rbi +53 -5
  99. data/rbi/growsurf_ruby/resources/team.rbi +7 -5
  100. data/sig/growsurf_ruby/internal/type/base_model.rbs +6 -0
  101. data/sig/growsurf_ruby/internal/type/base_page.rbs +2 -0
  102. data/sig/growsurf_ruby/models/analytics_availability.rbs +15 -0
  103. data/sig/growsurf_ruby/models/analytics_unavailable_reason.rbs +26 -0
  104. data/sig/growsurf_ruby/models/campaign/delete_program_resource_response.rbs +14 -0
  105. data/sig/growsurf_ruby/models/campaign/integration.rbs +47 -0
  106. data/sig/growsurf_ruby/models/campaign/integration_list_response.rbs +20 -0
  107. data/sig/growsurf_ruby/models/campaign/participant_activation_analytics.rbs +96 -0
  108. data/sig/growsurf_ruby/models/campaign/participant_analytics_response.rbs +22 -1
  109. data/sig/growsurf_ruby/models/campaign/participant_get_payout_destination_response.rbs +17 -22
  110. data/sig/growsurf_ruby/models/campaign/participant_record_transaction_params.rbs +15 -1
  111. data/sig/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbs +15 -1
  112. data/sig/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_response.rbs +8 -10
  113. data/sig/growsurf_ruby/models/campaign/participant_reward.rbs +24 -9
  114. data/sig/growsurf_ruby/models/campaign/program_resource.rbs +94 -0
  115. data/sig/growsurf_ruby/models/campaign/program_resource_create_params.rbs +45 -0
  116. data/sig/growsurf_ruby/models/campaign/program_resource_delete_params.rbs +22 -0
  117. data/sig/growsurf_ruby/models/campaign/program_resource_list_response.rbs +14 -0
  118. data/sig/growsurf_ruby/models/campaign/program_resource_update_params.rbs +48 -0
  119. data/sig/growsurf_ruby/models/campaign/program_resource_upload_result.rbs +58 -0
  120. data/sig/growsurf_ruby/models/campaign/program_resource_upload_ticket.rbs +29 -0
  121. data/sig/growsurf_ruby/models/campaign/program_resource_upload_ticket_params.rbs +29 -0
  122. data/sig/growsurf_ruby/models/campaign/reward.rbs +16 -0
  123. data/sig/growsurf_ruby/models/campaign/reward_create_params.rbs +54 -34
  124. data/sig/growsurf_ruby/models/campaign/reward_update_params.rbs +54 -34
  125. data/sig/growsurf_ruby/models/campaign.rbs +23 -5
  126. data/sig/growsurf_ruby/models/campaign_activation_analytics_response.rbs +202 -0
  127. data/sig/growsurf_ruby/models/campaign_create_params.rbs +29 -0
  128. data/sig/growsurf_ruby/models/campaign_engagement_analytics.rbs +186 -0
  129. data/sig/growsurf_ruby/models/campaign_retrieve_activation_analytics_params.rbs +45 -0
  130. data/sig/growsurf_ruby/models/campaign_retrieve_analytics_params.rbs +30 -1
  131. data/sig/growsurf_ruby/models/campaign_retrieve_analytics_response.rbs +21 -3
  132. data/sig/growsurf_ruby/models/commission_structure.rbs +16 -4
  133. data/sig/growsurf_ruby/models/participant_commission_list.rbs +36 -20
  134. data/sig/growsurf_ruby/models/participant_payout_list.rbs +20 -20
  135. data/sig/growsurf_ruby/models.rbs +6 -0
  136. data/sig/growsurf_ruby/resources/campaign/design.rbs +19 -0
  137. data/sig/growsurf_ruby/resources/campaign/integrations.rbs +14 -0
  138. data/sig/growsurf_ruby/resources/campaign/participant.rbs +4 -0
  139. data/sig/growsurf_ruby/resources/campaign/program_resources.rbs +58 -0
  140. data/sig/growsurf_ruby/resources/campaign/rewards.rbs +14 -12
  141. data/sig/growsurf_ruby/resources/campaign.rbs +17 -0
  142. metadata +59 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 493b71b685dcab98c1c2633ab0c32d9339609bba972dafb665607039a0079142
4
- data.tar.gz: 75af6a27ec19b8f9e1cc8cdf8b412c4c70f9405276f444f69b305c901ca51893
3
+ metadata.gz: a41d14943b58b41cb4cd260b998778f9c559a6bdd7b254f2f6ebf93cd750a3b2
4
+ data.tar.gz: 27480177fc199dc35742ec1502b410beba65c52447e1a93bf8b31023bd54bca7
5
5
  SHA512:
6
- metadata.gz: 50054ac45d5711ca710ae6f4c16d24d4c10954fc7c0f17e99f279531e318c86663ffd866cbf263380ccc8697a902ffd3c7d78389f11a31ec74ac4c046e09fbf2
7
- data.tar.gz: 6de111fb82f96ea5dbdd3c43c5c98f039f3a250c71ebd193a9ae3244f3896df02eb3bd82a6f0143ed947bee2456a8cc1f7f08da8ef48b69da0860904730e0966
6
+ metadata.gz: 13275a91aaf8cd2be079cbaf5152be1e8d61ec92319182f205f318b83a50bc7fe19eda3e868fb9d5fce3e797a3c862a7f2194a5f9c82a00f506577fa0d7d0114
7
+ data.tar.gz: 8a6e28b01ea9a4bcb4c5f01521e703b18e82e07fa21c87789bef83dcdf48ff318bc74617098965564f5f4c890a51d9e32d4b87214109007e1fdbb03fea60fc0a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.5.0](https://github.com/growsurf/growsurf-ruby/compare/v1.4.0...v1.5.0) (2026-09-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** add campaign integrations list endpoint ([8d9ca3f](https://github.com/growsurf/growsurf-ruby/commit/8d9ca3f29169cd4ff79625eeba3c19035f2aaa66))
9
+ * **api:** add EMBEDDABLE_ELEMENT portal view source ([0978220](https://github.com/growsurf/growsurf-ruby/commit/0978220cf482049b18bb7e615a3536e362966d6d))
10
+ * **api:** add paymentProvider and testMode to transaction params ([f11947c](https://github.com/growsurf/growsurf-ruby/commit/f11947c1485f25f88aef6de555f894243767e3a8))
11
+ * **api:** add refundHistoryComplete to refund transaction params ([3d765f7](https://github.com/growsurf/growsurf-ruby/commit/3d765f73aad7faf38c798d36dc3355689460fda0))
12
+ * **api:** expose response headers and sync reward and analytics models ([8f0859e](https://github.com/growsurf/growsurf-ruby/commit/8f0859e8b09fe3cf0098b4805f513bbd39c3a76b))
13
+ * **api:** sync analytics and program resources ([1cc5cd2](https://github.com/growsurf/growsurf-ruby/commit/1cc5cd2eca64cfa792ded6bd84c198a348eb9f00))
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * accept explicit nil in setters for nullable and optional fields ([5d5dc21](https://github.com/growsurf/growsurf-ruby/commit/5d5dc216ee160ea5fbbab8bacfa8731238937e67))
19
+
20
+
21
+ ### Documentation
22
+
23
+ * clarify participant email addresses must be unencoded ([b22d681](https://github.com/growsurf/growsurf-ruby/commit/b22d681f111b31cd29fbd530912f05ef2c04b3b2))
24
+
25
+ ## [1.4.0](https://github.com/growsurf/growsurf-ruby/compare/v1.3.0...v1.4.0) (2026-08-25)
26
+
27
+
28
+ ### Features
29
+
30
+ * **api:** add reward and commission event support ([a9d672f](https://github.com/growsurf/growsurf-ruby/commit/a9d672ff9fd34198b8919adbf207436a023841b4))
31
+
3
32
  ## [1.3.0](https://github.com/growsurf/growsurf-ruby/compare/v1.2.1...v1.3.0) (2026-08-23)
4
33
 
5
34
 
data/README.md CHANGED
@@ -2,13 +2,13 @@
2
2
 
3
3
  The Growsurf Ruby library provides convenient access to the Growsurf REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/growsurf/growsurf-ruby#Sorbet) for usage with Sorbet. The standard library's `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.
4
4
 
5
- It is generated with [Stainless](https://www.stainless.com/).
5
+ This library was originally generated with [Stainless](https://www.stainless.com/) and is now maintained by GrowSurf.
6
6
 
7
7
  ## Documentation
8
8
 
9
9
  Documentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/growsurf-ruby).
10
10
 
11
- The REST API documentation can be found on [growsurf.com](https://growsurf.com/settings#contact_support).
11
+ See the [GrowSurf REST API reference](https://docs.growsurf.com/developer-tools/rest-api/api-reference) for endpoint documentation.
12
12
 
13
13
  ## Installation
14
14
 
@@ -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.3.0"
20
+ gem "growsurf-ruby", "~> 1.5.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -73,9 +73,9 @@ Error codes are as follows:
73
73
 
74
74
  ### Retries
75
75
 
76
- Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
76
+ Retryable requests are automatically retried 2 times by default, with a short exponential backoff.
77
77
 
78
- Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.
78
+ Automatic retries apply only to `GET` and `HEAD` requests, plus `POST /api-key/rotate`. For those requests, the library retries connection errors, timeouts, HTTP 408, HTTP 409, HTTP 429, and HTTP 5xx responses. Other mutations are never retried automatically.
79
79
 
80
80
  You can use the `max_retries` option to configure or disable this:
81
81
 
@@ -105,7 +105,7 @@ growsurf.campaign.list(request_options: {timeout: 5})
105
105
 
106
106
  On timeout, `GrowsurfRuby::Errors::APITimeoutError` is raised.
107
107
 
108
- Note that requests that time out are retried by default.
108
+ A timed-out request is retried only when it meets the retry rules above.
109
109
 
110
110
  ## Advanced concepts
111
111
 
@@ -121,6 +121,9 @@ All parameter and response objects inherit from `GrowsurfRuby::Internal::Type::B
121
121
 
122
122
  4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.
123
123
 
124
+ 5. Normalized HTTP response headers through `#response_headers`. For example,
125
+ `response.response_headers["ratelimit"]` exposes the current rate-limit state.
126
+
124
127
  ### Making custom or undocumented requests
125
128
 
126
129
  #### Undocumented properties
@@ -221,7 +224,7 @@ growsurf.campaign.create_mobile_participant_token(
221
224
 
222
225
  ## Versioning
223
226
 
224
- This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.
227
+ This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. Breaking API changes use a new major version.
225
228
 
226
229
  This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.
227
230
 
@@ -532,7 +532,12 @@ module GrowsurfRuby
532
532
  page.new(client: self, req: req, headers: headers, page_data: decoded)
533
533
  else
534
534
  unwrapped = GrowsurfRuby::Internal::Util.dig(decoded, unwrap)
535
- GrowsurfRuby::Internal::Type::Converter.coerce(model, unwrapped)
535
+ result = GrowsurfRuby::Internal::Type::Converter.coerce(model, unwrapped)
536
+ if result.is_a?(GrowsurfRuby::Internal::Type::BaseModel)
537
+ result.attach_response_headers(headers)
538
+ else
539
+ result
540
+ end
536
541
  end
537
542
  end
538
543
 
@@ -82,6 +82,14 @@ module GrowsurfRuby
82
82
  define_method(setter) do |value|
83
83
  target = type_fn.call
84
84
  state = GrowsurfRuby::Internal::Type::Converter.new_coerce_state(translate_names: false)
85
+ # Mirror `.coerce`: an explicit `nil` is valid for nullable and optional fields,
86
+ # so it must not be coerced against the field type and recorded as an error.
87
+ if value.nil? && (nilable || !required)
88
+ @coerced.store(name_sym, true)
89
+ @data.store(name_sym, nil)
90
+ next
91
+ end
92
+
85
93
  coerced = GrowsurfRuby::Internal::Type::Converter.coerce(target, value, state: state)
86
94
  status = @coerced.store(name_sym, state.fetch(:error) || true)
87
95
  stored =
@@ -433,6 +441,23 @@ module GrowsurfRuby
433
441
  # @return [Hash{Symbol=>Object}]
434
442
  def deep_to_h = self.class.recursively_to_h(@data, convert: false)
435
443
 
444
+ # @api public
445
+ #
446
+ # Returns the normalized HTTP response headers for models returned by the client.
447
+ # Models created directly have no response headers.
448
+ #
449
+ # @return [Hash{String=>String}]
450
+ attr_reader :response_headers
451
+
452
+ # @api private
453
+ #
454
+ # @param headers [Hash{String=>String}]
455
+ # @return [self]
456
+ def attach_response_headers(headers)
457
+ @response_headers = headers.freeze
458
+ self
459
+ end
460
+
436
461
  # @param keys [Array<Symbol>, nil]
437
462
  #
438
463
  # @return [Hash{Symbol=>Object}]
@@ -476,6 +501,7 @@ module GrowsurfRuby
476
501
  def initialize(data = {})
477
502
  @data = {}
478
503
  @coerced = {}
504
+ @response_headers = {}.freeze
479
505
  GrowsurfRuby::Internal::Util.coerce_hash!(data).each do
480
506
  if self.class.known_fields.key?(_1)
481
507
  public_send(:"#{_1}=", _2)
@@ -35,6 +35,11 @@ module GrowsurfRuby
35
35
 
36
36
  alias_method :enum_for, :to_enum
37
37
 
38
+ # @api public
39
+ #
40
+ # @return [Hash{String=>String}]
41
+ attr_reader :response_headers
42
+
38
43
  # @api private
39
44
  #
40
45
  # @param client [GrowsurfRuby::Internal::Transport::BaseClient]
@@ -45,6 +50,7 @@ module GrowsurfRuby
45
50
  @client = client
46
51
  @req = req
47
52
  @model = req.fetch(:model)
53
+ @response_headers = headers.freeze
48
54
  super()
49
55
  end
50
56
 
@@ -5,9 +5,9 @@ module GrowsurfRuby
5
5
  # @see GrowsurfRuby::Resources::Account#create
6
6
  class AccountCreateResponse < GrowsurfRuby::Internal::Type::BaseModel
7
7
  # @!attribute api_key
8
- # An API key for the new account. Use it as the `Bearer` token on subsequent
9
- # requests. Locked (`403` `EMAIL_NOT_VERIFIED_ERROR`) until the account's email
10
- # is verified, and rotated when the account owner first signs in to the GrowSurf
8
+ # An API key for the new account. Use it as the `Bearer` token on subsequent requests. Locked (`403`
9
+ # `EMAIL_NOT_VERIFIED_ERROR`) until the account's email is verified; verification unlocks this same
10
+ # key, so keep it and retry. It is replaced only when the account owner first signs in to the GrowSurf
11
11
  # dashboard.
12
12
  #
13
13
  # @return [String]
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module AnalyticsAvailability
6
+ extend GrowsurfRuby::Internal::Type::Enum
7
+
8
+ AVAILABLE = :AVAILABLE
9
+ PARTIAL = :PARTIAL
10
+ UNAVAILABLE = :UNAVAILABLE
11
+
12
+ # @!method self.values
13
+ # @return [Array<Symbol>]
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module AnalyticsUnavailableReason
6
+ extend GrowsurfRuby::Internal::Type::Enum
7
+
8
+ COVERAGE_UNAVAILABLE = :COVERAGE_UNAVAILABLE
9
+ PRE_COVERAGE = :PRE_COVERAGE
10
+ PARTIAL_COVERAGE = :PARTIAL_COVERAGE
11
+ INSUFFICIENT_COVERAGE = :INSUFFICIENT_COVERAGE
12
+ EMPTY_DENOMINATOR = :EMPTY_DENOMINATOR
13
+ QUERY_LIMIT_EXCEEDED = :QUERY_LIMIT_EXCEEDED
14
+ PARTICIPANT_NOT_ELIGIBLE = :PARTICIPANT_NOT_ELIGIBLE
15
+
16
+ # @!method self.values
17
+ # @return [Array<Symbol>]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module Campaign
6
+ class DeleteProgramResourceResponse < GrowsurfRuby::Internal::Type::BaseModel
7
+ required :id, String
8
+ required :success, GrowsurfRuby::Internal::Type::Boolean
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,69 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module Campaign
6
+ # @see GrowsurfRuby::Resources::Campaign::Integrations#list
7
+ class Integration < GrowsurfRuby::Internal::Type::BaseModel
8
+ # @!attribute id
9
+ # Stable integration key, the same value the GrowSurf dashboard uses for this
10
+ # integration.
11
+ #
12
+ # @return [String]
13
+ required :id, String
14
+
15
+ # @!attribute auto_disabled
16
+ # Whether GrowSurf switched the integration off after repeated delivery failures.
17
+ # Its credentials are still stored, but it delivers nothing until it is
18
+ # reconnected in the GrowSurf dashboard.
19
+ #
20
+ # @return [Boolean]
21
+ required :auto_disabled, GrowsurfRuby::Internal::Type::Boolean, api_name: :autoDisabled
22
+
23
+ # @!attribute connect_url
24
+ # Dashboard link that opens this integration's connect panel in the GrowSurf Program
25
+ # Editor. Give it to the person running the program: connecting an account is a step they
26
+ # complete in the dashboard, and the API cannot do it for them.
27
+ #
28
+ # @return [String]
29
+ required :connect_url, String, api_name: :connectUrl
30
+
31
+ # @!attribute connected
32
+ # Whether the program has stored credentials for this integration.
33
+ #
34
+ # @return [Boolean]
35
+ required :connected, GrowsurfRuby::Internal::Type::Boolean
36
+
37
+ # @!attribute enabled
38
+ # Whether the integration is switched on and currently working.
39
+ #
40
+ # @return [Boolean]
41
+ required :enabled, GrowsurfRuby::Internal::Type::Boolean
42
+
43
+ # @!attribute name
44
+ # Display name, matching what the GrowSurf dashboard calls this integration.
45
+ #
46
+ # @return [String]
47
+ required :name, String
48
+
49
+ # @!method initialize(id:, auto_disabled:, connect_url:, connected:, enabled:, name:)
50
+ # Some parameter documentations has been truncated, see
51
+ # {GrowsurfRuby::Models::Campaign::Integration} for more details.
52
+ #
53
+ # One integration a program can connect, with its current state.
54
+ #
55
+ # @param id [String] Stable integration key, the same value the GrowSurf dashboard uses for this integ
56
+ #
57
+ # @param auto_disabled [Boolean] Whether GrowSurf switched the integration off after repeated delivery failures. I
58
+ #
59
+ # @param connect_url [String] Dashboard link that opens this integration's connect panel in the GrowSurf Progra
60
+ #
61
+ # @param connected [Boolean] Whether the program has stored credentials for this integration.
62
+ #
63
+ # @param enabled [Boolean] Whether the integration is switched on and currently working.
64
+ #
65
+ # @param name [String] Display name, matching what the GrowSurf dashboard calls this integration.
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module Campaign
6
+ # @see GrowsurfRuby::Resources::Campaign::Integrations#list
7
+ class IntegrationListResponse < GrowsurfRuby::Internal::Type::BaseModel
8
+ # @!attribute integrations
9
+ # Every integration this program can connect, in the order the GrowSurf dashboard
10
+ # lists them.
11
+ #
12
+ # @return [Array<GrowsurfRuby::Models::Campaign::Integration>]
13
+ required :integrations,
14
+ -> { GrowsurfRuby::Internal::Type::ArrayOf[GrowsurfRuby::Campaign::Integration] }
15
+
16
+ # @!method initialize(integrations:)
17
+ # Some parameter documentations has been truncated, see
18
+ # {GrowsurfRuby::Models::Campaign::IntegrationListResponse} for more details.
19
+ #
20
+ # @param integrations [Array<GrowsurfRuby::Models::Campaign::Integration>] Every integration this program can connect, in the order the GrowSurf dashboard l
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module Campaign
6
+ # Covered first milestones for one participant. Unknown history remains `nil` and
7
+ # is paired with an explicit state and reason.
8
+ class ParticipantActivationAnalytics < GrowsurfRuby::Internal::Type::BaseModel
9
+ required :coverage_start_at, Integer, api_name: :coverageStartAt, nil?: true
10
+ required :metric_contract_version, Integer, api_name: :metricContractVersion
11
+ required :program_type, enum: -> { ProgramType }, api_name: :programType
12
+ required :state, enum: -> { GrowsurfRuby::Models::AnalyticsAvailability }
13
+ required :reason, enum: -> { GrowsurfRuby::Models::AnalyticsUnavailableReason }, nil?: true
14
+ required :cohort, -> { Cohort }
15
+ required :enrolled_as_advocate_at, Integer, api_name: :enrolledAsAdvocateAt, nil?: true
16
+ required :milestones, -> { Milestones }
17
+
18
+ module ProgramType
19
+ extend GrowsurfRuby::Internal::Type::Enum
20
+
21
+ REFERRAL = :REFERRAL
22
+ AFFILIATE = :AFFILIATE
23
+ end
24
+
25
+ module AnchorField
26
+ extend GrowsurfRuby::Internal::Type::Enum
27
+
28
+ ENROLLED_AS_ADVOCATE_AT = :enrolledAsAdvocateAt
29
+ APPROVED_AS_AFFILIATE_AT = :approvedAsAffiliateAt
30
+ end
31
+
32
+ class Cohort < GrowsurfRuby::Internal::Type::BaseModel
33
+ required :anchor_field, enum: -> { AnchorField }, api_name: :anchorField
34
+ required :anchor_at, Integer, api_name: :anchorAt, nil?: true
35
+ end
36
+
37
+ module ShareChannel
38
+ extend GrowsurfRuby::Internal::Type::Enum
39
+
40
+ EMAIL = :email
41
+ FACEBOOK = :facebook
42
+ TWITTER = :twitter
43
+ LINKEDIN = :linkedin
44
+ PINTEREST = :pinterest
45
+ THREADS = :threads
46
+ BLUESKY = :bluesky
47
+ SMS = :sms
48
+ MESSENGER = :messenger
49
+ WHATSAPP = :whatsapp
50
+ WECHAT = :wechat
51
+ TELEGRAM = :telegram
52
+ REDDIT = :reddit
53
+ TUMBLR = :tumblr
54
+ QRCODE = :qrcode
55
+ COPY_REF_LINK = :copyRefLink
56
+ IOS_NATIVE_SHARE = :iosNativeShare
57
+ ANDROID_NATIVE_SHARE = :androidNativeShare
58
+ end
59
+
60
+ class Milestones < GrowsurfRuby::Internal::Type::BaseModel
61
+ required :first_portal_viewed_at, Integer, api_name: :firstPortalViewedAt, nil?: true
62
+ required :first_referral_link_copied_at, Integer, api_name: :firstReferralLinkCopiedAt, nil?: true
63
+ required :first_share_at, Integer, api_name: :firstShareAt, nil?: true
64
+ required :first_share_channel, enum: -> { ShareChannel }, api_name: :firstShareChannel, nil?: true
65
+ required :first_unique_click_at, Integer, api_name: :firstUniqueClickAt, nil?: true
66
+ required :first_lead_at, Integer, api_name: :firstLeadAt, nil?: true
67
+ required :first_referral_at, Integer, api_name: :firstReferralAt, nil?: true
68
+ required :first_reward_at, Integer, api_name: :firstRewardAt, nil?: true
69
+ required :first_commission_at, Integer, api_name: :firstCommissionAt, nil?: true
70
+ required :payout_setup_completed_at, Integer, api_name: :payoutSetupCompletedAt, nil?: true
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -23,6 +23,9 @@ module GrowsurfRuby
23
23
  GrowsurfRuby::Internal::Type::HashOf[Integer],
24
24
  api_name: :shareCount
25
25
 
26
+ # Present only when `include` contains `activation`.
27
+ optional :activation, -> { GrowsurfRuby::Models::Campaign::ParticipantActivationAnalytics }
28
+
26
29
  # Present only when `include` contains `email`.
27
30
  optional :email, -> { GrowsurfRuby::Models::EmailAnalytics }
28
31
 
@@ -270,6 +273,10 @@ module GrowsurfRuby
270
273
  # @return [Integer, nil]
271
274
  optional :pinterest_shares, Integer, api_name: :pinterestShares
272
275
 
276
+ # Covered portal views when both `activation` and `series` are requested.
277
+ # Unknown history is `nil`.
278
+ optional :portal_views, Integer, api_name: :portalViews, nil?: true
279
+
273
280
  # @!attribute qrcode_shares
274
281
  #
275
282
  # @return [Integer, nil]
@@ -300,6 +307,10 @@ module GrowsurfRuby
300
307
  # @return [Integer, nil]
301
308
  optional :sms_shares, Integer, api_name: :smsShares
302
309
 
310
+ # Covered share actions when both `activation` and `series` are requested.
311
+ # Unknown history is `nil`.
312
+ optional :share_actions, Integer, api_name: :shareActions, nil?: true
313
+
303
314
  # @!attribute telegram_shares
304
315
  #
305
316
  # @return [Integer, nil]
@@ -10,14 +10,14 @@ module GrowsurfRuby
10
10
  # one.
11
11
  #
12
12
  # @return [String, nil]
13
- optional :active_provider, String, api_name: :activeProvider, nil?: true
13
+ required :active_provider, String, api_name: :activeProvider, nil?: true
14
14
 
15
15
  # @!attribute destinations
16
16
  # One entry per enabled payout provider describing the participant's destination
17
17
  # for it.
18
18
  #
19
- # @return [Array<GrowsurfRuby::Models::Campaign::ParticipantGetPayoutDestinationResponse::Destination>, nil]
20
- optional :destinations,
19
+ # @return [Array<GrowsurfRuby::Models::Campaign::ParticipantGetPayoutDestinationResponse::Destination>]
20
+ required :destinations,
21
21
  -> {
22
22
  GrowsurfRuby::Internal::Type::ArrayOf[
23
23
  GrowsurfRuby::Campaign::ParticipantGetPayoutDestinationResponse::Destination
@@ -27,14 +27,14 @@ module GrowsurfRuby
27
27
  # @!attribute enabled_providers
28
28
  # The payout providers enabled for this program.
29
29
  #
30
- # @return [Array<String>, nil]
31
- optional :enabled_providers,
30
+ # @return [Array<String>]
31
+ required :enabled_providers,
32
32
  -> {
33
33
  GrowsurfRuby::Internal::Type::ArrayOf[String]
34
34
  },
35
35
  api_name: :enabledProviders
36
36
 
37
- # @!method initialize(active_provider: nil, destinations: nil, enabled_providers: nil)
37
+ # @!method initialize(active_provider:, destinations:, enabled_providers:)
38
38
  # @param active_provider [String, nil] The provider that currently gets paid, or null until the participant confirms one.
39
39
  #
40
40
  # @param destinations [Array<GrowsurfRuby::Models::Campaign::ParticipantGetPayoutDestinationResponse::Destination>] One entry per enabled payout provider describing the participant's destination for it.
@@ -47,19 +47,19 @@ module GrowsurfRuby
47
47
  # The confirmed payout email for this provider.
48
48
  #
49
49
  # @return [String, nil]
50
- optional :claim_email, String, api_name: :claimEmail, nil?: true
50
+ required :claim_email, String, api_name: :claimEmail, nil?: true
51
51
 
52
52
  # @!attribute confirmed_at
53
53
  # When the destination was confirmed, as a Unix timestamp in milliseconds.
54
54
  #
55
55
  # @return [Integer, nil]
56
- optional :confirmed_at, Integer, api_name: :confirmedAt, nil?: true
56
+ required :confirmed_at, Integer, api_name: :confirmedAt, nil?: true
57
57
 
58
58
  # @!attribute legal_entity_type
59
59
  # The legal recipient type the participant confirmed, if any.
60
60
  #
61
61
  # @return [Symbol, GrowsurfRuby::Models::Campaign::ParticipantGetPayoutDestinationResponse::Destination::LegalEntityType, nil]
62
- optional :legal_entity_type,
62
+ required :legal_entity_type,
63
63
  enum: -> {
64
64
  GrowsurfRuby::Campaign::ParticipantGetPayoutDestinationResponse::Destination::LegalEntityType
65
65
  },
@@ -70,29 +70,29 @@ module GrowsurfRuby
70
70
  # When status is `NEEDS_REPAIR`, why (e.g. a bounced delivery).
71
71
  #
72
72
  # @return [String, nil]
73
- optional :needs_repair_reason, String, api_name: :needsRepairReason, nil?: true
73
+ required :needs_repair_reason, String, api_name: :needsRepairReason, nil?: true
74
74
 
75
75
  # @!attribute provider
76
76
  # The payout provider this entry describes.
77
77
  #
78
- # @return [String, nil]
79
- optional :provider, String
78
+ # @return [String]
79
+ required :provider, String
80
80
 
81
81
  # @!attribute provider_display_name
82
82
  # The customer-facing provider name (e.g. "PayPal", "Wise").
83
83
  #
84
- # @return [String, nil]
85
- optional :provider_display_name, String, api_name: :providerDisplayName
84
+ # @return [String]
85
+ required :provider_display_name, String, api_name: :providerDisplayName
86
86
 
87
87
  # @!attribute status
88
88
  # The destination's current status: `NONE` (not set up), `PENDING_CONFIRMATION`,
89
89
  # `CONFIRMED`, `ACTIVE`, `NEEDS_REPAIR`, or `EXPIRED`. Historical superseded
90
90
  # or revoked destinations are projected as `NONE`.
91
91
  #
92
- # @return [String, nil]
93
- optional :status, String
92
+ # @return [String]
93
+ required :status, String
94
94
 
95
- # @!method initialize(claim_email: nil, confirmed_at: nil, legal_entity_type: nil, needs_repair_reason: nil, provider: nil, provider_display_name: nil, status: nil)
95
+ # @!method initialize(claim_email:, confirmed_at:, legal_entity_type:, needs_repair_reason:, provider:, provider_display_name:, status:)
96
96
  # @param claim_email [String, nil] The confirmed payout email for this provider.
97
97
  #
98
98
  # @param confirmed_at [Integer, nil] When the destination was confirmed, as a Unix timestamp in milliseconds.
@@ -137,7 +137,13 @@ module GrowsurfRuby
137
137
  # @return [String, nil]
138
138
  optional :transaction_id, String, api_name: :transactionId
139
139
 
140
- # @!method initialize(id:, participant_id_or_email:, currency:, gross_amount:, amount_cash_net: nil, amount_paid: nil, charge_id: nil, customer_id: nil, description: nil, external_id: nil, invoice_id: nil, invoice_subtotal_excluding_tax: nil, invoice_total: nil, invoice_total_excluding_tax: nil, net_amount: nil, order_id: nil, paid_at: nil, payment_id: nil, payment_intent_id: nil, subscription_id: nil, tax_amount: nil, total_tax_amount: nil, total_tax_amounts: nil, total_taxes: nil, transaction_id: nil, request_options: {})
140
+ # Connected provider: `stripe`, `chargebee` or `recurly`. Requires `transactionId` and `testMode`.
141
+ optional :payment_provider, String, api_name: :paymentProvider
142
+
143
+ # `true` for test or `false` for live. Requires `paymentProvider`.
144
+ optional :test_mode, GrowsurfRuby::Internal::Type::Boolean, api_name: :testMode
145
+
146
+ # @!method initialize(id:, participant_id_or_email:, currency:, gross_amount:, amount_cash_net: nil, amount_paid: nil, charge_id: nil, customer_id: nil, description: nil, external_id: nil, invoice_id: nil, invoice_subtotal_excluding_tax: nil, invoice_total: nil, invoice_total_excluding_tax: nil, net_amount: nil, order_id: nil, paid_at: nil, payment_id: nil, payment_intent_id: nil, subscription_id: nil, tax_amount: nil, total_tax_amount: nil, total_tax_amounts: nil, total_taxes: nil, transaction_id: nil, payment_provider: nil, test_mode: nil, request_options: {})
141
147
  # @param id [String]
142
148
  # @param participant_id_or_email [String]
143
149
  # @param currency [String]
@@ -163,6 +169,8 @@ module GrowsurfRuby
163
169
  # @param total_tax_amounts [Array<Hash{Symbol=>Object}>]
164
170
  # @param total_taxes [Array<Hash{Symbol=>Object}>]
165
171
  # @param transaction_id [String]
172
+ # @param payment_provider [String]
173
+ # @param test_mode [Boolean]
166
174
  # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}]
167
175
  end
168
176
  end
@@ -76,11 +76,18 @@ module GrowsurfRuby
76
76
  optional :payment_intent_id, String, api_name: :paymentIntentId
77
77
 
78
78
  # @!attribute refund_amount
79
+ # Positive amount for this individual refund, no greater than the sale amount, in minor units. Record it with `refundId` on each original refund to support cancellation and out-of-order amendments. A cancellation may omit an already recorded amount. Missing or conflicting refund history returns `409` without applying the cancellation. Newly observed higher cumulative refunds and incomplete coverage are retained for reconciliation.
79
80
  #
80
81
  # @return [Integer, nil]
81
82
  optional :refund_amount, Integer, api_name: :refundAmount
82
83
 
84
+ # Confirm only after every original refund ID and amount is recorded, including canceled refunds.
85
+ # Resolves previously incomplete history. Replaying an old confirmation cannot resolve a later gap; confirm a newly reconciled refund or complete provider list.
86
+ optional :refund_history_complete, GrowsurfRuby::Internal::Type::Boolean, api_name: :refundHistoryComplete
87
+
83
88
  # @!attribute refund_id
89
+ # Stable per-refund identifier. Required when canceling a refund or changing the
90
+ # refunded total after a cancellation. Reuse the original refund's identifier for its cancellation.
84
91
  #
85
92
  # @return [String, nil]
86
93
  optional :refund_id, String, api_name: :refundId
@@ -95,7 +102,13 @@ module GrowsurfRuby
95
102
  # @return [String, nil]
96
103
  optional :transaction_id, String, api_name: :transactionId
97
104
 
98
- # @!method initialize(id:, participant_id_or_email:, amendment_type: nil, amount: nil, amount_refunded: nil, charge_id: nil, currency: nil, description: nil, external_id: nil, invoice_id: nil, order_id: nil, payment_id: nil, payment_intent_id: nil, refund_amount: nil, refund_id: nil, refund_status: nil, transaction_id: nil, request_options: {})
105
+ # Connected provider: `stripe`, `chargebee` or `recurly`. Requires `transactionId` and `testMode`.
106
+ optional :payment_provider, String, api_name: :paymentProvider
107
+
108
+ # `true` for test or `false` for live. Requires `paymentProvider`.
109
+ optional :test_mode, GrowsurfRuby::Internal::Type::Boolean, api_name: :testMode
110
+
111
+ # @!method initialize(id:, participant_id_or_email:, amendment_type: nil, amount: nil, amount_refunded: nil, charge_id: nil, currency: nil, description: nil, external_id: nil, invoice_id: nil, order_id: nil, payment_id: nil, payment_intent_id: nil, refund_amount: nil, refund_history_complete: nil, refund_id: nil, refund_status: nil, transaction_id: nil, payment_provider: nil, test_mode: nil, request_options: {})
99
112
  # @param id [String]
100
113
  # @param participant_id_or_email [String]
101
114
  # @param amendment_type [Symbol, GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionParams::AmendmentType]
@@ -110,9 +123,12 @@ module GrowsurfRuby
110
123
  # @param payment_id [String]
111
124
  # @param payment_intent_id [String]
112
125
  # @param refund_amount [Integer]
126
+ # @param refund_history_complete [Boolean]
113
127
  # @param refund_id [String]
114
128
  # @param refund_status [String]
115
129
  # @param transaction_id [String]
130
+ # @param payment_provider [String]
131
+ # @param test_mode [Boolean]
116
132
  # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}]
117
133
 
118
134
  module AmendmentType