Class: GrowsurfRuby::Resources::Campaign::Participant

Inherits:
Object
  • Object
show all
Defined in:
lib/growsurf_ruby/resources/campaign/participant.rb,
sig/growsurf_ruby/resources/campaign/participant.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Participant

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Participant.

Parameters:



804
805
806
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 804

def initialize(client:)
  @client = client
end

Instance Method Details

#add(id, email:, fingerprint: nil, first_name: nil, ip_address: nil, is_affiliate: nil, last_name: nil, metadata: nil, mobile_instance_id: nil, referral_status: nil, referred_by: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant

Some parameter documentations has been truncated, see Models::Campaign::ParticipantAddParams for more details.

Adds a new participant to the program. If the email already exists, the existing participant is returned unchanged. For affiliate programs, set isAffiliate to true to enroll a new participant as an approved affiliate or false to create a non-affiliate. If you omit isAffiliate, a valid referredBy creates a referred non-affiliate; without a valid referrer, the new participant is enrolled as an approved affiliate. You can send a valid referredBy with isAffiliate: true to keep the referral attribution and enroll the participant as an affiliate.

Parameters:

  • id (String)

    GrowSurf program ID.

  • email (String)
  • fingerprint (String)
  • first_name (String)
  • ip_address (String)
  • is_affiliate (Boolean)

    Affiliate programs only. Controls affiliate enrollment for a new participant. true enrolls the participant with affiliateStatus: APPROVED; false creates a non-affiliate without affiliateStatus. Existing participants are returned unchanged.

  • last_name (String)
  • metadata (Hash{Symbol=>Object})

    Shallow custom metadata object.

  • mobile_instance_id (String)

    Optional app-install scoped identifier for native mobile anti-fraud. Recommended

  • referral_status (Symbol, GrowsurfRuby::Models::Campaign::Create::ReferralStatus)

    The referral credit status; only meaningful when referred_by resolves to a ref

  • referred_by (String)

    Referrer participant ID or email address.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



187
188
189
190
191
192
193
194
195
196
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 187

def add(id, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantAddParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["campaign/%1$s/participant", id],
    body: parsed,
    model: GrowsurfRuby::Campaign::CampaignParticipant,
    options: options
  )
end

#bulk_delete(id, participants:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteResponse

Some parameter documentations has been truncated, see Models::Campaign::ParticipantBulkDeleteParams for more details.

Deletes a list of participants from a program in one request. Each entry in participants is a GrowSurf participant ID or an email address (mixed lists are allowed). Up to 200 entries per request — chunk larger lists across multiple calls. The response reports a per-row status for every submitted entry, so a 200 can include rows that were NOT_FOUND or failed. Deletion is permanent and removes the participants' referrals, rewards, commissions, and payout records.

Parameters:

  • id (String)

    GrowSurf program ID.

  • participants (Array<String>)

    GrowSurf participant IDs and/or email addresses to delete. Mixed entries are al

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



135
136
137
138
139
140
141
142
143
144
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 135

def bulk_delete(id, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantBulkDeleteParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["campaign/%1$s/participants/bulk-delete", id],
    body: parsed,
    model: GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteResponse,
    options: options
  )
end

#cancel_delayed_referral(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantCancelDelayedReferralResponse

Cancels a pending delayed referral trigger for a participant (the companion to a delayed Trigger referral request). Use this to undo a scheduled referral credit before it is awarded, for example when a refund occurs inside your refund window. If the participant has no pending delayed trigger, success is returned as false.

Parameters:

  • participant_id_or_email (String)

    GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    GrowSurf program ID.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



589
590
591
592
593
594
595
596
597
598
599
600
601
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 589

def cancel_delayed_referral(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantCancelDelayedReferralParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["campaign/%1$s/participant/%2$s/ref", id, participant_id_or_email],
    model: GrowsurfRuby::Models::Campaign::ParticipantCancelDelayedReferralResponse,
    options: options
  )
end

#delete(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantDeleteResponse

Removes a participant by GrowSurf participant ID or email address.

