growsurf-ruby 1.1.2 → 1.2.1

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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/lib/growsurf_ruby/client.rb +5 -5
  5. data/lib/growsurf_ruby/models/account_create_response.rb +5 -12
  6. data/lib/growsurf_ruby/models/team.rb +48 -0
  7. data/lib/growsurf_ruby/models/team_resend_owner_verification_email_response.rb +34 -0
  8. data/lib/growsurf_ruby/models/{account_rotate_api_key_response.rb → team_rotate_api_key_response.rb} +3 -3
  9. data/lib/growsurf_ruby/models/team_update_params.rb +22 -0
  10. data/lib/growsurf_ruby/models.rb +3 -3
  11. data/lib/growsurf_ruby/resources/account.rb +18 -124
  12. data/lib/growsurf_ruby/resources/campaign/commission.rb +3 -2
  13. data/lib/growsurf_ruby/resources/campaign/design.rb +7 -11
  14. data/lib/growsurf_ruby/resources/campaign/emails.rb +9 -11
  15. data/lib/growsurf_ruby/resources/campaign/installation.rb +8 -12
  16. data/lib/growsurf_ruby/resources/campaign/options.rb +11 -13
  17. data/lib/growsurf_ruby/resources/campaign/participant.rb +45 -36
  18. data/lib/growsurf_ruby/resources/campaign/reward.rb +4 -3
  19. data/lib/growsurf_ruby/resources/campaign/rewards.rb +18 -6
  20. data/lib/growsurf_ruby/resources/campaign.rb +16 -13
  21. data/lib/growsurf_ruby/resources/team.rb +118 -0
  22. data/lib/growsurf_ruby/version.rb +1 -1
  23. data/lib/growsurf_ruby.rb +5 -4
  24. data/rbi/growsurf_ruby/client.rbi +4 -1
  25. data/rbi/growsurf_ruby/models/account_create_response.rbi +0 -8
  26. data/rbi/growsurf_ruby/models/team.rbi +65 -0
  27. data/rbi/growsurf_ruby/models/{account_resend_verification_email_response.rbi → team_resend_owner_verification_email_response.rbi} +8 -18
  28. data/rbi/growsurf_ruby/models/{account_rotate_api_key_response.rbi → team_rotate_api_key_response.rbi} +3 -7
  29. data/rbi/growsurf_ruby/models/team_update_params.rbi +35 -0
  30. data/rbi/growsurf_ruby/models.rbi +3 -3
  31. data/rbi/growsurf_ruby/resources/account.rbi +13 -85
  32. data/rbi/growsurf_ruby/resources/campaign/commission.rbi +3 -2
  33. data/rbi/growsurf_ruby/resources/campaign/design.rbi +7 -5
  34. data/rbi/growsurf_ruby/resources/campaign/emails.rbi +9 -6
  35. data/rbi/growsurf_ruby/resources/campaign/installation.rbi +8 -8
  36. data/rbi/growsurf_ruby/resources/campaign/options.rbi +11 -8
  37. data/rbi/growsurf_ruby/resources/campaign/participant.rbi +45 -36
  38. data/rbi/growsurf_ruby/resources/campaign/reward.rbi +4 -3
  39. data/rbi/growsurf_ruby/resources/campaign/rewards.rbi +18 -6
  40. data/rbi/growsurf_ruby/resources/campaign.rbi +16 -11
  41. data/rbi/growsurf_ruby/resources/team.rbi +75 -0
  42. data/sig/growsurf_ruby/client.rbs +3 -1
  43. data/sig/growsurf_ruby/models/account_create_response.rbs +0 -5
  44. data/sig/growsurf_ruby/models/team.rbs +36 -0
  45. data/sig/growsurf_ruby/models/team_resend_owner_verification_email_response.rbs +31 -0
  46. data/sig/growsurf_ruby/models/{account_rotate_api_key_response.rbs → team_rotate_api_key_response.rbs} +2 -2
  47. data/sig/growsurf_ruby/models/team_update_params.rbs +23 -0
  48. data/sig/growsurf_ruby/models.rbs +3 -3
  49. data/sig/growsurf_ruby/resources/account.rbs +0 -23
  50. data/sig/growsurf_ruby/resources/team.rbs +28 -0
  51. metadata +17 -14
  52. data/lib/growsurf_ruby/models/account.rb +0 -90
  53. data/lib/growsurf_ruby/models/account_resend_verification_email_response.rb +0 -33
  54. data/lib/growsurf_ruby/models/account_update_params.rb +0 -35
  55. data/rbi/growsurf_ruby/models/account.rbi +0 -125
  56. data/rbi/growsurf_ruby/models/account_update_params.rbi +0 -65
  57. data/sig/growsurf_ruby/models/account.rbs +0 -67
  58. data/sig/growsurf_ruby/models/account_resend_verification_email_response.rbs +0 -35
  59. data/sig/growsurf_ruby/models/account_update_params.rbs +0 -42
