Class: GrowsurfRuby::Resources::Campaign
- Inherits:
-
Object
- Object
- GrowsurfRuby::Resources::Campaign
- Defined in:
- lib/growsurf_ruby/resources/campaign.rb,
lib/growsurf_ruby/resources/campaign/reward.rb,
lib/growsurf_ruby/resources/campaign/rewards.rb,
lib/growsurf_ruby/resources/campaign/commission.rb,
lib/growsurf_ruby/resources/campaign/participant.rb,
sig/growsurf_ruby/resources/campaign.rbs,
sig/growsurf_ruby/resources/campaign/reward.rbs,
sig/growsurf_ruby/resources/campaign/rewards.rbs,
sig/growsurf_ruby/resources/campaign/commission.rbs,
sig/growsurf_ruby/resources/campaign/participant.rbs
Defined Under Namespace
Classes: Commission, Participant, Reward, Rewards
Instance Attribute Summary collapse
-
#commission ⇒ GrowsurfRuby::Resources::Campaign::Commission
readonly
Affiliate transaction, commission, and payout operations.
- #participant ⇒ GrowsurfRuby::Resources::Campaign::Participant readonly
-
#reward ⇒ GrowsurfRuby::Resources::Campaign::Reward
readonly
Participant reward retrieval and manual reward operations.
-
#rewards ⇒ GrowsurfRuby::Resources::Campaign::Rewards
readonly
Program reward configuration operations.
Instance Method Summary collapse
-
#clone(id, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignAPI
Clones an existing program, returning the newly created program.
-
#create(type:, company_logo_image_url: nil, company_name: nil, currency_iso: nil, goal: nil, name: nil, options: nil, rewards: nil, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignAPI
Creates a program.
-
#create_mobile_participant_token(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::CampaignCreateMobileParticipantTokenResponse
Some parameter documentations has been truncated, see Models::CampaignCreateMobileParticipantTokenParams for more details.
-
#initialize(client:) ⇒ Campaign
constructor
private
A new instance of Campaign.
-
#list(request_options: {}) ⇒ GrowsurfRuby::Models::CampaignListResponse
Retrieves a list of your programs.
-
#list_commissions(id, limit: nil, next_id: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantCommissionList
Retrieves a paged list of all participant commissions in an affiliate program.
-
#list_leaderboard(id, is_monthly: nil, leaderboard_type: nil, limit: nil, next_id: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantList
Retrieves participants in leaderboard order for the specified leaderboard type.
-
#list_participants(id, limit: nil, next_id: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantList
Retrieves a paged list of participants in a program.
-
#list_payouts(id, limit: nil, next_id: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantPayoutList
Retrieves a paged list of all participant payouts in an affiliate program.
-
#list_referrals(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 a list of all referrals and email invites made by participants in a program.
-
#retrieve(id, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignAPI
Retrieves a program for the given program ID.
-
#retrieve_analytics(id, days: nil, end_date: nil, start_date: nil, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignRetrieveAnalyticsResponse
Some parameter documentations has been truncated, see Models::CampaignRetrieveAnalyticsParams for more details.
-
#update(id, company_logo_image_url: nil, company_name: nil, currency_iso: nil, design: nil, emails: nil, goal: nil, installation: nil, name: nil, notifications: nil, options: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignAPI
Updates a program.
Constructor Details
#initialize(client:) ⇒ Campaign
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 Campaign.
409 410 411 412 413 414 415 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 409 def initialize(client:) @client = client @participant = GrowsurfRuby::Resources::Campaign::Participant.new(client: client) @reward = GrowsurfRuby::Resources::Campaign::Reward.new(client: client) @commission = GrowsurfRuby::Resources::Campaign::Commission.new(client: client) @rewards = GrowsurfRuby::Resources::Campaign::Rewards.new(client: client) end |
Instance Attribute Details
#commission ⇒ GrowsurfRuby::Resources::Campaign::Commission (readonly)
Affiliate transaction, commission, and payout operations.
15 16 17 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 15 def commission @commission end |
#participant ⇒ GrowsurfRuby::Resources::Campaign::Participant (readonly)
7 8 9 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 7 def participant @participant end |
#reward ⇒ GrowsurfRuby::Resources::Campaign::Reward (readonly)
Participant reward retrieval and manual reward operations.
11 12 13 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 11 def reward @reward end |
#rewards ⇒ GrowsurfRuby::Resources::Campaign::Rewards (readonly)
Program reward configuration operations.
19 20 21 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 19 def rewards @rewards end |
Instance Method Details
#clone(id, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignAPI
Clones an existing program, returning the newly created program.
150 151 152 153 154 155 156 157 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 150 def clone(id, params = {}) @client.request( method: :post, path: ["campaign/%1$s/clone", id], model: GrowsurfRuby::CampaignAPI, options: params[:request_options] ) end |
#create(type:, company_logo_image_url: nil, company_name: nil, currency_iso: nil, goal: nil, name: nil, options: nil, rewards: nil, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignAPI
Creates a program. Only type is required; everything else is
server-defaulted.
85 86 87 88 89 90 91 92 93 94 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 85 def create(params) parsed, = GrowsurfRuby::CampaignCreateParams.dump_request(params) @client.request( method: :post, path: "campaigns", body: parsed, model: GrowsurfRuby::CampaignAPI, options: ) end |
#create_mobile_participant_token(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::CampaignCreateMobileParticipantTokenResponse
Some parameter documentations has been truncated, see Models::CampaignCreateMobileParticipantTokenParams for more details.
Creates or returns a participant using the same input behavior as Add Participant, then returns a participant-scoped token for GrowSurf mobile SDK participant endpoints. Use this endpoint from your backend after your mobile app authenticates a signed-in user. The program must have mobile SDK access enabled.
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 195 def create_mobile_participant_token(id, params) parsed, = GrowsurfRuby::CampaignCreateMobileParticipantTokenParams.dump_request(params) @client.request( method: :post, path: ["campaign/%1$s/mobile-participant-token", id], body: parsed, model: GrowsurfRuby::Models::CampaignCreateMobileParticipantTokenResponse, options: ) end |
#list(request_options: {}) ⇒ GrowsurfRuby::Models::CampaignListResponse
Retrieves a list of your programs. Deleted programs are not returned.
50 51 52 53 54 55 56 57 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 50 def list(params = {}) @client.request( method: :get, path: "campaigns", model: GrowsurfRuby::Models::CampaignListResponse, options: params[:request_options] ) end |
#list_commissions(id, limit: nil, next_id: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantCommissionList
Retrieves a paged list of all participant commissions in an affiliate program.
223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 223 def list_commissions(id, params = {}) parsed, = GrowsurfRuby::CampaignListCommissionsParams.dump_request(params) query = GrowsurfRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["campaign/%1$s/commissions", id], query: query.transform_keys(next_id: "nextId"), model: GrowsurfRuby::ParticipantCommissionList, options: ) end |
#list_leaderboard(id, is_monthly: nil, leaderboard_type: nil, limit: nil, next_id: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantList
Retrieves participants in leaderboard order for the specified leaderboard type.
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 254 def list_leaderboard(id, params = {}) parsed, = GrowsurfRuby::CampaignListLeaderboardParams.dump_request(params) query = GrowsurfRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["campaign/%1$s/leaderboard", id], query: query.transform_keys( is_monthly: "isMonthly", leaderboard_type: "leaderboardType", next_id: "nextId" ), model: GrowsurfRuby::ParticipantList, options: ) end |
#list_participants(id, limit: nil, next_id: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantList
Retrieves a paged list of participants in a program.
285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 285 def list_participants(id, params = {}) parsed, = GrowsurfRuby::CampaignListParticipantsParams.dump_request(params) query = GrowsurfRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["campaign/%1$s/participants", id], query: query.transform_keys(next_id: "nextId"), model: GrowsurfRuby::ParticipantList, options: ) end |
#list_payouts(id, limit: nil, next_id: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::ParticipantPayoutList
Retrieves a paged list of all participant payouts in an affiliate program.
314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 314 def list_payouts(id, params = {}) parsed, = GrowsurfRuby::CampaignListPayoutsParams.dump_request(params) query = GrowsurfRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["campaign/%1$s/payouts", id], query: query.transform_keys(next_id: "nextId"), model: GrowsurfRuby::ParticipantPayoutList, options: ) end |
#list_referrals(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 a list of all referrals and email invites made by participants in a program.
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 356 def list_referrals(id, params = {}) parsed, = GrowsurfRuby::CampaignListReferralsParams.dump_request(params) query = GrowsurfRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["campaign/%1$s/referrals", id], query: query.transform_keys( first_name: "firstName", last_name: "lastName", next_id: "nextId", referral_status: "referralStatus", sort_by: "sortBy" ), model: GrowsurfRuby::ReferralList, options: ) end |
#retrieve(id, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignAPI
Retrieves a program for the given program ID.
32 33 34 35 36 37 38 39 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 32 def retrieve(id, params = {}) @client.request( method: :get, path: ["campaign/%1$s", id], model: GrowsurfRuby::CampaignAPI, options: params[:request_options] ) end |
#retrieve_analytics(id, days: nil, end_date: nil, start_date: nil, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignRetrieveAnalyticsResponse
Some parameter documentations has been truncated, see Models::CampaignRetrieveAnalyticsParams for more details.
Retrieves analytics for a program.
394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 394 def retrieve_analytics(id, params = {}) parsed, = GrowsurfRuby::CampaignRetrieveAnalyticsParams.dump_request(params) query = GrowsurfRuby::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["campaign/%1$s/analytics", id], query: query.transform_keys(end_date: "endDate", start_date: "startDate"), model: GrowsurfRuby::Models::CampaignRetrieveAnalyticsResponse, options: ) end |
#update(id, company_logo_image_url: nil, company_name: nil, currency_iso: nil, design: nil, emails: nil, goal: nil, installation: nil, name: nil, notifications: nil, options: nil, status: nil, request_options: {}) ⇒ GrowsurfRuby::Models::CampaignAPI
Updates a program. Only the fields you send are changed. type and urlId are
immutable.
130 131 132 133 134 135 136 137 138 139 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 130 def update(id, params) parsed, = GrowsurfRuby::CampaignUpdateParams.dump_request(params) @client.request( method: :patch, path: ["campaign/%1$s", id], body: parsed, model: GrowsurfRuby::CampaignAPI, options: ) end |