growsurf-ruby 0.8.0 → 1.1.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 (151) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/README.md +1 -1
  4. data/lib/growsurf_ruby/client.rb +4 -0
  5. data/lib/growsurf_ruby/models/account.rb +90 -0
  6. data/lib/growsurf_ruby/models/account_create_params.rb +46 -0
  7. data/lib/growsurf_ruby/models/account_create_response.rb +64 -0
  8. data/lib/growsurf_ruby/models/account_resend_verification_email_response.rb +33 -0
  9. data/lib/growsurf_ruby/models/account_rotate_api_key_response.rb +17 -0
  10. data/lib/growsurf_ruby/models/account_update_params.rb +35 -0
  11. data/lib/growsurf_ruby/models/campaign/campaign_reward_list_response.rb +2 -2
  12. data/lib/growsurf_ruby/models/campaign/create.rb +5 -1
  13. data/lib/growsurf_ruby/models/campaign/participant_activity_logs_response.rb +65 -0
  14. data/lib/growsurf_ruby/models/campaign/participant_analytics_response.rb +421 -0
  15. data/lib/growsurf_ruby/models/campaign/participant_bulk_delete_params.rb +35 -0
  16. data/lib/growsurf_ruby/models/campaign/participant_bulk_delete_response.rb +151 -0
  17. data/lib/growsurf_ruby/models/campaign/participant_email_params.rb +76 -0
  18. data/lib/growsurf_ruby/models/campaign/participant_email_response.rb +38 -0
  19. data/lib/growsurf_ruby/models/campaign/participant_list_activity_logs_params.rb +46 -0
  20. data/lib/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rb +98 -0
  21. data/lib/growsurf_ruby/models/campaign/participant_update_params.rb +21 -1
  22. data/lib/growsurf_ruby/models/campaign/reward.rb +43 -5
  23. data/lib/growsurf_ruby/models/campaign/reward_create_params.rb +48 -15
  24. data/lib/growsurf_ruby/models/campaign/reward_delete_params.rb +4 -4
  25. data/lib/growsurf_ruby/models/campaign/reward_update_params.rb +51 -18
  26. data/lib/growsurf_ruby/models/campaign/webhook.rb +72 -0
  27. data/lib/growsurf_ruby/models/campaign/webhook_create_params.rb +52 -0
  28. data/lib/growsurf_ruby/models/campaign/webhook_delete_params.rb +28 -0
  29. data/lib/growsurf_ruby/models/campaign/webhook_delete_response.rb +24 -0
  30. data/lib/growsurf_ruby/models/campaign/webhook_event.rb +23 -0
  31. data/lib/growsurf_ruby/models/campaign/webhook_list_response.rb +18 -0
  32. data/lib/growsurf_ruby/models/campaign/webhook_test_params.rb +42 -0
  33. data/lib/growsurf_ruby/models/campaign/webhook_test_response.rb +50 -0
  34. data/lib/growsurf_ruby/models/campaign/webhook_update_params.rb +59 -0
  35. data/lib/growsurf_ruby/models/campaign.rb +43 -5
  36. data/lib/growsurf_ruby/models/campaign_create_params.rb +1 -15
  37. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_params.rb +36 -1
  38. data/lib/growsurf_ruby/models/campaign_retrieve_analytics_response.rb +538 -1
  39. data/lib/growsurf_ruby/models/campaign_update_params.rb +1 -53
  40. data/lib/growsurf_ruby/models/commission_structure.rb +8 -2
  41. data/lib/growsurf_ruby/models/referral_flow_screenshots_response.rb +72 -0
  42. data/lib/growsurf_ruby/models/reward_tax_valuation.rb +35 -0
  43. data/lib/growsurf_ruby/models.rb +10 -0
  44. data/lib/growsurf_ruby/resources/account.rb +159 -0
  45. data/lib/growsurf_ruby/resources/campaign/design.rb +68 -0
  46. data/lib/growsurf_ruby/resources/campaign/emails.rb +66 -0
  47. data/lib/growsurf_ruby/resources/campaign/installation.rb +67 -0
  48. data/lib/growsurf_ruby/resources/campaign/options.rb +66 -0
  49. data/lib/growsurf_ruby/resources/campaign/participant.rb +170 -2
  50. data/lib/growsurf_ruby/resources/campaign/rewards.rb +36 -32
  51. data/lib/growsurf_ruby/resources/campaign/webhooks.rb +157 -0
  52. data/lib/growsurf_ruby/resources/campaign.rb +62 -27
  53. data/lib/growsurf_ruby/version.rb +1 -1
  54. data/lib/growsurf_ruby.rb +31 -0
  55. data/rbi/growsurf_ruby/client.rbi +3 -0
  56. data/rbi/growsurf_ruby/models/account.rbi +125 -0
  57. data/rbi/growsurf_ruby/models/account_create_params.rbi +73 -0
  58. data/rbi/growsurf_ruby/models/account_create_response.rbi +115 -0
  59. data/rbi/growsurf_ruby/models/account_resend_verification_email_response.rbi +76 -0
  60. data/rbi/growsurf_ruby/models/account_rotate_api_key_response.rbi +30 -0
  61. data/rbi/growsurf_ruby/models/account_update_params.rbi +65 -0
  62. data/rbi/growsurf_ruby/models/campaign/campaign_reward_list_response.rbi +2 -2
  63. data/rbi/growsurf_ruby/models/campaign/create.rbi +8 -0
  64. data/rbi/growsurf_ruby/models/campaign/participant_activity_logs_response.rbi +111 -0
  65. data/rbi/growsurf_ruby/models/campaign/participant_analytics_response.rbi +630 -0
  66. data/rbi/growsurf_ruby/models/campaign/participant_bulk_delete_params.rbi +56 -0
  67. data/rbi/growsurf_ruby/models/campaign/participant_bulk_delete_response.rbi +285 -0
  68. data/rbi/growsurf_ruby/models/campaign/participant_email_params.rbi +118 -0
  69. data/rbi/growsurf_ruby/models/campaign/participant_email_response.rbi +84 -0
  70. data/rbi/growsurf_ruby/models/campaign/participant_list_activity_logs_params.rbi +74 -0
  71. data/rbi/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbi +207 -0
  72. data/rbi/growsurf_ruby/models/campaign/participant_update_params.rbi +24 -0
  73. data/rbi/growsurf_ruby/models/campaign/reward.rbi +63 -3
  74. data/rbi/growsurf_ruby/models/campaign/reward_create_params.rbi +62 -9
  75. data/rbi/growsurf_ruby/models/campaign/reward_delete_params.rbi +4 -4
  76. data/rbi/growsurf_ruby/models/campaign/reward_update_params.rbi +66 -13
  77. data/rbi/growsurf_ruby/models/campaign/webhook.rbi +93 -0
  78. data/rbi/growsurf_ruby/models/campaign/webhook_create_params.rbi +91 -0
  79. data/rbi/growsurf_ruby/models/campaign/webhook_delete_params.rbi +48 -0
  80. data/rbi/growsurf_ruby/models/campaign/webhook_delete_response.rbi +33 -0
  81. data/rbi/growsurf_ruby/models/campaign/webhook_event.rbi +60 -0
  82. data/rbi/growsurf_ruby/models/campaign/webhook_list_response.rbi +36 -0
  83. data/rbi/growsurf_ruby/models/campaign/webhook_test_params.rbi +69 -0
  84. data/rbi/growsurf_ruby/models/campaign/webhook_test_response.rbi +102 -0
  85. data/rbi/growsurf_ruby/models/campaign/webhook_update_params.rbi +98 -0
  86. data/rbi/growsurf_ruby/models/campaign.rbi +63 -3
  87. data/rbi/growsurf_ruby/models/campaign_create_params.rbi +0 -18
  88. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_params.rbi +91 -0
  89. data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_response.rbi +1011 -3
  90. data/rbi/growsurf_ruby/models/campaign_update_params.rbi +0 -78
  91. data/rbi/growsurf_ruby/models/commission_structure.rbi +8 -2
  92. data/rbi/growsurf_ruby/models/referral_flow_screenshots_response.rbi +94 -0
  93. data/rbi/growsurf_ruby/models/reward_tax_valuation.rbi +56 -0
  94. data/rbi/growsurf_ruby/models.rbi +11 -0
  95. data/rbi/growsurf_ruby/resources/account.rbi +112 -0
  96. data/rbi/growsurf_ruby/resources/campaign/design.rbi +52 -0
  97. data/rbi/growsurf_ruby/resources/campaign/emails.rbi +51 -0
  98. data/rbi/growsurf_ruby/resources/campaign/installation.rbi +53 -0
  99. data/rbi/growsurf_ruby/resources/campaign/options.rbi +51 -0
  100. data/rbi/growsurf_ruby/resources/campaign/participant.rbi +160 -0
  101. data/rbi/growsurf_ruby/resources/campaign/rewards.rbi +61 -29
  102. data/rbi/growsurf_ruby/resources/campaign/webhooks.rbi +123 -0
  103. data/rbi/growsurf_ruby/resources/campaign.rbi +58 -32
  104. data/sig/growsurf_ruby/client.rbs +2 -0
  105. data/sig/growsurf_ruby/models/account.rbs +67 -0
  106. data/sig/growsurf_ruby/models/account_create_params.rbs +42 -0
  107. data/sig/growsurf_ruby/models/account_create_response.rbs +47 -0
  108. data/sig/growsurf_ruby/models/account_resend_verification_email_response.rbs +35 -0
  109. data/sig/growsurf_ruby/models/account_rotate_api_key_response.rbs +13 -0
  110. data/sig/growsurf_ruby/models/account_update_params.rbs +42 -0
  111. data/sig/growsurf_ruby/models/campaign/participant_activity_logs_response.rbs +59 -0
  112. data/sig/growsurf_ruby/models/campaign/participant_analytics_response.rbs +407 -0
  113. data/sig/growsurf_ruby/models/campaign/participant_bulk_delete_params.rbs +30 -0
  114. data/sig/growsurf_ruby/models/campaign/participant_bulk_delete_response.rbs +125 -0
  115. data/sig/growsurf_ruby/models/campaign/participant_email_params.rbs +61 -0
  116. data/sig/growsurf_ruby/models/campaign/participant_email_response.rbs +37 -0
  117. data/sig/growsurf_ruby/models/campaign/participant_list_activity_logs_params.rbs +47 -0
  118. data/sig/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbs +90 -0
  119. data/sig/growsurf_ruby/models/campaign/participant_update_params.rbs +14 -0
  120. data/sig/growsurf_ruby/models/campaign/reward.rbs +18 -3
  121. data/sig/growsurf_ruby/models/campaign/reward_create_params.rbs +19 -8
  122. data/sig/growsurf_ruby/models/campaign/reward_delete_params.rbs +4 -4
  123. data/sig/growsurf_ruby/models/campaign/reward_update_params.rbs +23 -12
  124. data/sig/growsurf_ruby/models/campaign/webhook.rbs +52 -0
  125. data/sig/growsurf_ruby/models/campaign/webhook_create_params.rbs +51 -0
  126. data/sig/growsurf_ruby/models/campaign/webhook_delete_params.rbs +30 -0
  127. data/sig/growsurf_ruby/models/campaign/webhook_delete_response.rbs +17 -0
  128. data/sig/growsurf_ruby/models/campaign/webhook_event.rbs +28 -0
  129. data/sig/growsurf_ruby/models/campaign/webhook_list_response.rbs +18 -0
  130. data/sig/growsurf_ruby/models/campaign/webhook_test_params.rbs +42 -0
  131. data/sig/growsurf_ruby/models/campaign/webhook_test_response.rbs +54 -0
  132. data/sig/growsurf_ruby/models/campaign/webhook_update_params.rbs +63 -0
  133. data/sig/growsurf_ruby/models/campaign.rbs +18 -3
  134. data/sig/growsurf_ruby/models/campaign_create_params.rbs +0 -14
  135. data/sig/growsurf_ruby/models/campaign_retrieve_analytics_params.rbs +35 -1
  136. data/sig/growsurf_ruby/models/campaign_retrieve_analytics_response.rbs +533 -3
  137. data/sig/growsurf_ruby/models/campaign_update_params.rbs +1 -53
  138. data/sig/growsurf_ruby/models/commission_structure.rbs +7 -2
  139. data/sig/growsurf_ruby/models/referral_flow_screenshots_response.rbs +54 -0
  140. data/sig/growsurf_ruby/models/reward_tax_valuation.rbs +22 -0
  141. data/sig/growsurf_ruby/models.rbs +10 -0
  142. data/sig/growsurf_ruby/resources/account.rbs +38 -0
  143. data/sig/growsurf_ruby/resources/campaign/design.rbs +20 -0
  144. data/sig/growsurf_ruby/resources/campaign/emails.rbs +20 -0
  145. data/sig/growsurf_ruby/resources/campaign/installation.rbs +20 -0
  146. data/sig/growsurf_ruby/resources/campaign/options.rbs +20 -0
  147. data/sig/growsurf_ruby/resources/campaign/participant.rbs +37 -0
  148. data/sig/growsurf_ruby/resources/campaign/rewards.rbs +6 -4
  149. data/sig/growsurf_ruby/resources/campaign/webhooks.rbs +46 -0
  150. data/sig/growsurf_ruby/resources/campaign.rbs +17 -9
  151. metadata +95 -2