@@ -110,12 +110,12 @@ module GrowsurfRuby
110
110
  # {GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteParams} for more details.
111
111
  #
112
112
  # Deletes a list of participants from a program in one request. Each entry in
113
- # `participants` is a GrowSurf participant ID or an email address (mixed lists
114
- # are allowed). Up to `200` entries per request — chunk larger lists across
115
- # multiple calls. The response reports a per-row `status` for every submitted
116
- # entry, so a `200` can include rows that were `NOT_FOUND` or failed. Deletion
117
- # is permanent and removes the participants' referrals, rewards, commissions,
118
- # and payout records.
113
+ # `participants` is a GrowSurf participant ID or an email address (mixed lists are
114
+ # allowed). Up to `200` entries per request — chunk larger lists across multiple
115
+ # calls. The response reports a per-row `status` for every submitted entry, so a
116
+ # `200` can include rows that were `NOT_FOUND` or failed. Deletion is permanent
117
+ # and removes the participants' referrals, rewards, commissions, and payout
118
+ # records.
119
119
  #
120
120
  # @overload bulk_delete(id, participants:, request_options: {})
121
121
  #
@@ -183,7 +183,8 @@ module GrowsurfRuby
183
183
  )
184
184
  end
185
185
 
186
- # Retrieves a paged list of commissions earned by a participant.
186
+ # **Affiliate programs only.** Retrieves a paged list of commissions earned by a
187
+ # participant.
187
188
  #
188
189
  # @overload list_commissions(participant_id_or_email, id:, limit: nil, next_id: nil, status: nil, request_options: {})
189
190
  #
@@ -218,7 +219,8 @@ module GrowsurfRuby
218
219
  )
219
220
  end
220
221
 
221
- # Retrieves a paged list of payouts that belong to a participant.
222
+ # **Affiliate programs only.** Retrieves a paged list of payouts that belong to a
223
+ # participant.
222
224
  #
223
225
  # @overload list_payouts(participant_id_or_email, id:, limit: nil, next_id: nil, status: nil, request_options: {})
224
226
  #
@@ -339,15 +341,12 @@ module GrowsurfRuby
339
341
  )
340
342
  end
341
343
 
342
- # Records a sale made by a referred customer and generates affiliate commissions
343
- # for their referrer when applicable.
344
- #
345
- # At least one transaction identifier is required: one of +external_id+,
346
- # +transaction_id+, +order_id+, +payment_id+, +invoice_id+, +payment_intent_id+,
347
- # or +charge_id+. +customer_id+ and +subscription_id+ do not count, since they
348
- # identify the customer or subscription rather than the specific transaction.
349
- # Without an identifier, resending the same sale creates a duplicate commission
350
- # and double-pays the referrer; the server rejects such requests with HTTP 400.
344
+ # **Affiliate programs only.** Records a sale made by a referred customer and
345
+ # generates affiliate commissions for their referrer when applicable. Requires at
346
+ # least one transaction identifier (externalId, transactionId, orderId, paymentId,
347
+ # invoiceId, paymentIntentId, or chargeId) so repeated requests can be
348
+ # de-duplicated without one, a resent sale would create a second commission.
349
+ # Reuse the same identifier(s) when refunding.
351
350
  #
352
351
  # @overload record_transaction(participant_id_or_email, id:, 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: {})
353
352
  #
@@ -421,9 +420,12 @@ module GrowsurfRuby
421
420
  )
422
421
  end
423
422
 