Parameters:

  • participant_id_or_email (String)

    GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    GrowSurf program ID.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 99

def delete(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantDeleteParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["campaign/%1$s/participant/%2$s", id, participant_id_or_email],
    model: GrowsurfRuby::Models::Campaign::ParticipantDeleteResponse,
    options: options
  )
end

#email(participant_id_or_email, id:, body: nil, email_type: nil, preheader: nil, subject: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantEmailResponse

Sends an email to a participant. Provide EITHER emailType to trigger one of the program's configured email templates, OR subject + body for a free-form email. Free-form emails are sent with the same compliance handling (company name, postal address, and an unsubscribe link are added automatically, and unsubscribed participants are suppressed). Sending requires the team to be verified by GrowSurf. Requires a verified custom email domain on the program (which can be completed in Campaign Editor > 3. Emails > Email Settings). Returns 400 until one is verified. The email is accepted for delivery.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • 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.

  • email_type (String)

    Body param: The program email template to send (template mode). Send the camelCase

  • preheader (String)

    Body param: Optional preheader text for a free-form email.

  • subject (String)

    Body param: Subject line for a free-form email. Supports dynamic text ({{...}} tokens), the same as the body.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 631

def email(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantEmailParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["campaign/%1$s/participant/%2$s/email", id, participant_id_or_email],
    body: parsed,
    model: GrowsurfRuby::Models::Campaign::ParticipantEmailResponse,
    options: options
  )
end

#get_payout_destination(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantGetPayoutDestinationResponse

Returns a participant's payout-destination status across every payout provider enabled for the program (PayPal and/or Wise). For each provider it reports the current status, the confirmed claim email, the legal recipient type, and — when a delivery bounced or a recipient was invalidated — the repair reason. activeProvider is the provider that currently gets paid, or null until the participant confirms one.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



749
750
751
752
753
754
755
756
757
758
759
760
761
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 749

def get_payout_destination(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantGetPayoutDestinationParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["campaign/%1$s/participant/%2$s/payout-destination", id, participant_id_or_email],
    model: GrowsurfRuby::Models::Campaign::ParticipantGetPayoutDestinationResponse,
    options: options
  )
end

#list_activity_logs(participant_id_or_email, id:, limit: nil, offset: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantActivityLogsResponse

Returns a participant's activity logs, most recent first (offset/limit paginated).

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • limit (Integer)

    Query param: Number of logs to return (1–100, default 20).

  • offset (Integer)

    Query param: Number of logs to skip.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 664

def list_activity_logs(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantListActivityLogsParams.dump_request(params)
  query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["campaign/%1$s/participant/%2$s/activity-logs", id, participant_id_or_email],
    query: query,
    model: GrowsurfRuby::Models::Campaign::ParticipantActivityLogsResponse,
    options: options
  )
end

#list_commissions(participant_id_or_email, id:, limit: nil, next_id: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantCommissionList

Affiliate programs only. Retrieves a paged list of commissions earned by a participant.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • limit (Integer)

    Query param: Number of results to return. Maximum 100.

  • next_id (String)

    Query param: ID to start the next paged result set with.

  • status (Symbol, GrowsurfRuby::Models::Campaign::ParticipantListCommissionsParams::Status)

    Query param: Participant commission status.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 218

def list_commissions(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantListCommissionsParams.dump_request(params)
  query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["campaign/%1$s/participant/%2$s/commissions", id, participant_id_or_email],
    query: query.transform_keys(next_id: "nextId"),
    model: GrowsurfRuby::ParticipantCommissionList,
    options: options
  )
end

#list_payouts(participant_id_or_email, id:, limit: nil, next_id: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantPayoutList

Affiliate programs only. Retrieves a paged list of payouts that belong to a participant.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • limit (Integer)

    Query param: Number of results to return. Maximum 100.

  • next_id (String)

    Query param: ID to start the next paged result set with.

  • status (Symbol, GrowsurfRuby::Models::Campaign::ParticipantListPayoutsParams::Status)

    Query param: Participant payout status.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 254

