Class: GrowsurfRuby::Resources::Campaign::Participant
- Inherits:
-
Object
- Object
- GrowsurfRuby::Resources::Campaign::Participant
- Defined in:
- lib/growsurf_ruby/resources/campaign/participant.rb,
sig/growsurf_ruby/resources/campaign/participant.rbs
Instance Method Summary collapse
-
#add(id, email:, fingerprint: nil, first_name: nil, ip_address: 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.
-
#bulk_delete(id, participants:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantBulkDeleteResponse
Some parameter documentations has been truncated, see Models::Campaign::ParticipantBulkDeleteParams for more details.
-
#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).
-
#delete(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantDeleteResponse
Removes a participant by GrowSurf participant ID or email address.
-
#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.
-
#initialize(client:) ⇒ Participant
constructor
private
A new instance of Participant.
-
#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).
-
#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.
-
#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.
-
#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.
-
#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.
-
#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.
-
#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.
-
#retrieve(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant
Retrieves a single participant by GrowSurf participant ID or email address.
-
#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.
-
#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.
-
#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.
-
#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: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant
Updates a participant by GrowSurf participant ID or email address.
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.
717 718 719 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 717 def initialize(client:) @client = client end |
Instance Method Details
#add(id, email:, fingerprint: nil, first_name: nil, ip_address: 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.
175 176 177 178 179 180 181 182 183 184 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 175 def add(id, params) parsed, = GrowsurfRuby::Campaign::ParticipantAddParams.dump_request(params) @client.request( method: :post, path: ["campaign/%1$s/participant", id], body: parsed, model: GrowsurfRuby::Campaign::CampaignParticipant, 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.
131 132 133 134 135 136 137 138 139 140 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 131 def bulk_delete(id, params) parsed, = 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: ) 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.
577 578 579 580 581 582 583 584 585 586 587 588 589 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 577 def cancel_delayed_referral(participant_id_or_email, params) parsed, = 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: ) end |
#delete(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantDeleteResponse
Removes a participant by GrowSurf participant ID or email address.
95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 95 def delete(participant_id_or_email, params) parsed, = 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: ) 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.
619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 619 def email(participant_id_or_email, params) parsed, = 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: ) 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).
652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 652 def list_activity_logs(participant_id_or_email, params) parsed, = 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: ) 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.
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 206 def list_commissions(participant_id_or_email, params) parsed, = 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: ) 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.
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 242 def list_payouts(participant_id_or_email, params) parsed, = 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: ) 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.
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 289 def list_referrals(participant_id_or_email, params) parsed, = 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: ) 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.
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 328 def list_rewards(participant_id_or_email, params) parsed, = 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: ) 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.
408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 408 def record_transaction(participant_id_or_email, params) parsed, = 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: ) 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.
471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 471 def refund_transaction(participant_id_or_email, params) parsed, = 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: ) end |
#retrieve(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant
Retrieves a single participant by GrowSurf participant ID or email address.
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, = 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: ) 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 money metrics
for affiliate programs). Useful for segmenting and re-engaging participants.
Pass include=series to also get this participant's own activity over time.
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 698 def retrieve_analytics(participant_id_or_email, params) parsed, = 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: ) 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.
507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 507 def send_invites(participant_id_or_email, params) parsed, = 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: ) 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).
545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 545 def trigger_referral(participant_id_or_email, params) parsed, = 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: ) end |
#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: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant
Updates a participant by GrowSurf participant ID or email address.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 67 def update(participant_id_or_email, params) parsed, = 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: ) end |