424
- # Records an amendment (refund, partial refund, refund cancellation, or
425
- # chargeback) against a previously recorded transaction and reverses or adjusts
426
- # the referrer's commission.
423
+ # **Affiliate programs only.** Records an amendment (refund, partial refund,
424
+ # refund cancellation, or chargeback) against a previously recorded transaction
425
+ # and reverses or adjusts the referrer's commission. The inverse of Record
426
+ # Affiliate Transaction. Identify the original transaction with the same
427
+ # identifier(s) you sent when recording it. Commissions already paid out to the
428
+ # affiliate are not clawed back; the amendment is recorded for tax reporting only.
427
429
  #
428
430
  # @overload refund_transaction(participant_id_or_email, id:, 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: {})
429
431
  #
@@ -482,7 +484,7 @@ module GrowsurfRuby
482
484
  end
483
485
 
484
486
  # Sends email invites on behalf of a participant to a list of email addresses.
485
- # Sending invites via the API requires a verified custom email domain on the
487
+ # Sending invites via the API requires a **verified custom email domain** on the
486
488
  # program; the request fails until one is verified.
487
489
  #
488
490
  # @overload send_invites(participant_id_or_email, id:, email_addresses:, message_text:, subject_text:, request_options: {})
@@ -522,7 +524,10 @@ module GrowsurfRuby
522
524
  # details.
523
525
  #
524
526
  # Triggers referral credit for an existing referred participant by GrowSurf
525
- # participant ID or email address.
527
+ # participant ID or email address. Optionally pass `delayInDays` to hold the
528
+ # credit for a number of days before it is awarded (for example, to cover your own
529
+ # refund window). A delayed trigger can be cancelled before it is awarded with the
530
+ # Cancel delayed referral trigger request (DELETE on this same path).
526
531
  #
527
532
  # @overload trigger_referral(participant_id_or_email, id:, delay_in_days: nil, request_options: {})
528
533
  #
@@ -552,8 +557,11 @@ module GrowsurfRuby
552
557
  )
553
558
  end
554
559
 
555
- # Cancels a pending delayed referral trigger for an existing referred participant
556
- # by GrowSurf participant ID or email address.
560
+ # Cancels a pending delayed referral trigger for a participant (the companion to a
561
+ # delayed Trigger referral request). Use this to undo a scheduled referral credit
562
+ # before it is awarded, for example when a refund occurs inside your refund
563
+ # window. If the participant has no pending delayed trigger, `success` is returned
564
+ # as `false`.
557
565
  #
558
566
  # @overload cancel_delayed_referral(participant_id_or_email, id:, request_options: {})
559
567
  #
@@ -580,15 +588,14 @@ module GrowsurfRuby
580
588
  )
581
589
  end
582
590
 
583
- # Sends an email to a participant. Provide EITHER `email_type` to trigger one of the
584
- # program's configured email templates, OR `subject` + `body` for a free-form email.
585
- # Free-form emails are sent with the same compliance handling (company name,
586
- # postal address, and an unsubscribe link are added automatically, and unsubscribed
587
- # participants are suppressed). Sending requires the account to be verified by the
588
- # GrowSurf team. Requires a verified custom email domain on the program (set up
589
- # in Campaign Editor > 3. Emails > Email Settings). Returns `400` until one is
590
- # verified.
591
- # The email is accepted for delivery.
591
+ # Sends an email to a participant. Provide EITHER `emailType` to trigger one of
592
+ # the program's configured email templates, OR `subject` + `body` for a free-form
593
+ # email. Free-form emails are sent with the same compliance handling (company
594
+ # name, postal address, and an unsubscribe link are added automatically, and
595
+ # unsubscribed participants are suppressed). Sending requires the team to be
596
+ # verified by GrowSurf. Requires a **verified custom email domain** on the program
597
+ # (which can be completed in *Campaign Editor > 3. Emails > Email Settings*).
598
+ # Returns `400` until one is verified. The email is accepted for delivery.
592
599
  #
593
600
  # @overload email(participant_id_or_email, id:, body: nil, email_type: nil, preheader: nil, subject: nil, request_options: {})
594
601
  #
@@ -624,7 +631,8 @@ module GrowsurfRuby
624
631
  )
625
632
  end
626
633
 
627
- # Returns a participant's activity logs, most recent first (offset/limit paginated).
634
+ # Returns a participant's activity logs, most recent first (offset/limit
635
+ # paginated).
628
636
  #