@@ -33,7 +33,7 @@ module GrowsurfRuby
33
33
 
34
34
  # Updates a participant by GrowSurf participant ID or email address.
35
35
  #
36
- # @overload update(participant_id_or_email, id:, email: nil, first_name: nil, last_name: nil, metadata: nil, referral_status: nil, referred_by: nil, unsubscribed: nil, vanity_keys: nil, request_options: {})
36
+ # @overload update(participant_id_or_email, id:, email: nil, first_name: nil, last_name: nil, metadata: nil, notes: nil, paypal_email: nil, referral_status: nil, referred_by: nil, unsubscribed: nil, vanity_keys: nil, request_options: {})
37
37
  #
38
38
  # @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
39
39
  #
@@ -47,6 +47,10 @@ module GrowsurfRuby
47
47
  #
48
48
  # @param metadata [Hash{Symbol=>Object}] Body param: Shallow custom metadata object.
49
49
  #
50
+ # @param notes [String] Body param: Freeform internal notes about the participant (internal only, never ex
51
+ #
52
+ # @param paypal_email [String] Body param: The participant's PayPal email address, used for affiliate payouts.
53
+ #
50
54
  # @param referral_status [Symbol, GrowsurfRuby::Models::Campaign::ParticipantUpdateParams::ReferralStatus] Body param