def list_payouts(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantListPayoutsParams.dump_request(params)
  query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["campaign/%1$s/participant/%2$s/payouts", id, participant_id_or_email],
    query: query.transform_keys(next_id: "nextId"),
    model: GrowsurfRuby::ParticipantPayoutList,
    options: options
  )
end

#list_referrals(participant_id_or_email, id:, desc: nil, email: nil, first_name: nil, last_name: nil, limit: nil, next_id: nil, offset: nil, referral_status: nil, sort_by: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ReferralList

Retrieves referrals and email invites made by a participant.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • desc (Boolean)

    Query param: Return results in descending order when true.

  • email (String)

    Query param: URL-encoded email value to filter referral results.

  • first_name (String)

    Query param: First name value to filter results.

  • last_name (String)

    Query param: Last name value to filter results.

  • limit (Integer)

    Query param: Number of results to return. Maximum 100.

  • next_id (String)

    Query param: ID to start the next paged result set with.

  • offset (Integer)

    Query param: Offset number used to skip through a result set.

  • referral_status (Symbol, GrowsurfRuby::Models::Campaign::ReferralStatus)

    Query param

  • sort_by (Symbol, GrowsurfRuby::Models::Campaign::ParticipantListReferralsParams::SortBy)

    Query param: Field used to sort referral results.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 301

def list_referrals(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantListReferralsParams.dump_request(params)
  query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["campaign/%1$s/participant/%2$s/referrals", id, participant_id_or_email],
    query: query.transform_keys(
      first_name: "firstName",
      last_name: "lastName",
      next_id: "nextId",
      referral_status: "referralStatus",
      sort_by: "sortBy"
    ),
    model: GrowsurfRuby::ReferralList,
    options: options
  )
end

#list_rewards(participant_id_or_email, id:, limit: nil, next_id: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantListRewardsResponse

Retrieves a paged list of rewards earned by a participant.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • limit (Integer)

    Query param: Number of results to return. Maximum 100.

  • next_id (String)

    Query param: ID to start the next paged result set with.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 340

def list_rewards(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantListRewardsParams.dump_request(params)
  query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["campaign/%1$s/participant/%2$s/rewards", id, participant_id_or_email],
    query: query.transform_keys(next_id: "nextId"),
    model: GrowsurfRuby::Models::Campaign::ParticipantListRewardsResponse,
    options: options
  )
end

#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: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantRecordTransactionResponse::UnionMember0, GrowsurfRuby::Models::Campaign::ParticipantRecordTransactionResponse::UnionMember1

Affiliate programs only. Records a sale made by a referred customer and generates affiliate commissions for their referrer when applicable. Requires at least one transaction identifier (externalId, transactionId, orderId, paymentId, invoiceId, paymentIntentId, or chargeId) so repeated requests can be de-duplicated — without one, a resent sale would create a second commission. Reuse the same identifier(s) when refunding.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • currency (String)

    Body param

  • gross_amount (Integer)

    Body param

  • amount_cash_net (Integer)

    Body param

  • amount_paid (Integer)

    Body param

  • charge_id (String)

    Body param

  • customer_id (String)

    Body param

  • description (String)

    Body param

  • external_id (String)

    Body param

  • invoice_id (String)

    Body param

  • invoice_subtotal_excluding_tax (Integer)

    Body param

  • invoice_total (Integer)

    Body param

  • invoice_total_excluding_tax (Integer)

    Body param

  • net_amount (Integer)

    Body param

  • order_id (String)

    Body param

  • paid_at (Integer)

    Body param

  • payment_id (String)

    Body param

  • payment_intent_id (String)

    Body param

  • subscription_id (String)

    Body param

  • tax_amount (Integer)

    Body param

  • total_tax_amount (Integer)

    Body param

  • total_tax_amounts (Array<Hash{Symbol=>Object}>)

    Body param

  • total_taxes (Array<Hash{Symbol=>Object}>)

    Body param

  • transaction_id (String)

    Body param

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



420
421
422
423
424
425
426
427
428
429
430
431
432
433
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 420

