Class: GrowsurfRuby::Resources::Campaign::Participant
- Inherits:
-
Object
- Object
- GrowsurfRuby::Resources::Campaign::Participant
- Defined in:
- lib/growsurf_ruby/resources/campaign/participant.rb
Instance Method Summary collapse
-
#add(id, email:, fingerprint: nil, first_name: nil, ip_address: nil, last_name: nil, metadata: nil, referral_status: nil, referred_by: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant
Adds a new participant to the program.
-
#create_mobile_token(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantCreateMobileTokenResponse
Creates a participant-scoped token for GrowSurf mobile SDK participant endpoints.
-
#delete(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantDeleteResponse
Removes a participant by GrowSurf participant ID or email address.
-
#initialize(client:) ⇒ Participant
constructor
private
A new instance of Participant.
-
#list_commissions(participant_id_or_email, id:, limit: nil, next_id: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantCommissionList
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
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
Records a sale made by a referred customer and generates affiliate commissions for their referrer when applicable.
-
#retrieve(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant
Retrieves a single participant by GrowSurf participant ID or email address.
-
#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:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantTriggerReferralResponse
Triggers referral credit for an existing referred participant by GrowSurf participant ID or email address.
-
#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: {}) ⇒ 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.
468 469 470 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 468 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, referral_status: nil, referred_by: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant
Adds a new participant to the program. If the email already exists, the existing participant is returned.
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 133 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 |
#create_mobile_token(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantCreateMobileTokenResponse
Creates a participant-scoped token for GrowSurf mobile SDK participant endpoints. The program must have mobile SDK access enabled.
158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 158 def create_mobile_token(participant_id_or_email, params) parsed, = GrowsurfRuby::Campaign::ParticipantCreateMobileTokenParams.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/mobile-token", id, participant_id_or_email], model: GrowsurfRuby::Models::Campaign::ParticipantCreateMobileTokenResponse, options: ) end |
#delete(participant_id_or_email, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantDeleteResponse
Removes a participant by GrowSurf participant ID or email address.
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 91 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 |
#list_commissions(participant_id_or_email, id:, limit: nil, next_id: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantCommissionList
Retrieves a paged list of commissions earned by a participant.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 191 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
Retrieves a paged list of payouts that belong to a participant.
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 226 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.
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 273 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.
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 312 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
Records a sale made by a referred customer and generates affiliate commissions for their referrer when applicable.
388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 388 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 |
#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 |
#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.
422 423 424 425 426 427 428 429 430 431 432 433 434 435 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 422 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:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::ParticipantTriggerReferralResponse
Triggers referral credit for an existing referred participant by GrowSurf participant ID or email address.
451 452 453 454 455 456 457 458 459 460 461 462 463 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 451 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], model: GrowsurfRuby::Models::Campaign::ParticipantTriggerReferralResponse, options: ) end |
#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: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignParticipant
Updates a participant by GrowSurf participant ID or email address.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/growsurf_ruby/resources/campaign/participant.rb', line 63 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 |