51
55
  #
52
56
  # @param referred_by [String] Body param
@@ -102,6 +106,39 @@ module GrowsurfRuby
102
106
  )
103
107
  end
104
108
 
109
+ # Some parameter documentations has been truncated, see
110
+ # {GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteParams} for more details.
111
+ #
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.
119
+ #
120
+ # @overload bulk_delete(id, participants:, request_options: {})
121
+ #
122
+ # @param id [String] GrowSurf program ID.
123
+ #
124
+ # @param participants [Array<String>] GrowSurf participant IDs and/or email addresses to delete. Mixed entries are al
125
+ #
126
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
127
+ #
128
+ # @return [GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteResponse]
129
+ #
130
+ # @see GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteParams
131
+ def bulk_delete(id, params)
132
+ parsed, options = GrowsurfRuby::Campaign::ParticipantBulkDeleteParams.dump_request(params)
133
+ @client.request(
134
+ method: :post,
135
+ path: ["campaign/%1$s/participants/bulk-delete", id],
136
+ body: parsed,
137
+ model: GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteResponse,
138
+ options: options
139
+ )
140
+ end
141
+
105
142
  # Some parameter documentations has been truncated, see
106
143
  # {GrowsurfRuby::Models::Campaign::ParticipantAddParams} for more details.