629
637
  # @overload list_activity_logs(participant_id_or_email, id:, limit: nil, offset: nil, request_options: {})
630
638
  #
@@ -662,8 +670,9 @@ module GrowsurfRuby
662
670
  # details.
663
671
  #
664
672
  # Retrieves analytics for a single participant — all-time engagement counters,
665
- # leaderboard ranks, and per-channel share counts (plus affiliate money metrics for
666
- # affiliate programs). Useful for segmenting and re-engaging participants.
673
+ # leaderboard ranks, and per-channel share counts (plus affiliate money metrics
674
+ # for affiliate programs). Useful for segmenting and re-engaging participants.
675
+ # Pass `include=series` to also get this participant's own activity over time.
667
676
  #
668
677
  # @overload retrieve_analytics(participant_id_or_email, id:, days: nil, end_date: nil, include: nil, interval: nil, start_date: nil, request_options: {})
669
678
  #
@@ -33,8 +33,9 @@ module GrowsurfRuby
33
33
  )
34
34
  end
35
35
 
36
- # Approves a manually approved reward earned by a participant. Requires
37
- # `reward:write`. Passing `fulfill: true` also requires `reward:fulfill`.
36
+ # Approves a manually approved reward earned by a participant. This requires
37
+ # `reward:write`. When the request also sets `fulfill` to `true`, it additionally
38
+ # requires `reward:fulfill`.
38
39
  #
39
40
  # @overload approve(reward_id, id:, fulfill: nil, request_options: {})
40
41
  #
@@ -64,7 +65,7 @@ module GrowsurfRuby
64
65
  )
65
66
  end
66
67
 
67
- # Marks an approved participant reward as fulfilled. Requires `reward:fulfill`.
68
+ # Marks an approved participant reward as fulfilled.
68
69
  #
69
70
  # @overload fulfill(reward_id, id:, request_options: {})
70
71
  #
@@ -4,7 +4,9 @@ module GrowsurfRuby
4
4
  module Resources
5
5
  class Campaign
6
6
  class Rewards
7
- # Retrieves the rewards configured for a program.
7
+ # Retrieves the list of a program's configured rewards (`CampaignReward`s) — the
8
+ # same set embedded in the `rewards` array of the campaign response. Delete a
9
+ # reward with `DELETE /campaign/{id}/reward-configs/{campaignRewardId}`.
8
10
  #
9
11
  # @overload list(id, request_options: {})
10
12
  #
@@ -22,8 +24,11 @@ module GrowsurfRuby
22
24
  )
23
25
  end
24
26
 
25
- # Creates a reward for a program. The reward `type` must be compatible with the
26
- # program type.
27
+ # Creates a new campaign reward (`CampaignReward`) with a GrowSurf-assigned ID.
28
+ # The reward type must be compatible with the program type (affiliate programs
29
+ # support only `AFFILIATE` rewards; referral programs support all other types).
30
+ # Enabling an active reward of a type automatically enables that reward type on
31
+ # the program.
27
32
  #
28
33
  # @overload create(id, type:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, referred_value: nil, title: nil, value: nil, request_options: {})
29
34
  #
@@ -87,8 +92,11 @@ module GrowsurfRuby
87
92
  )
88
93
  end
89
94
 
90
- # Updates an existing campaign reward. Only the fields you send are changed;
91
- # `type` is immutable and must not be supplied.
95
+ # Updates an existing campaign reward (`CampaignReward`). The reward `type` is
96
+ # immutable and cannot be changed. When the update replaces `metadata`, renamed
97
+ # keys automatically rewrite any `{{campaignReward[…]}}` references in campaign
98
+ # copy; removing a key that campaign copy still references returns a `409` listing
99
+ # the referencing fields.
92
100
  #
93
101
  # @overload update(campaign_reward_id, id:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, referred_value: nil, title: nil, value: nil, request_options: {})
94
102
  #
@@ -156,7 +164,11 @@ module GrowsurfRuby
156
164
  )
157
165
  end
158
166
 
159
- # Deletes a campaign reward.
167
+ # Deletes a campaign reward (`CampaignReward`). The reward is deactivated, removed
168
+ # from the program's reward set, and any connected upfront-discount coupons are
169
+ # cleaned up. If campaign copy still references any of the reward's metadata keys
170
+ # via `{{campaignReward[…]}}` tokens, the delete returns a `409` listing the
171
+ # referencing fields — update those fields first.
160
172
  #
