Class: GrowsurfRuby::Resources::Campaign::Rewards
- Inherits:
-
Object
- Object
- GrowsurfRuby::Resources::Campaign::Rewards
- Defined in:
- lib/growsurf_ruby/resources/campaign/rewards.rb,
sig/growsurf_ruby/resources/campaign/rewards.rbs
Instance Method Summary collapse
-
#create(id, type:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_active: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, title: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::Reward
Creates a reward for a program.
-
#delete(reward_id, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::DeleteRewardResponse
Deletes a program reward.
-
#initialize(client:) ⇒ Rewards
constructor
private
A new instance of Rewards.
-
#list(id, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignRewardListResponse
Retrieves the active, visible, and enabled rewards configured for a program.
-
#update(reward_id, id:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_active: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, title: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::Reward
Updates an existing program reward.
Constructor Details
#initialize(client:) ⇒ Rewards
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 Rewards.
185 186 187 |
# File 'lib/growsurf_ruby/resources/campaign/rewards.rb', line 185 def initialize(client:) @client = client end |
Instance Method Details
#create(id, type:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_active: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, title: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::Reward
Creates a reward for a program. The reward type must be compatible with the
program type.
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/growsurf_ruby/resources/campaign/rewards.rb', line 77 def create(id, params) parsed, = GrowsurfRuby::Campaign::RewardCreateParams.dump_request(params) @client.request( method: :post, path: ["campaign/%1$s/rewards", id], body: parsed, model: GrowsurfRuby::Models::Campaign::Reward, options: ) end |
#delete(reward_id, id:, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::DeleteRewardResponse
Deletes a program reward.
168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/growsurf_ruby/resources/campaign/rewards.rb', line 168 def delete(reward_id, params) parsed, = GrowsurfRuby::Campaign::RewardDeleteParams.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/rewards/%2$s", id, reward_id], model: GrowsurfRuby::Models::Campaign::DeleteRewardResponse, options: ) end |
#list(id, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::CampaignRewardListResponse
Retrieves the active, visible, and enabled rewards configured for a program.
16 17 18 19 20 21 22 23 |
# File 'lib/growsurf_ruby/resources/campaign/rewards.rb', line 16 def list(id, params = {}) @client.request( method: :get, path: ["campaign/%1$s/rewards", id], model: GrowsurfRuby::Models::Campaign::CampaignRewardListResponse, options: params[:request_options] ) end |
#update(reward_id, id:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: nil, is_active: nil, is_unlimited: nil, is_visible: nil, limit: nil, limit_duration: nil, metadata: nil, next_milestone_prefix: nil, next_milestone_suffix: nil, number_of_winners: nil, order: nil, referral_coupon_code: nil, referral_description: nil, referred_reward_upfront: nil, title: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Campaign::Reward
Updates an existing program reward. Only the fields you send are changed;
type is immutable and must not be supplied.
140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/growsurf_ruby/resources/campaign/rewards.rb', line 140 def update(reward_id, params) parsed, = GrowsurfRuby::Campaign::RewardUpdateParams.dump_request(params) id = parsed.delete(:id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :patch, path: ["campaign/%1$s/rewards/%2$s", id, reward_id], body: parsed, model: GrowsurfRuby::Models::Campaign::Reward, options: ) end |