107
144
  #
@@ -126,7 +163,7 @@ module GrowsurfRuby
126
163
  #
127
164
  # @param mobile_instance_id [String] Optional app-install scoped identifier for native mobile anti-fraud. Recommended
128
165
  #
129
- # @param referral_status [Symbol, GrowsurfRuby::Models::Campaign::Create::ReferralStatus]
166
+ # @param referral_status [Symbol, GrowsurfRuby::Models::Campaign::Create::ReferralStatus] The referral credit status; only meaningful when `referred_by` resolves to a ref
130
167
  #
131
168
  # @param referred_by [String] Referrer participant ID or email address.
132
169
  #
@@ -305,6 +342,13 @@ module GrowsurfRuby
305
342
  # Records a sale made by a referred customer and generates affiliate commissions
306
343
  # for their referrer when applicable.
307
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.
351
+ #
308
352
  # @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: {})
309
353
  #
310
354
  # @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
@@ -438,6 +482,8 @@ module GrowsurfRuby
438
482
  end
439
483
 
440
484
  # 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
486
+ # program; the request fails until one is verified.
441
487
  #
442
488
  # @overload send_invites(participant_id_or_email, id:, email_addresses:, message_text:, subject_text:, request_options: {})
443
489
  #
@@ -534,6 +580,128 @@ module GrowsurfRuby
534
580
  )
535
581
  end