161
173
  # @overload delete(campaign_reward_id, id:, request_options: {})
162
174
  #
@@ -76,10 +76,8 @@ module GrowsurfRuby
76
76
  )
77
77
  end
78
78
 
79
- # Creates a program. Only `type` is required; everything else is
80
- # server-defaulted. Editor-tab configuration (design, emails, options,
81
- # installation) is not accepted here — configure it via the config sub-resources
82
- # (e.g. `campaign.options.update`) after the program is created.
79
+ # Creates a new program, plus any optional program rewards. The new program is
80
+ # created in `DRAFT` status and owned by the API key's bound team.
83
81
  #
84
82
  # @overload create(type:, company_logo_image_url: nil, company_name: nil, currency_iso: nil, name: nil, rewards: nil, request_options: {})
85
83
  #
@@ -111,11 +109,11 @@ module GrowsurfRuby
111
109
  )
112
110
  end
113
111
 
114
- # Updates a program's identity and lifecycle. Only the fields you send are changed.
115
- # `type`, `urlId`, and `currencyISO` are immutable. Editor-tab configuration (design, emails,
116
- # options, installation) is edited via the dedicated config sub-resources
117
- # (`campaign.design`, `campaign.emails`, `campaign.options`, `campaign.installation`),
118
- # not here.
112
+ # Updates a program's identity and lifecycle. Only the fields you send are
113
+ # changed. `type`, `urlId`, and `currencyISO` are immutable. Editor-tab
114
+ # configuration (design, emails, options, installation) is edited via the
115
+ # dedicated config sub-resources, not here. The program cannot be deleted via this
116
+ # endpoint.
119
117
  #
120
118
  # @overload update(id, company_logo_image_url: nil, company_name: nil, name: nil, status: nil, request_options: {})
121
119
  #
@@ -145,7 +143,8 @@ module GrowsurfRuby
145
143
  )
146
144
  end
147
145
 
148
- # Clones an existing program, returning the newly created program.
146
+ # Clones an existing program into a new `DRAFT` program. Integrations and
147
+ # credentials are not copied; active rewards are cloned.
149
148
  #
150
149
  # @overload clone(id, request_options: {})
151
150
  #
@@ -210,7 +209,8 @@ module GrowsurfRuby
210
209
  )
211
210
  end
212
211
 
213
- # Retrieves a paged list of all participant commissions in an affiliate program.
212
+ # **Affiliate programs only.** Retrieves a paged list of all participant
213
+ # commissions in an affiliate program.
214
214
  #
215
215
  # @overload list_commissions(id, limit: nil, next_id: nil, status: nil, request_options: {})
216
216
  #
@@ -301,7 +301,8 @@ module GrowsurfRuby
301
301
  )
302
302
  end
303
303
 
304
- # Retrieves a paged list of all participant payouts in an affiliate program.
304
+ # **Affiliate programs only.** Retrieves a paged list of all participant payouts
305
+ # in an affiliate program.
305
306
  #
306
307
  # @overload list_payouts(id, limit: nil, next_id: nil, status: nil, request_options: {})
307
308
  #
@@ -381,7 +382,9 @@ module GrowsurfRuby
381
382
  # Some parameter documentations has been truncated, see
382
383
  # {GrowsurfRuby::Models::CampaignRetrieveAnalyticsParams} for more details.
383
384
  #
384
- # Retrieves analytics for a program.
385
+ # Retrieves analytics for a program. Pass `interval` to also get a time-series
386
+ # (`series`) alongside the totals, and `include` to add previous-period totals,
387
+ # status breakdowns, or derived rates — useful for detecting trends over time.
385
388
  #
386
389
  # @overload retrieve_analytics(id, days: nil, end_date: nil, include: nil, interval: nil, start_date: nil, request_options: {})