def record_transaction(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantRecordTransactionParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["campaign/%1$s/participant/%2$s/transaction", id, participant_id_or_email],
    body: parsed,
    model: GrowsurfRuby::Models::Campaign::ParticipantRecordTransactionResponse,
    options: options
  )
end

#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: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse

Affiliate programs only. Records an amendment (refund, partial refund, refund cancellation, or chargeback) against a previously recorded transaction and reverses or adjusts the referrer's commission. The inverse of Record Affiliate Transaction. Identify the original transaction with the same identifier(s) you sent when recording it. Commissions already paid out to the affiliate are not clawed back; the amendment is recorded for tax reporting only.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • amendment_type (Symbol, GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionParams::AmendmentType)

    Body param

  • amount (Integer)

    Body param

  • amount_refunded (Integer)

    Body param

  • charge_id (String)

    Body param

  • currency (String)

    Body param

  • description (String)

    Body param

  • external_id (String)

    Body param

  • invoice_id (String)

    Body param

  • order_id (String)

    Body param

  • payment_id (String)

    Body param

  • payment_intent_id (String)

    Body param

  • refund_amount (Integer)

    Body param

  • refund_id (String)

    Body param

  • refund_status (String)

    Body param

  • transaction_id (String)

    Body param

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



483
484
485
486
487
488
489
490
491
492
493
494
495
496
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 483

def refund_transaction(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantRefundTransactionParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["campaign/%1$s/participant/%2$s/transaction/refund", id, participant_id_or_email],
    body: parsed,
    model: GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse,
    options: options
  )
end

#request_payout_destination_confirmation(participant_id_or_email, id:, provider:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantRequestPayoutDestinationConfirmationResponse

Sends the participant a one-time link to confirm their payout destination for the chosen provider. Only the participant can open the link and confirm — this endpoint just triggers the message. The provider must be enabled for the program.

Parameters:

Returns:

See Also:



781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 781

def request_payout_destination_confirmation(participant_id_or_email, params)
  parsed, options =
    GrowsurfRuby::Campaign::ParticipantRequestPayoutDestinationConfirmationParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: [
      "campaign/%1$s/participant/%2$s/payout-destination/request-confirmation",
      id,
      participant_id_or_email
    ],
    body: parsed,
    model: GrowsurfRuby::Models::Campaign::ParticipantRequestPayoutDestinationConfirmationResponse,
    options: options
  )
end

#retrieve(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant

Retrieves a single participant by GrowSurf participant ID or email address.

Parameters:

  • participant_id_or_email (String)

    GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    GrowSurf program ID.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 20

def retrieve(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantRetrieveParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["campaign/%1$s/participant/%2$s", id, participant_id_or_email],
    model: GrowsurfRuby::Campaign::CampaignParticipant,
    options: options
  )
end

#retrieve_analytics(participant_id_or_email, id:, days: nil, end_date: nil, include: nil, interval: nil, start_date: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantAnalyticsResponse

Some parameter documentations has been truncated, see Models::Campaign::ParticipantRetrieveAnalyticsParams for more details.

Retrieves analytics for a single participant — all-time engagement counters, leaderboard ranks, and per-channel share counts (plus affiliate revenue, commission, and payout metrics for affiliate programs). Pass include=email for sent (accepted for delivery), delivered, opened, clicked, bounced, and spamComplaints metrics attributed to this participant, including invitations they sent. Use include=email,series to include the same counts in each UTC series bucket. days, startDate, and endDate filter only the optional series and email data. They do not filter the top-level analytics, ranks, or shareCount values.

Parameters:

  • participant_id_or_email (String)

    GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    GrowSurf program ID.

  • days (Integer)

    Last number of days for optional series and email analytics. Defaults to 365. Maxi

  • end_date (Integer)

    End of a custom series and email analytics window as a Unix timestamp in milli

  • include (String)

    Comma-separated optional data. series returns this participant's own activity

  • interval (Symbol, GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams::Interval)

    Bucket size for the series (only used when include contains series).

  • start_date (Integer)

    Start of a custom series and email analytics window as a Unix timestamp in mi

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 715