536
582
 
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.
592
+ #
593
+ # @overload email(participant_id_or_email, id:, body: nil, email_type: nil, preheader: nil, subject: nil, request_options: {})
594
+ #
595
+ # @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
596
+ #
597
+ # @param id [String] Path param: GrowSurf program ID.
598
+ #
599
+ # @param body [String] Body param: HTML body for a free-form email. You can personalize it with dynamic text, inserting `{{...}}` tokens like `{{firstName}}` or `{{shareUrl}}`. See [Guide to using dynamic text in GrowSurf emails](https://support.growsurf.com/article/213-guide-to-using-dynamic-text-in-growsurf-emails).
600
+ #
601
+ # @param email_type [String] Body param: The program email template to send (template mode). Send the camelCase
602
+ #
603
+ # @param preheader [String] Body param: Optional preheader text for a free-form email.
604
+ #
605
+ # @param subject [String] Body param: Subject line for a free-form email. Supports dynamic text (`{{...}}` tokens), the same as the body.
606
+ #
607
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
608
+ #
609
+ # @return [GrowsurfRuby::Models::Campaign::ParticipantEmailResponse]
610
+ #
611
+ # @see GrowsurfRuby::Models::Campaign::ParticipantEmailParams
612
+ def email(participant_id_or_email, params)
613
+ parsed, options = GrowsurfRuby::Campaign::ParticipantEmailParams.dump_request(params)
614
+ id =
615
+ parsed.delete(:id) do
616
+ raise ArgumentError.new("missing required path argument #{_1}")
617
+ end
618
+ @client.request(
619
+ method: :post,
620
+ path: ["campaign/%1$s/participant/%2$s/email", id, participant_id_or_email],
621
+ body: parsed,
622
+ model: GrowsurfRuby::Models::Campaign::ParticipantEmailResponse,
623
+ options: options
624
+ )
625
+ end
626
+
627
+ # Returns a participant's activity logs, most recent first (offset/limit paginated).
628
+ #
629
+ # @overload list_activity_logs(participant_id_or_email, id:, limit: nil, offset: nil, request_options: {})
630
+ #
631
+ # @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
632
+ #
633
+ # @param id [String] Path param: GrowSurf program ID.
634
+ #
635
+ # @param limit [Integer] Query param: Number of logs to return (1–100, default 20).
636
+ #
637
+ # @param offset [Integer] Query param: Number of logs to skip.
638
+ #
639
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
640
+ #
641
+ # @return [GrowsurfRuby::Models::Campaign::ParticipantActivityLogsResponse]
642
+ #
643
+ # @see GrowsurfRuby::Models::Campaign::ParticipantListActivityLogsParams
644
+ def list_activity_logs(participant_id_or_email, params)
645
+ parsed, options = GrowsurfRuby::Campaign::ParticipantListActivityLogsParams.dump_request(params)
646
+ query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
647
+ id =
648
+ parsed.delete(:id) do
649
+ raise ArgumentError.new("missing required path argument #{_1}")
650
+ end
651
+ @client.request(
652
+ method: :get,
653
+ path: ["campaign/%1$s/participant/%2$s/activity-logs", id, participant_id_or_email],
654
+ query: query,
655
+ model: GrowsurfRuby::Models::Campaign::ParticipantActivityLogsResponse,
656
+ options: options
657
+ )
658
+ end
659
+
660
+ # Some parameter documentations has been truncated, see
661
+ # {GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams} for more
662
+ # details.
663
+ #
664
+ # 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.
667
+ #
668
+ # @overload retrieve_analytics(participant_id_or_email, id:, days: nil, end_date: nil, include: nil, interval: nil, start_date: nil, request_options: {})
669
+ #
670
+ # @param participant_id_or_email [String] GrowSurf participant ID or URL-encoded participant email address.
671
+ #
672
+ # @param id [String] GrowSurf program ID.
673
+ #
674
+ # @param days [Integer] Last number of days to retrieve analytics for. Defaults to 365. Maximum 1825.
675
+ #
676
+ # @param end_date [Integer] End date of the analytics timeframe as a Unix timestamp in milliseconds. Require
677
+ #
678
+ # @param include [Symbol, GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams::Include] Set to `series` to also return this participant's own activity per period.
679
+ #
680
+ # @param interval [Symbol, GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams::Interval] Bucket size for the `series` (only used with `include=series`). Defaults to `day`.
681
+ #
682
+ # @param start_date [Integer] Start date of the analytics timeframe as a Unix timestamp in milliseconds. Requi
683
+ #
684
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
685
+ #
686
+ # @return [GrowsurfRuby::Models::Campaign::ParticipantAnalyticsResponse]
687
+ #
688
+ # @see GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams
689
+ def retrieve_analytics(participant_id_or_email, params)
690
+ parsed, options = GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams.dump_request(params)
691
+ id =
692
+ parsed.delete(:id) do
693
+ raise ArgumentError.new("missing required path argument #{_1}")
694
+ end
695
+ query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
696
+ @client.request(
697
+ method: :get,
698
+ path: ["campaign/%1$s/participant/%2$s/analytics", id, participant_id_or_email],
699
+ query: query.transform_keys(end_date: "endDate", start_date: "startDate"),
700
+ model: GrowsurfRuby::Models::Campaign::ParticipantAnalyticsResponse,
701
+ options: options
702
+ )
703
+ end
704
+
537
705
  # @api private
538
706
  #
539
707
  # @param client [GrowsurfRuby::Client]
@@ -4,7 +4,7 @@ module GrowsurfRuby
4
4
  module Resources
5
5
  class Campaign
6
6
  class Rewards
7
- # Retrieves the active, visible, and enabled rewards configured for a program.
7
+ # Retrieves the rewards configured for a program.
8
8
  #
9
9
  # @overload list(id, request_options: {})
10
10
  #
@@ -16,7 +16,7 @@ module GrowsurfRuby
16
16
  def list(id, params = {})
17
17
  @client.request(
18
18
  method: :get,
19
- path: ["campaign/%1$s/rewards", id],
19
+ path: ["campaign/%1$s/reward-configs", id],
20
20
  model: GrowsurfRuby::Models::Campaign::CampaignRewardListResponse,
21
21
  options: params[:request_options]
22
22
  )
@@ -25,7 +25,7 @@ module GrowsurfRuby
25
25
  # Creates a reward for a program. The reward `type` must be compatible with the
26
26
  # program type.
27
27
  #
28
- # @overload create(id, type:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_active: 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, title: nil, request_options: {})
28
+ # @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
29
  #
30
30
  # @param id [String] Path param: GrowSurf program ID.
31
31
  #
@@ -35,17 +35,15 @@ module GrowsurfRuby
35
35
  #
36
36
  # @param conversions_required [Integer] Body param
37
37
  #
38
- # @param coupon_code [String] Body param
38
+ # @param coupon_code [String] Body param: Legacy static coupon code shown to the referrer in the reward-won emai
39
39
  #
40
40
  # @param description [String] Body param
