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
-
#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.
258 259 260 261 262 263 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 258 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
#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.
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 72 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.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 103 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.
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 134 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.
163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 163 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.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 205 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.
243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/growsurf_ruby/resources/campaign.rb', line 243 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 |