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/commission.rb,
lib/growsurf_ruby/resources/campaign/participant.rb
Defined Under Namespace
Classes: Commission, Participant, Reward
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.
Instance Method Summary collapse
-
#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.
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.
305 306 307 308 309 310 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 305 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) 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 |
Instance Method Details
#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.
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 91 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.
46 47 48 49 50 51 52 53 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 46 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.
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 119 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.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 150 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.
181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 181 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.
210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 210 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.
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 252 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.
28 29 30 31 32 33 34 35 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 28 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.
290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 290 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 |