41
41
  #
42
42
  # @param image_url [String] Body param
43
43
  #
44
- # @param is_active [Boolean] Body param
44
+ # @param is_unlimited [Boolean] Body param: Whether the reward can be earned an unlimited number of times. Defaul
45
45
  #
46
- # @param is_unlimited [Boolean] Body param
47
- #
48
- # @param is_visible [Boolean] Body param
46
+ # @param is_visible [Boolean] Body param: Whether the reward is enabled. When `false` the reward is disabled: hi
49
47
  #
50
48
  # @param limit [Integer] Body param
51
49
  #
@@ -53,22 +51,26 @@ module GrowsurfRuby
53
51
  #
54
52
  # @param metadata [Hash{Symbol=>Object}] Body param: Custom key/value metadata (single-level; values are stored as string
55
53
  #
56
- # @param next_milestone_prefix [String] Body param
54
+ # @param next_milestone_prefix [String] Body param: Text shown before a participant's referral count in milestone-prog
57
55
  #
58
- # @param next_milestone_suffix [String] Body param
56
+ # @param next_milestone_suffix [String] Body param: Text shown after a participant's referral count in milestone-progr
59
57
  #
60
- # @param number_of_winners [Integer] Body param
58
+ # @param number_of_winners [Integer] Body param: The number of winners (`LEADERBOARD` rewards only). With `limitDur
61
59
  #
62
60
  # @param order [Integer] Body param
63
61
  #
64
- # @param referral_coupon_code [String] Body param
62
+ # @param referral_coupon_code [String] Body param: Legacy static coupon code shown to the referred friend (double-si
65
63
  #
66
64
  # @param referral_description [String] Body param
67
65
  #
68
66
  # @param referred_reward_upfront [Boolean] Body param
69
67
  #
68
+ # @param referred_value [GrowsurfRuby::Models::RewardTaxValuation] Body param: Tax valuation for the referred friend's side of a double-sided rewa
69
+ #
70
70
  # @param title [String] Body param
71
71
  #
72
+ # @param value [GrowsurfRuby::Models::RewardTaxValuation] Body param: Tax valuation for the reward (the referrer's side of a double-sided
73
+ #
72
74
  # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
73
75
  #
74
76
  # @return [GrowsurfRuby::Models::Campaign::Reward]
@@ -78,19 +80,19 @@ module GrowsurfRuby
78
80
  parsed, options = GrowsurfRuby::Campaign::RewardCreateParams.dump_request(params)
79
81
  @client.request(
80
82
  method: :post,
81
- path: ["campaign/%1$s/rewards", id],
83
+ path: ["campaign/%1$s/reward-configs", id],
82
84
  body: parsed,
83
85
  model: GrowsurfRuby::Models::Campaign::Reward,
84
86
  options: options
85
87
  )
86
88
  end
87
89
 
88
- # Updates an existing program reward. Only the fields you send are changed;
90
+ # Updates an existing campaign reward. Only the fields you send are changed;
89
91
  # `type` is immutable and must not be supplied.
90
92
  #
91
- # @overload update(reward_id, id:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_active: 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, title: nil, request_options: {})
93
+ # @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: {})
92
94
  #
93
- # @param reward_id [String] Path param: Program reward ID.
95
+ # @param campaign_reward_id [String] Path param: Campaign reward ID.
94
96
  #
95
97
  # @param id [String] Path param: GrowSurf program ID.
96
98
  #
@@ -98,17 +100,15 @@ module GrowsurfRuby
98
100
  #
99
101
  # @param conversions_required [Integer] Body param
100
102
  #
101
- # @param coupon_code [String] Body param
103
+ # @param coupon_code [String] Body param: Legacy static coupon code shown to the referrer in the reward-won emai
102
104
  #
103
105
  # @param description [String] Body param
104
106
  #
105
107
  # @param image_url [String] Body param
106
108
  #
107
- # @param is_active [Boolean] Body param
109
+ # @param is_unlimited [Boolean] Body param: Whether the reward can be earned an unlimited number of times. Defaul
108
110
  #
109
- # @param is_unlimited [Boolean] Body param
110
- #
111
- # @param is_visible [Boolean] Body param
111
+ # @param is_visible [Boolean] Body param: Whether the reward is enabled. When `false` the reward is disabled: hi
112
112
  #
113
113
  # @param limit [Integer] Body param
114
114
  #
@@ -116,28 +116,32 @@ module GrowsurfRuby
116
116
  #
117
117
  # @param metadata [Hash{Symbol=>Object}] Body param: Custom key/value metadata (single-level; values are stored as string
118
118
  #
119
- # @param next_milestone_prefix [String] Body param
119
+ # @param next_milestone_prefix [String] Body param: Text shown before a participant's referral count in milestone-prog
120
120
  #
121
- # @param next_milestone_suffix [String] Body param
121
+ # @param next_milestone_suffix [String] Body param: Text shown after a participant's referral count in milestone-progr
122
122
  #