def retrieve_analytics(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantRetrieveAnalyticsParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  query = GrowsurfRuby::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["campaign/%1$s/participant/%2$s/analytics", id, participant_id_or_email],
    query: query.transform_keys(end_date: "endDate", start_date: "startDate"),
    model: GrowsurfRuby::Models::Campaign::ParticipantAnalyticsResponse,
    options: options
  )
end

#send_invites(participant_id_or_email, id:, email_addresses:, message_text:, subject_text:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantSendInvitesResponse

Sends email invites on behalf of a participant to a list of email addresses. Sending invites via the API requires a verified custom email domain on the program; the request fails until one is verified.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • email_addresses (Array<String>)

    Body param

  • message_text (String)

    Body param

  • subject_text (String)

    Body param

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



519
520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 519

def send_invites(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantSendInvitesParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["campaign/%1$s/participant/%2$s/invites", id, participant_id_or_email],
    body: parsed,
    model: GrowsurfRuby::Models::Campaign::ParticipantSendInvitesResponse,
    options: options
  )
end

#trigger_referral(participant_id_or_email, id:, delay_in_days: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantTriggerReferralResponse

Some parameter documentations has been truncated, see Models::Campaign::ParticipantTriggerReferralParams for more details.

Triggers referral credit for an existing referred participant by GrowSurf participant ID or email address. Optionally pass delayInDays to hold the credit for a number of days before it is awarded (for example, to cover your own refund window). A delayed trigger can be cancelled before it is awarded with the Cancel delayed referral trigger request (DELETE on this same path).

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • delay_in_days (Integer)

    Body param: Number of whole days to hold referral credit before it is awarded. U

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



557
558
559
560
561
562
563
564
565
566
567
568
569
570
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 557

def trigger_referral(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantTriggerReferralParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["campaign/%1$s/participant/%2$s/ref", id, participant_id_or_email],
    body: parsed,
    model: GrowsurfRuby::Models::Campaign::ParticipantTriggerReferralResponse,
    options: options
  )
end

#update(participant_id_or_email, id:, affiliate_status: nil, email: nil, first_name: nil, last_name: nil, metadata: nil, notes: nil, referral_status: nil, referred_by: nil, unsubscribed: nil, vanity_keys: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant

Updates a participant by GrowSurf participant ID or email address. For affiliate programs, set affiliateStatus to APPROVED, SUSPENDED, or BANNED. APPROVED enrolls the participant as an affiliate. SUSPENDED and BANNED require an existing affiliate. This endpoint does not accept isAffiliate, and affiliate enrollment cannot be removed through REST.

Parameters:

  • participant_id_or_email (String)

    Path param: GrowSurf participant ID or URL-encoded participant email address.

  • id (String)

    Path param: GrowSurf program ID.

  • affiliate_status (Symbol, GrowsurfRuby::Models::Campaign::ParticipantUpdateParams::AffiliateStatus)

    Body param: Affiliate programs only. Sets the affiliate status. APPROVED also enrolls a participant who is not yet an affiliate. SUSPENDED and BANNED are rejected for non-affiliates.

  • email (String)

    Body param

  • first_name (String)

    Body param

  • last_name (String)

    Body param

  • metadata (Hash{Symbol=>Object})

    Body param: Shallow custom metadata object.

  • notes (String)

    Body param: Freeform internal notes about the participant (internal only, never ex

  • referral_status (Symbol, GrowsurfRuby::Models::Campaign::ParticipantUpdateParams::ReferralStatus)

    Body param

  • referred_by (String)

    Body param

  • unsubscribed (Boolean)

    Body param

  • vanity_keys (Array<String>)

    Body param

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 71

def update(participant_id_or_email, params)
  parsed, options = GrowsurfRuby::Campaign::ParticipantUpdateParams.dump_request(params)
  id =
    parsed.delete(:id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["campaign/%1$s/participant/%2$s", id, participant_id_or_email],
    body: parsed,
    model: GrowsurfRuby::Campaign::CampaignParticipant,
    options: options
  )
end