387
390
  #
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Resources
5
+ class Team
6
+ # Retrieves the team bound to the API key or OAuth connection.
7
+ # `verificationStatus` is `VERIFIED` once GrowSurf has verified the team, which is
8
+ # required before a program can send participant emails.
9
+ #
10
+ # @overload retrieve(request_options: {})
11
+ #
12
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
13
+ #
14
+ # @return [GrowsurfRuby::Models::Team]
15
+ def retrieve(params = {})
16
+ @client.request(
17
+ method: :get,
18
+ path: "team",
19
+ model: GrowsurfRuby::Models::Team,
20
+ options: params[:request_options]
21
+ )
22
+ end
23
+
24
+ # Updates the name of the team bound to the API key or OAuth connection. Any other
25
+ # property is rejected with a `400`. Personal profiles, billing, and team
26
+ # ownership are not editable here.
27
+ #
28
+ # @overload update(name:, request_options: {})
29
+ #
30
+ # @param name [String] The team's display name.
31
+ #
32
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
33
+ #
34
+ # @return [GrowsurfRuby::Models::Team]
35
+ #
36
+ # @see GrowsurfRuby::Models::TeamUpdateParams
37
+ def update(params)
38
+ parsed, options = GrowsurfRuby::TeamUpdateParams.dump_request(params)
39
+ @client.request(
40
+ method: :patch,
41
+ path: "team",
42
+ body: parsed,
43
+ model: GrowsurfRuby::Models::Team,
44
+ options: options
45
+ )
46
+ end
47
+
48
+ # Generates a new API key and makes the key used on this request stop working when
49
+ # rotation succeeds. Send a unique, random `Idempotency-Key`. If the response is
50
+ # interrupted, immediately retry with the original API key and the same
51
+ # `Idempotency-Key` to receive the same new key. Update every integration that
52
+ # used the old key. The team owner is notified by email whenever the key is
53
+ # rotated. GrowSurf SDKs generate the idempotency key automatically. This endpoint
54
+ # accepts an API key with `api_key:rotate`. If this scope is unavailable, rotate
55
+ # the key in the authenticated dashboard instead. This operation is available only
56
+ # through the REST API or a GrowSurf API SDK, not through MCP.
57
+ #
58
+ # @overload rotate_api_key(request_options: {})
59
+ #
60
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
61
+ #
62
+ # @return [GrowsurfRuby::Models::TeamRotateAPIKeyResponse]
63
+ def rotate_api_key(params = {})
64
+ @client.request(
65
+ method: :post,
66
+ path: "api-key/rotate",
67
+ model: GrowsurfRuby::Models::TeamRotateAPIKeyResponse,
68
+ options: params[:request_options]
69
+ )
70
+ end
71
+
72
+ # Requests GrowSurf to verify the bound team (required before a program can email
73
+ # its participants). Idempotent — calling it again while a request is pending does
74
+ # not create a duplicate. Returns the team with its updated `verificationStatus`.
75
+ #
76
+ # @overload request_verification(request_options: {})
77
+ #
78
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
79
+ #
80
+ # @return [GrowsurfRuby::Models::Team]
81
+ def request_verification(params = {})
82
+ @client.request(
83
+ method: :post,
84
+ path: "team/verification-request",
85
+ model: GrowsurfRuby::Models::Team,
86
+ options: params[:request_options]
87
+ )
88
+ end
89
+
90
+ # Resends the email-verification message to the bound team's owner. The response
91
+ # never reveals the owner's email address. A `200` with `status: SENT` is returned
92
+ # only when an email was actually dispatched. Returns `400` if the email is
93
+ # already verified, and `429` if a verification email was sent too recently — wait
94
+ # a moment, then retry.
95
+ #
96
+ # @overload resend_owner_verification_email(request_options: {})
97
+ #
98
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
99
+ #
100
+ # @return [GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse]
101
+ def resend_owner_verification_email(params = {})
102
+ @client.request(
103
+ method: :post,
104
+ path: "team/owner/verification-email",
105
+ model: GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse,
106
+ options: params[:request_options]
107
+ )
108
+ end
109
+
110
+ # @api private
111
+ #
112
+ # @param client [GrowsurfRuby::Client]
113
+ def initialize(client:)
114
+ @client = client
115
+ end
116
+ end
117
+ end
118
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrowsurfRuby
4
- VERSION = "1.1.2"
4
+ VERSION = "1.2.1"
5
5
  end
data/lib/growsurf_ruby.rb CHANGED
@@ -110,12 +110,12 @@ require_relative "growsurf_ruby/models/campaign/webhook_list_response"
110
110
  require_relative "growsurf_ruby/models/campaign/webhook_test_params"