123
- # @param number_of_winners [Integer] Body param
123
+ # @param number_of_winners [Integer] Body param: The number of winners (`LEADERBOARD` rewards only). With `limitDur
124
124
  #
125
125
  # @param order [Integer] Body param
126
126
  #
127
- # @param referral_coupon_code [String] Body param
127
+ # @param referral_coupon_code [String] Body param: Legacy static coupon code shown to the referred friend (double-si
128
128
  #
129
129
  # @param referral_description [String] Body param
130
130
  #
131
131
  # @param referred_reward_upfront [Boolean] Body param
132
132
  #
133
+ # @param referred_value [GrowsurfRuby::Models::RewardTaxValuation] Body param: Tax valuation for the referred friend's side of a double-sided rewa
134
+ #
133
135
  # @param title [String] Body param
134
136
  #
137
+ # @param value [GrowsurfRuby::Models::RewardTaxValuation] Body param: Tax valuation for the reward (the referrer's side of a double-sided
138
+ #
135
139
  # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
136
140
  #
137
141
  # @return [GrowsurfRuby::Models::Campaign::Reward]
138
142
  #
139
143
  # @see GrowsurfRuby::Models::Campaign::RewardUpdateParams
140
- def update(reward_id, params)
144
+ def update(campaign_reward_id, params)
141
145
  parsed, options = GrowsurfRuby::Campaign::RewardUpdateParams.dump_request(params)
142
146
  id =
143
147
  parsed.delete(:id) do
@@ -145,18 +149,18 @@ module GrowsurfRuby
145
149
  end
146
150
  @client.request(
147
151
  method: :patch,
148
- path: ["campaign/%1$s/rewards/%2$s", id, reward_id],
152
+ path: ["campaign/%1$s/reward-configs/%2$s", id, campaign_reward_id],
149
153
  body: parsed,
150
154
  model: GrowsurfRuby::Models::Campaign::Reward,
151
155
  options: options
152
156
  )
153
157
  end
154
158
 
155
- # Deletes a program reward.
159
+ # Deletes a campaign reward.
156
160
  #
157
- # @overload delete(reward_id, id:, request_options: {})
161
+ # @overload delete(campaign_reward_id, id:, request_options: {})
158
162
  #
159
- # @param reward_id [String] Program reward ID.
163
+ # @param campaign_reward_id [String] Campaign reward ID.
160
164
  #
161
165
  # @param id [String] GrowSurf program ID.
162
166
  #
@@ -165,7 +169,7 @@ module GrowsurfRuby
165
169
  # @return [GrowsurfRuby::Models::Campaign::DeleteRewardResponse]
166
170
  #
167
171
  # @see GrowsurfRuby::Models::Campaign::RewardDeleteParams
168
- def delete(reward_id, params)
172
+ def delete(campaign_reward_id, params)
169
173
  parsed, options = GrowsurfRuby::Campaign::RewardDeleteParams.dump_request(params)
170
174
  id =
171
175
  parsed.delete(:id) do
@@ -173,7 +177,7 @@ module GrowsurfRuby
173
177
  end
174
178
  @client.request(
175
179
  method: :delete,
176
- path: ["campaign/%1$s/rewards/%2$s", id, reward_id],
180
+ path: ["campaign/%1$s/reward-configs/%2$s", id, campaign_reward_id],
177
181
  model: GrowsurfRuby::Models::Campaign::DeleteRewardResponse,
178
182
  options: options
179
183
  )
@@ -0,0 +1,157 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Resources
5
+ class Campaign
6
+ class Webhooks
7
+ # Lists a program's webhooks (secrets are never returned).
8
+ #
9
+ # @overload list(id, request_options: {})
10
+ #
11
+ # @param id [String] GrowSurf program ID.
12
+ #
13
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
14
+ #
15
+ # @return [GrowsurfRuby::Models::Campaign::WebhookListResponse]
16
+ def list(id, params = {})
17
+ @client.request(
18
+ method: :get,
19
+ path: ["campaign/%1$s/webhooks", id],
20
+ model: GrowsurfRuby::Models::Campaign::WebhookListResponse,
21
+ options: params[:request_options]
22
+ )
23
+ end
24
+
25
+ # Adds a webhook to the program.
26
+ #
27
+ # @overload create(id, payload_url:, events: nil, is_enabled: nil, secret: nil, request_options: {})
28
+ #
29
+ # @param id [String] Path param: GrowSurf program ID.
30
+ #
31
+ # @param payload_url [String] Body param: The URL that receives webhook deliveries.
32
+ #
33
+ # @param events [Array<Symbol, GrowsurfRuby::Models::Campaign::WebhookEvent>] Body param: The events this webhook is subscribed to. When omitted, it is subscri
34
+ #
35
+ # @param is_enabled [Boolean] Body param
36
+ #
37
+ # @param secret [String] Body param: Write-only. Used to sign deliveries (the `GrowSurf-Signature` HMAC hea
38
+ #
39
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
40
+ #
41
+ # @return [GrowsurfRuby::Models::Campaign::Webhook]
42
+ #
43
+ # @see GrowsurfRuby::Models::Campaign::WebhookCreateParams
44
+ def create(id, params)
45
+ parsed, options = GrowsurfRuby::Campaign::WebhookCreateParams.dump_request(params)
46
+ @client.request(
47
+ method: :post,
48
+ path: ["campaign/%1$s/webhooks", id],
49
+ body: parsed,
50
+ model: GrowsurfRuby::Models::Campaign::Webhook,
51
+ options: options
52
+ )
53
+ end
54
+
55
+ # Updates a webhook by id.
56
+ #
57
+ # @overload update(webhook_id, id:, events: nil, is_enabled: nil, payload_url: nil, secret: nil, request_options: {})
58
+ #
59
+ # @param webhook_id [String] Path param: The webhook id (`primary` for the program's primary webhook).
60
+ #
61
+ # @param id [String] Path param: GrowSurf program ID.
62
+ #
63
+ # @param events [Array<Symbol, GrowsurfRuby::Models::Campaign::WebhookEvent>] Body param
64
+ #
65
+ # @param is_enabled [Boolean] Body param
66
+ #
67
+ # @param payload_url [String] Body param
68
+ #
69
+ # @param secret [String] Body param: Write-only.
70
+ #
71
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
72
+ #
73
+ # @return [GrowsurfRuby::Models::Campaign::Webhook]
74
+ #
75
+ # @see GrowsurfRuby::Models::Campaign::WebhookUpdateParams
76
+ def update(webhook_id, params)
77
+ parsed, options = GrowsurfRuby::Campaign::WebhookUpdateParams.dump_request(params)
78
+ id =
79
+ parsed.delete(:id) do
80
+ raise ArgumentError.new("missing required path argument #{_1}")
81
+ end
82
+ @client.request(
83
+ method: :patch,
84
+ path: ["campaign/%1$s/webhooks/%2$s", id, webhook_id],
85
+ body: parsed,
86
+ model: GrowsurfRuby::Models::Campaign::Webhook,
87
+ options: options
88
+ )
89
+ end
90
+
91
+ # Removes a webhook by id.
92
+ #
93
+ # @overload delete(webhook_id, id:, request_options: {})
94
+ #
95
+ # @param webhook_id [String] The webhook id (`primary` for the program's primary webhook).
96
+ #
97
+ # @param id [String] GrowSurf program ID.
98
+ #
99
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
100
+ #
101
+ # @return [GrowsurfRuby::Models::Campaign::WebhookDeleteResponse]
102
+ #
103
+ # @see GrowsurfRuby::Models::Campaign::WebhookDeleteParams
104
+ def delete(webhook_id, params)
105
+ parsed, options = GrowsurfRuby::Campaign::WebhookDeleteParams.dump_request(params)
106
+ id =
107
+ parsed.delete(:id) do
108
+ raise ArgumentError.new("missing required path argument #{_1}")
109
+ end
110
+ @client.request(
111
+ method: :delete,
112
+ path: ["campaign/%1$s/webhooks/%2$s", id, webhook_id],
113
+ model: GrowsurfRuby::Models::Campaign::WebhookDeleteResponse,
114
+ options: options
115
+ )
116
+ end
117
+
118
+ # Sends a live test event to a webhook using its stored URL and secret.
119
+ #
120
+ # @overload test(webhook_id, id:, event: nil, request_options: {})
121
+ #
122
+ # @param webhook_id [String] Path param: The webhook id (`primary` for the program's primary webhook).
123
+ #
124
+ # @param id [String] Path param: GrowSurf program ID.
125
+ #
126
+ # @param event [Symbol, GrowsurfRuby::Models::Campaign::WebhookEvent] Body param: The event to simulate. When omitted, the webhook's first enabled even
127
+ #
128
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
129
+ #
130
+ # @return [GrowsurfRuby::Models::Campaign::WebhookTestResponse]
131
+ #
132
+ # @see GrowsurfRuby::Models::Campaign::WebhookTestParams
133
+ def test(webhook_id, params)
134
+ parsed, options = GrowsurfRuby::Campaign::WebhookTestParams.dump_request(params)
135
+ id =
136
+ parsed.delete(:id) do
137
+ raise ArgumentError.new("missing required path argument #{_1}")
138
+ end
139
+ @client.request(
140
+ method: :post,
141
+ path: ["campaign/%1$s/webhooks/%2$s/test", id, webhook_id],
142
+ body: parsed,
143
+ model: GrowsurfRuby::Models::Campaign::WebhookTestResponse,
144
+ options: options
145
+ )
146
+ end
147
+
148
+ # @api private
149
+ #
150
+ # @param client [GrowsurfRuby::Client]
151
+ def initialize(client:)
152
+ @client = client
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end