111
111
  require_relative "growsurf_ruby/models/campaign/webhook_test_response"
112
112
  require_relative "growsurf_ruby/models/campaign/webhook_update_params"
113
- require_relative "growsurf_ruby/models/account"
114
113
  require_relative "growsurf_ruby/models/account_create_params"
115
114
  require_relative "growsurf_ruby/models/account_create_response"
116
- require_relative "growsurf_ruby/models/account_resend_verification_email_response"
117
- require_relative "growsurf_ruby/models/account_rotate_api_key_response"
118
- require_relative "growsurf_ruby/models/account_update_params"
115
+ require_relative "growsurf_ruby/models/team"
116
+ require_relative "growsurf_ruby/models/team_resend_owner_verification_email_response"
117
+ require_relative "growsurf_ruby/models/team_rotate_api_key_response"
118
+ require_relative "growsurf_ruby/models/team_update_params"
119
119
  require_relative "growsurf_ruby/models/campaign"
120
120
  require_relative "growsurf_ruby/models/campaign_create_mobile_participant_token_params"
121
121
  require_relative "growsurf_ruby/models/campaign_create_mobile_participant_token_response"
@@ -139,6 +139,7 @@ require_relative "growsurf_ruby/models/referral_list"
139
139
  require_relative "growsurf_ruby/models/reward_tax_valuation"
140
140
  require_relative "growsurf_ruby/models"
141
141
  require_relative "growsurf_ruby/resources/account"
142
+ require_relative "growsurf_ruby/resources/team"
142
143
  require_relative "growsurf_ruby/resources/campaign"
143
144
  require_relative "growsurf_ruby/resources/campaign/commission"
144
145
  require_relative "growsurf_ruby/resources/campaign/design"
@@ -11,12 +11,15 @@ module GrowsurfRuby
11
11
  DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float)
12
12
 
13
13
  # GrowSurf REST API key supplied as `Authorization: Bearer <api_key>`.
14
- sig { returns(String) }
14
+ sig { returns(T.nilable(String)) }
15
15
  attr_reader :api_key
16
16
 
17
17
  sig { returns(GrowsurfRuby::Resources::Account) }
18
18
  attr_reader :account
19
19
 
20
+ sig { returns(GrowsurfRuby::Resources::Team) }
21
+ attr_reader :team
22
+
20
23
  sig { returns(GrowsurfRuby::Resources::Campaign) }
21
24
  attr_reader :campaign
22
25
 
@@ -21,10 +21,6 @@ module GrowsurfRuby
21
21
  sig { returns(String) }
22
22
  attr_accessor :email
23
23
 
24
- # The new account's unique identifier.
25
- sig { returns(String) }
26
- attr_accessor :id
27
-
28
24
  # GrowSurf account verification state. `VERIFIED` is required before a program
29
25
  # can send participant emails.
30
26
  sig do
@@ -38,7 +34,6 @@ module GrowsurfRuby
38
34
  params(
39
35
  api_key: String,
40
36
  email: String,
41
- id: String,
42
37
  verification_status:
43
38
  GrowsurfRuby::Models::AccountCreateResponse::VerificationStatus::OrSymbol
44
39
  ).returns(T.attached_class)
@@ -50,8 +45,6 @@ module GrowsurfRuby
50
45
  # dashboard.
51
46
  api_key:,
52
47
  email:,
53
- # The new account's unique identifier.
54
- id:,
55
48
  # GrowSurf account verification state. `VERIFIED` is required before a program
56
49
  # can send participant emails.
57
50
  verification_status:
@@ -63,7 +56,6 @@ module GrowsurfRuby
63
56
  {
64
57
  api_key: String,
65
58
  email: String,
66
- id: String,
67
59
  verification_status:
68
60
  GrowsurfRuby::Models::AccountCreateResponse::VerificationStatus::TaggedSymbol
69
61
  }
@@ -0,0 +1,65 @@
1
+ # typed: strong
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ class Team < GrowsurfRuby::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(GrowsurfRuby::Models::Team, GrowsurfRuby::Internal::AnyHash)
9
+ end
10
+
11
+ sig { returns(String) }
12
+ attr_accessor :name
13
+
14
+ sig do
15
+ returns(GrowsurfRuby::Models::Team::VerificationStatus::TaggedSymbol)
16
+ end
17
+ attr_accessor :verification_status
18
+
19
+ sig { returns(T.nilable(Integer)) }
20
+ attr_accessor :verification_requested_at
21
+
22
+ sig do
23
+ params(
24
+ name: String,
25
+ verification_status:
26
+ GrowsurfRuby::Models::Team::VerificationStatus::OrSymbol,
27
+ verification_requested_at: T.nilable(Integer)
28
+ ).returns(T.attached_class)
29
+ end
30
+ def self.new(name:, verification_status:, verification_requested_at:)
31
+ end
32
+
33
+ sig do
34
+ override.returns(
35
+ {
36
+ name: String,
37
+ verification_status:
38
+ GrowsurfRuby::Models::Team::VerificationStatus::TaggedSymbol,
39
+ verification_requested_at: T.nilable(Integer)
40
+ }
41
+ )
42
+ end
43
+ def to_hash
44
+ end
45
+
46
+ module VerificationStatus
47
+ extend GrowsurfRuby::Internal::Type::Enum
48
+
49
+ TaggedSymbol =
50
+ T.type_alias do
51
+ T.all(Symbol, GrowsurfRuby::Models::Team::VerificationStatus)
52
+ end
53
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
54
+
55
+ NOT_REQUESTED = T.let(:NOT_REQUESTED, TaggedSymbol)
56
+ REQUESTED = T.let(:REQUESTED, TaggedSymbol)
57
+ VERIFIED = T.let(:VERIFIED, TaggedSymbol)
58
+
59
+ sig { override.returns(T::Array[TaggedSymbol]) }
60
+ def self.values
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -2,18 +2,18 @@
2
2
 
3
3
  module GrowsurfRuby
4
4
  module Models
5
- class AccountResendVerificationEmailResponse < GrowsurfRuby::Internal::Type::BaseModel
5
+ class TeamResendOwnerVerificationEmailResponse < GrowsurfRuby::Internal::Type::BaseModel
6
6
  OrHash =
7
7
  T.type_alias do
8
8
  T.any(
9
- GrowsurfRuby::Models::AccountResendVerificationEmailResponse,
9
+ GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse,
10
10
  GrowsurfRuby::Internal::AnyHash
11
11
  )
12
12
  end
13
13
 
14
14
  sig do
15
15
  returns(
16
- GrowsurfRuby::Models::AccountResendVerificationEmailResponse::Status::TaggedSymbol
16
+ GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse::Status::TaggedSymbol
17
17
  )
18
18
  end
19
19
  attr_accessor :status
@@ -24,7 +24,7 @@ module GrowsurfRuby
24
24
  sig do
25
25
  params(
26
26
  status:
27
- GrowsurfRuby::Models::AccountResendVerificationEmailResponse::Status::OrSymbol,
27
+ GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse::Status::OrSymbol,
28
28
  success: T::Boolean
29
29
  ).returns(T.attached_class)
30
30
  end
@@ -35,7 +35,7 @@ module GrowsurfRuby
35
35
  override.returns(
36
36
  {
37
37
  status:
38
- GrowsurfRuby::Models::AccountResendVerificationEmailResponse::Status::TaggedSymbol,
38
+ GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse::Status::TaggedSymbol,
39
39
  success: T::Boolean
40
40
  }
41
41
  )
@@ -50,24 +50,14 @@ module GrowsurfRuby
50
50
  T.type_alias do
51
51
  T.all(
52
52
  Symbol,
53
- GrowsurfRuby::Models::AccountResendVerificationEmailResponse::Status
53
+ GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse::Status
54
54
  )
55
55
  end
56
56
  OrSymbol = T.type_alias { T.any(Symbol, String) }
57
57
 
58
- SENT =
59
- T.let(
60
- :SENT,
61
- GrowsurfRuby::Models::AccountResendVerificationEmailResponse::Status::TaggedSymbol
62
- )
58
+ SENT = T.let(:SENT, TaggedSymbol)
63
59
 
64
- sig do
65
- override.returns(
66
- T::Array[
67
- GrowsurfRuby::Models::AccountResendVerificationEmailResponse::Status::TaggedSymbol
68
- ]
69
- )
70
- end
60
+ sig { override.returns(T::Array[TaggedSymbol]) }
71
61
  def self.values
72
62
  end
73
63
  end