growsurf-ruby 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +1 -1
- data/lib/growsurf_ruby/models/campaign/campaign_reward_list_response.rb +21 -0
- data/lib/growsurf_ruby/models/campaign/delete_reward_response.rb +26 -0
- data/lib/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_params.rb +28 -0
- data/lib/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_response.rb +24 -0
- data/lib/growsurf_ruby/models/campaign/participant_refund_transaction_params.rb +130 -0
- data/lib/growsurf_ruby/models/campaign/participant_refund_transaction_response.rb +81 -0
- data/lib/growsurf_ruby/models/campaign/participant_trigger_referral_params.rb +19 -1
- data/lib/growsurf_ruby/models/campaign/reward.rb +166 -0
- data/lib/growsurf_ruby/models/campaign/reward_create_params.rb +189 -0
- data/lib/growsurf_ruby/models/campaign/reward_update_params.rb +182 -0
- data/lib/growsurf_ruby/models/campaign_create_params.rb +82 -0
- data/lib/growsurf_ruby/models/campaign_update_params.rb +112 -0
- data/lib/growsurf_ruby/models.rb +4 -0
- data/lib/growsurf_ruby/resources/campaign/participant.rb +98 -3
- data/lib/growsurf_ruby/resources/campaign/rewards.rb +191 -0
- data/lib/growsurf_ruby/resources/campaign.rb +105 -0
- data/lib/growsurf_ruby/version.rb +1 -1
- data/lib/growsurf_ruby.rb +12 -0
- data/rbi/growsurf_ruby/models/campaign/campaign_reward_list_response.rbi +41 -0
- data/rbi/growsurf_ruby/models/campaign/delete_reward_response.rbi +38 -0
- data/rbi/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_params.rbi +48 -0
- data/rbi/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_response.rbi +36 -0
- data/rbi/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbi +234 -0
- data/rbi/growsurf_ruby/models/campaign/participant_refund_transaction_response.rbi +131 -0
- data/rbi/growsurf_ruby/models/campaign/participant_trigger_referral_params.rbi +24 -1
- data/rbi/growsurf_ruby/models/campaign/reward.rbi +252 -0
- data/rbi/growsurf_ruby/models/campaign/reward_create_params.rbi +330 -0
- data/rbi/growsurf_ruby/models/campaign/reward_update_params.rbi +281 -0
- data/rbi/growsurf_ruby/models/campaign_create_params.rbi +143 -0
- data/rbi/growsurf_ruby/models/campaign_update_params.rbi +193 -0
- data/rbi/growsurf_ruby/models.rbi +4 -0
- data/rbi/growsurf_ruby/resources/campaign/participant.rbi +94 -0
- data/rbi/growsurf_ruby/resources/campaign/rewards.rbi +200 -0
- data/rbi/growsurf_ruby/resources/campaign.rbi +99 -0
- data/sig/growsurf_ruby/models/campaign/campaign_reward_list_response.rbs +18 -0
- data/sig/growsurf_ruby/models/campaign/delete_reward_response.rbs +17 -0
- data/sig/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_params.rbs +30 -0
- data/sig/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_response.rbs +20 -0
- data/sig/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbs +151 -0
- data/sig/growsurf_ruby/models/campaign/participant_refund_transaction_response.rbs +75 -0
- data/sig/growsurf_ruby/models/campaign/participant_trigger_referral_params.rbs +7 -1
- data/sig/growsurf_ruby/models/campaign/reward.rbs +131 -0
- data/sig/growsurf_ruby/models/campaign/reward_create_params.rbs +192 -0
- data/sig/growsurf_ruby/models/campaign/reward_update_params.rbs +182 -0
- data/sig/growsurf_ruby/models/campaign_create_params.rbs +88 -0
- data/sig/growsurf_ruby/models/campaign_update_params.rbs +119 -0
- data/sig/growsurf_ruby/models.rbs +4 -0
- data/sig/growsurf_ruby/resources/campaign/participant.rbs +28 -0
- data/sig/growsurf_ruby/resources/campaign/rewards.rbs +70 -0
- data/sig/growsurf_ruby/resources/campaign.rbs +35 -0
- metadata +38 -2
|
@@ -377,6 +377,66 @@ module GrowsurfRuby
|
|
|
377
377
|
)
|
|
378
378
|
end
|
|
379
379
|
|
|
380
|
+
# Records an amendment (refund, partial refund, refund cancellation, or
|
|
381
|
+
# chargeback) against a previously recorded transaction and reverses or adjusts
|
|
382
|
+
# the referrer's commission.
|
|
383
|
+
#
|
|
384
|
+
# @overload refund_transaction(participant_id_or_email, id:, amendment_type: nil, amount: nil, amount_refunded: nil, charge_id: nil, currency: nil, description: nil, external_id: nil, invoice_id: nil, order_id: nil, payment_id: nil, payment_intent_id: nil, refund_amount: nil, refund_id: nil, refund_status: nil, transaction_id: nil, request_options: {})
|
|
385
|
+
#
|
|
386
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
|
|
387
|
+
#
|
|
388
|
+
# @param id [String] Path param: GrowSurf program ID.
|
|
389
|
+
#
|
|
390
|
+
# @param amendment_type [Symbol, GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionParams::AmendmentType] Body param
|
|
391
|
+
#
|
|
392
|
+
# @param amount [Integer] Body param
|
|
393
|
+
#
|
|
394
|
+
# @param amount_refunded [Integer] Body param
|
|
395
|
+
#
|
|
396
|
+
# @param charge_id [String] Body param
|
|
397
|
+
#
|
|
398
|
+
# @param currency [String] Body param
|
|
399
|
+
#
|
|
400
|
+
# @param description [String] Body param
|
|
401
|
+
#
|
|
402
|
+
# @param external_id [String] Body param
|
|
403
|
+
#
|
|
404
|
+
# @param invoice_id [String] Body param
|
|
405
|
+
#
|
|
406
|
+
# @param order_id [String] Body param
|
|
407
|
+
#
|
|
408
|
+
# @param payment_id [String] Body param
|
|
409
|
+
#
|
|
410
|
+
# @param payment_intent_id [String] Body param
|
|
411
|
+
#
|
|
412
|
+
# @param refund_amount [Integer] Body param
|
|
413
|
+
#
|
|
414
|
+
# @param refund_id [String] Body param
|
|
415
|
+
#
|
|
416
|
+
# @param refund_status [String] Body param
|
|
417
|
+
#
|
|
418
|
+
# @param transaction_id [String] Body param
|
|
419
|
+
#
|
|
420
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
421
|
+
#
|
|
422
|
+
# @return [GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse]
|
|
423
|
+
#
|
|
424
|
+
# @see GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionParams
|
|
425
|
+
def refund_transaction(participant_id_or_email, params)
|
|
426
|
+
parsed, options = GrowsurfRuby::Campaign::ParticipantRefundTransactionParams.dump_request(params)
|
|
427
|
+
id =
|
|
428
|
+
parsed.delete(:id) do
|
|
429
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
430
|
+
end
|
|
431
|
+
@client.request(
|
|
432
|
+
method: :post,
|
|
433
|
+
path: ["campaign/%1$s/participant/%2$s/transaction/refund", id, participant_id_or_email],
|
|
434
|
+
body: parsed,
|
|
435
|
+
model: GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse,
|
|
436
|
+
options: options
|
|
437
|
+
)
|
|
438
|
+
end
|
|
439
|
+
|
|
380
440
|
# Sends email invites on behalf of a participant to a list of email addresses.
|
|
381
441
|
#
|
|
382
442
|
# @overload send_invites(participant_id_or_email, id:, email_addresses:, message_text:, subject_text:, request_options: {})
|
|
@@ -411,14 +471,20 @@ module GrowsurfRuby
|
|
|
411
471
|
)
|
|
412
472
|
end
|
|
413
473
|
|
|
474
|
+
# Some parameter documentations has been truncated, see
|
|
475
|
+
# {GrowsurfRuby::Models::Campaign::ParticipantTriggerReferralParams} for more
|
|
476
|
+
# details.
|
|
477
|
+
#
|
|
414
478
|
# Triggers referral credit for an existing referred participant by GrowSurf
|
|
415
479
|
# participant ID or email address.
|
|
416
480
|
#
|
|
417
|
-
# @overload trigger_referral(participant_id_or_email, id:, request_options: {})
|
|
481
|
+
# @overload trigger_referral(participant_id_or_email, id:, delay_in_days: nil, request_options: {})
|
|
418
482
|
#
|
|
419
|
-
# @param participant_id_or_email [String] GrowSurf participant ID or URL-encoded participant email address.
|
|
483
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or URL-encoded participant email address.
|
|
420
484
|
#
|
|
421
|
-
# @param id [String] GrowSurf program ID.
|
|
485
|
+
# @param id [String] Path param: GrowSurf program ID.
|
|
486
|
+
#
|
|
487
|
+
# @param delay_in_days [Integer] Body param: Number of whole days to hold referral credit before it is awarded. U
|
|
422
488
|
#
|
|
423
489
|
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
424
490
|
#
|
|
@@ -434,11 +500,40 @@ module GrowsurfRuby
|
|
|
434
500
|
@client.request(
|
|
435
501
|
method: :post,
|
|
436
502
|
path: ["campaign/%1$s/participant/%2$s/ref", id, participant_id_or_email],
|
|
503
|
+
body: parsed,
|
|
437
504
|
model: GrowsurfRuby::Models::Campaign::ParticipantTriggerReferralResponse,
|
|
438
505
|
options: options
|
|
439
506
|
)
|
|
440
507
|
end
|
|
441
508
|
|
|
509
|
+
# Cancels a pending delayed referral trigger for an existing referred participant
|
|
510
|
+
# by GrowSurf participant ID or email address.
|
|
511
|
+
#
|
|
512
|
+
# @overload cancel_delayed_referral(participant_id_or_email, id:, request_options: {})
|
|
513
|
+
#
|
|
514
|
+
# @param participant_id_or_email [String] GrowSurf participant ID or URL-encoded participant email address.
|
|
515
|
+
#
|
|
516
|
+
# @param id [String] GrowSurf program ID.
|
|
517
|
+
#
|
|
518
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
519
|
+
#
|
|
520
|
+
# @return [GrowsurfRuby::Models::Campaign::ParticipantCancelDelayedReferralResponse]
|
|
521
|
+
#
|
|
522
|
+
# @see GrowsurfRuby::Models::Campaign::ParticipantCancelDelayedReferralParams
|
|
523
|
+
def cancel_delayed_referral(participant_id_or_email, params)
|
|
524
|
+
parsed, options = GrowsurfRuby::Campaign::ParticipantCancelDelayedReferralParams.dump_request(params)
|
|
525
|
+
id =
|
|
526
|
+
parsed.delete(:id) do
|
|
527
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
528
|
+
end
|
|
529
|
+
@client.request(
|
|
530
|
+
method: :delete,
|
|
531
|
+
path: ["campaign/%1$s/participant/%2$s/ref", id, participant_id_or_email],
|
|
532
|
+
model: GrowsurfRuby::Models::Campaign::ParticipantCancelDelayedReferralResponse,
|
|
533
|
+
options: options
|
|
534
|
+
)
|
|
535
|
+
end
|
|
536
|
+
|
|
442
537
|
# @api private
|
|
443
538
|
#
|
|
444
539
|
# @param client [GrowsurfRuby::Client]
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Resources
|
|
5
|
+
class Campaign
|
|
6
|
+
class Rewards
|
|
7
|
+
# Retrieves the active, visible, and enabled rewards configured for a program.
|
|
8
|
+
#
|
|
9
|
+
# @overload list(id, request_options: {})
|
|
10
|
+
#
|
|
11
|
+
# @param id [String] GrowSurf program ID.
|
|
12
|
+
#
|
|
13
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
14
|
+
#
|
|
15
|
+
# @return [GrowsurfRuby::Models::Campaign::CampaignRewardListResponse]
|
|
16
|
+
def list(id, params = {})
|
|
17
|
+
@client.request(
|
|
18
|
+
method: :get,
|
|
19
|
+
path: ["campaign/%1$s/rewards", id],
|
|
20
|
+
model: GrowsurfRuby::Models::Campaign::CampaignRewardListResponse,
|
|
21
|
+
options: params[:request_options]
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Creates a reward for a program. The reward `type` must be compatible with the
|
|
26
|
+
# program type.
|
|
27
|
+
#
|
|
28
|
+
# @overload 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: {})
|
|
29
|
+
#
|
|
30
|
+
# @param id [String] Path param: GrowSurf program ID.
|
|
31
|
+
#
|
|
32
|
+
# @param type [Symbol, GrowsurfRuby::Models::Campaign::RewardCreateParams::Type] Body param: The reward type. Immutable after creation.
|
|
33
|
+
#
|
|
34
|
+
# @param commission_structure [GrowsurfRuby::Models::CommissionStructure] Body param
|
|
35
|
+
#
|
|
36
|
+
# @param conversions_required [Integer] Body param
|
|
37
|
+
#
|
|
38
|
+
# @param coupon_code [String] Body param
|
|
39
|
+
#
|
|
40
|
+
# @param description [String] Body param
|
|
41
|
+
#
|
|
42
|
+
# @param image_url [String] Body param
|
|
43
|
+
#
|
|
44
|
+
# @param is_active [Boolean] Body param
|
|
45
|
+
#
|
|
46
|
+
# @param is_unlimited [Boolean] Body param
|
|
47
|
+
#
|
|
48
|
+
# @param is_visible [Boolean] Body param
|
|
49
|
+
#
|
|
50
|
+
# @param limit [Integer] Body param
|
|
51
|
+
#
|
|
52
|
+
# @param limit_duration [Symbol, GrowsurfRuby::Models::Campaign::RewardCreateParams::LimitDuration] Body param
|
|
53
|
+
#
|
|
54
|
+
# @param metadata [Hash{Symbol=>Object}] Body param: Custom key/value metadata (single-level; values are stored as string
|
|
55
|
+
#
|
|
56
|
+
# @param next_milestone_prefix [String] Body param
|
|
57
|
+
#
|
|
58
|
+
# @param next_milestone_suffix [String] Body param
|
|
59
|
+
#
|
|
60
|
+
# @param number_of_winners [Integer] Body param
|
|
61
|
+
#
|
|
62
|
+
# @param order [Integer] Body param
|
|
63
|
+
#
|
|
64
|
+
# @param referral_coupon_code [String] Body param
|
|
65
|
+
#
|
|
66
|
+
# @param referral_description [String] Body param
|
|
67
|
+
#
|
|
68
|
+
# @param referred_reward_upfront [Boolean] Body param
|
|
69
|
+
#
|
|
70
|
+
# @param title [String] Body param
|
|
71
|
+
#
|
|
72
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
73
|
+
#
|
|
74
|
+
# @return [GrowsurfRuby::Models::Campaign::Reward]
|
|
75
|
+
#
|
|
76
|
+
# @see GrowsurfRuby::Models::Campaign::RewardCreateParams
|
|
77
|
+
def create(id, params)
|
|
78
|
+
parsed, options = GrowsurfRuby::Campaign::RewardCreateParams.dump_request(params)
|
|
79
|
+
@client.request(
|
|
80
|
+
method: :post,
|
|
81
|
+
path: ["campaign/%1$s/rewards", id],
|
|
82
|
+
body: parsed,
|
|
83
|
+
model: GrowsurfRuby::Models::Campaign::Reward,
|
|
84
|
+
options: options
|
|
85
|
+
)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# Updates an existing program reward. Only the fields you send are changed;
|
|
89
|
+
# `type` is immutable and must not be supplied.
|
|
90
|
+
#
|
|
91
|
+
# @overload 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: {})
|
|
92
|
+
#
|
|
93
|
+
# @param reward_id [String] Path param: Program reward ID.
|
|
94
|
+
#
|
|
95
|
+
# @param id [String] Path param: GrowSurf program ID.
|
|
96
|
+
#
|
|
97
|
+
# @param commission_structure [GrowsurfRuby::Models::CommissionStructure] Body param
|
|
98
|
+
#
|
|
99
|
+
# @param conversions_required [Integer] Body param
|
|
100
|
+
#
|
|
101
|
+
# @param coupon_code [String] Body param
|
|
102
|
+
#
|
|
103
|
+
# @param description [String] Body param
|
|
104
|
+
#
|
|
105
|
+
# @param image_url [String] Body param
|
|
106
|
+
#
|
|
107
|
+
# @param is_active [Boolean] Body param
|
|
108
|
+
#
|
|
109
|
+
# @param is_unlimited [Boolean] Body param
|
|
110
|
+
#
|
|
111
|
+
# @param is_visible [Boolean] Body param
|
|
112
|
+
#
|
|
113
|
+
# @param limit [Integer] Body param
|
|
114
|
+
#
|
|
115
|
+
# @param limit_duration [Symbol, GrowsurfRuby::Models::Campaign::RewardUpdateParams::LimitDuration] Body param
|
|
116
|
+
#
|
|
117
|
+
# @param metadata [Hash{Symbol=>Object}] Body param: Custom key/value metadata (single-level; values are stored as string
|
|
118
|
+
#
|
|
119
|
+
# @param next_milestone_prefix [String] Body param
|
|
120
|
+
#
|
|
121
|
+
# @param next_milestone_suffix [String] Body param
|
|
122
|
+
#
|
|
123
|
+
# @param number_of_winners [Integer] Body param
|
|
124
|
+
#
|
|
125
|
+
# @param order [Integer] Body param
|
|
126
|
+
#
|
|
127
|
+
# @param referral_coupon_code [String] Body param
|
|
128
|
+
#
|
|
129
|
+
# @param referral_description [String] Body param
|
|
130
|
+
#
|
|
131
|
+
# @param referred_reward_upfront [Boolean] Body param
|
|
132
|
+
#
|
|
133
|
+
# @param title [String] Body param
|
|
134
|
+
#
|
|
135
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
136
|
+
#
|
|
137
|
+
# @return [GrowsurfRuby::Models::Campaign::Reward]
|
|
138
|
+
#
|
|
139
|
+
# @see GrowsurfRuby::Models::Campaign::RewardUpdateParams
|
|
140
|
+
def update(reward_id, params)
|
|
141
|
+
parsed, options = GrowsurfRuby::Campaign::RewardUpdateParams.dump_request(params)
|
|
142
|
+
id =
|
|
143
|
+
parsed.delete(:id) do
|
|
144
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
145
|
+
end
|
|
146
|
+
@client.request(
|
|
147
|
+
method: :patch,
|
|
148
|
+
path: ["campaign/%1$s/rewards/%2$s", id, reward_id],
|
|
149
|
+
body: parsed,
|
|
150
|
+
model: GrowsurfRuby::Models::Campaign::Reward,
|
|
151
|
+
options: options
|
|
152
|
+
)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Deletes a program reward.
|
|
156
|
+
#
|
|
157
|
+
# @overload delete(reward_id, id:, request_options: {})
|
|
158
|
+
#
|
|
159
|
+
# @param reward_id [String] Program reward ID.
|
|
160
|
+
#
|
|
161
|
+
# @param id [String] GrowSurf program ID.
|
|
162
|
+
#
|
|
163
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
164
|
+
#
|
|
165
|
+
# @return [GrowsurfRuby::Models::Campaign::DeleteRewardResponse]
|
|
166
|
+
#
|
|
167
|
+
# @see GrowsurfRuby::Models::Campaign::RewardDeleteParams
|
|
168
|
+
def delete(reward_id, params)
|
|
169
|
+
parsed, options = GrowsurfRuby::Campaign::RewardDeleteParams.dump_request(params)
|
|
170
|
+
id =
|
|
171
|
+
parsed.delete(:id) do
|
|
172
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
173
|
+
end
|
|
174
|
+
@client.request(
|
|
175
|
+
method: :delete,
|
|
176
|
+
path: ["campaign/%1$s/rewards/%2$s", id, reward_id],
|
|
177
|
+
model: GrowsurfRuby::Models::Campaign::DeleteRewardResponse,
|
|
178
|
+
options: options
|
|
179
|
+
)
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
# @api private
|
|
183
|
+
#
|
|
184
|
+
# @param client [GrowsurfRuby::Client]
|
|
185
|
+
def initialize(client:)
|
|
186
|
+
@client = client
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
end
|
|
@@ -14,6 +14,10 @@ module GrowsurfRuby
|
|
|
14
14
|
# @return [GrowsurfRuby::Resources::Campaign::Commission]
|
|
15
15
|
attr_reader :commission
|
|
16
16
|
|
|
17
|
+
# Program reward configuration operations.
|
|
18
|
+
# @return [GrowsurfRuby::Resources::Campaign::Rewards]
|
|
19
|
+
attr_reader :rewards
|
|
20
|
+
|
|
17
21
|
# Retrieves a program for the given program ID.
|
|
18
22
|
#
|
|
19
23
|
# @overload retrieve(id, request_options: {})
|
|
@@ -52,6 +56,106 @@ module GrowsurfRuby
|
|
|
52
56
|
)
|
|
53
57
|
end
|
|
54
58
|
|
|
59
|
+
# Creates a program. Only `type` is required; everything else is
|
|
60
|
+
# server-defaulted.
|
|
61
|
+
#
|
|
62
|
+
# @overload create(type:, company_logo_image_url: nil, company_name: nil, currency_iso: nil, goal: nil, name: nil, options: nil, rewards: nil, request_options: {})
|
|
63
|
+
#
|
|
64
|
+
# @param type [Symbol, GrowsurfRuby::Models::CampaignCreateParams::Type] The program type. Immutable after creation.
|
|
65
|
+
#
|
|
66
|
+
# @param company_logo_image_url [String]
|
|
67
|
+
#
|
|
68
|
+
# @param company_name [String]
|
|
69
|
+
#
|
|
70
|
+
# @param currency_iso [String] ISO 4217 currency code. Defaults to USD.
|
|
71
|
+
#
|
|
72
|
+
# @param goal [String]
|
|
73
|
+
#
|
|
74
|
+
# @param name [String] The program name. Defaults to "Untitled Program".
|
|
75
|
+
#
|
|
76
|
+
# @param options [Hash{Symbol=>Object}] A curated subset of program options to shallow-merge onto the defaults.
|
|
77
|
+
#
|
|
78
|
+
# @param rewards [Array<GrowsurfRuby::Models::Campaign::RewardCreateParams>] Optional inline rewards to create with the program.
|
|
79
|
+
#
|
|
80
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
81
|
+
#
|
|
82
|
+
# @return [GrowsurfRuby::Models::CampaignAPI]
|
|
83
|
+
#
|
|
84
|
+
# @see GrowsurfRuby::Models::CampaignCreateParams
|
|
85
|
+
def create(params)
|
|
86
|
+
parsed, options = GrowsurfRuby::CampaignCreateParams.dump_request(params)
|
|
87
|
+
@client.request(
|
|
88
|
+
method: :post,
|
|
89
|
+
path: "campaigns",
|
|
90
|
+
body: parsed,
|
|
91
|
+
model: GrowsurfRuby::CampaignAPI,
|
|
92
|
+
options: options
|
|
93
|
+
)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Updates a program. Only the fields you send are changed. `type` and `urlId` are
|
|
97
|
+
# immutable.
|
|
98
|
+
#
|
|
99
|
+
# @overload 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: {})
|
|
100
|
+
#
|
|
101
|
+
# @param id [String] Path param: GrowSurf program ID.
|
|
102
|
+
#
|
|
103
|
+
# @param company_logo_image_url [String] Body param
|
|
104
|
+
#
|
|
105
|
+
# @param company_name [String] Body param
|
|
106
|
+
#
|
|
107
|
+
# @param currency_iso [String] Body param
|
|
108
|
+
#
|
|
109
|
+
# @param design [Hash{Symbol=>Object}] Body param
|
|
110
|
+
#
|
|
111
|
+
# @param emails [Hash{Symbol=>Object}] Body param
|
|
112
|
+
#
|
|
113
|
+
# @param goal [String] Body param
|
|
114
|
+
#
|
|
115
|
+
# @param installation [Hash{Symbol=>Object}] Body param
|
|
116
|
+
#
|
|
117
|
+
# @param name [String] Body param
|
|
118
|
+
#
|
|
119
|
+
# @param notifications [Hash{Symbol=>Object}] Body param
|
|
120
|
+
#
|
|
121
|
+
# @param options [Hash{Symbol=>Object}] Body param
|
|
122
|
+
#
|
|
123
|
+
# @param status [Symbol, GrowsurfRuby::Models::CampaignUpdateParams::Status] Body param: The program status. Transitions are validated; DELETED is not allowe
|
|
124
|
+
#
|
|
125
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
126
|
+
#
|
|
127
|
+
# @return [GrowsurfRuby::Models::CampaignAPI]
|
|
128
|
+
#
|
|
129
|
+
# @see GrowsurfRuby::Models::CampaignUpdateParams
|
|
130
|
+
def update(id, params)
|
|
131
|
+
parsed, options = GrowsurfRuby::CampaignUpdateParams.dump_request(params)
|
|
132
|
+
@client.request(
|
|
133
|
+
method: :patch,
|
|
134
|
+
path: ["campaign/%1$s", id],
|
|
135
|
+
body: parsed,
|
|
136
|
+
model: GrowsurfRuby::CampaignAPI,
|
|
137
|
+
options: options
|
|
138
|
+
)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Clones an existing program, returning the newly created program.
|
|
142
|
+
#
|
|
143
|
+
# @overload clone(id, request_options: {})
|
|
144
|
+
#
|
|
145
|
+
# @param id [String] GrowSurf program ID.
|
|
146
|
+
#
|
|
147
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
148
|
+
#
|
|
149
|
+
# @return [GrowsurfRuby::Models::CampaignAPI]
|
|
150
|
+
def clone(id, params = {})
|
|
151
|
+
@client.request(
|
|
152
|
+
method: :post,
|
|
153
|
+
path: ["campaign/%1$s/clone", id],
|
|
154
|
+
model: GrowsurfRuby::CampaignAPI,
|
|
155
|
+
options: params[:request_options]
|
|
156
|
+
)
|
|
157
|
+
end
|
|
158
|
+
|
|
55
159
|
# Some parameter documentations has been truncated, see
|
|
56
160
|
# {GrowsurfRuby::Models::CampaignCreateMobileParticipantTokenParams} for more
|
|
57
161
|
# details.
|
|
@@ -307,6 +411,7 @@ module GrowsurfRuby
|
|
|
307
411
|
@participant = GrowsurfRuby::Resources::Campaign::Participant.new(client: client)
|
|
308
412
|
@reward = GrowsurfRuby::Resources::Campaign::Reward.new(client: client)
|
|
309
413
|
@commission = GrowsurfRuby::Resources::Campaign::Commission.new(client: client)
|
|
414
|
+
@rewards = GrowsurfRuby::Resources::Campaign::Rewards.new(client: client)
|
|
310
415
|
end
|
|
311
416
|
end
|
|
312
417
|
end
|
data/lib/growsurf_ruby.rb
CHANGED
|
@@ -54,12 +54,16 @@ require_relative "growsurf_ruby/internal/transport/pooled_net_requester"
|
|
|
54
54
|
require_relative "growsurf_ruby/client"
|
|
55
55
|
require_relative "growsurf_ruby/models/campaign/create"
|
|
56
56
|
require_relative "growsurf_ruby/models/campaign/participant"
|
|
57
|
+
require_relative "growsurf_ruby/models/campaign/campaign_reward_list_response"
|
|
57
58
|
require_relative "growsurf_ruby/models/campaign/commission_approve_params"
|
|
58
59
|
require_relative "growsurf_ruby/models/campaign/commission_approve_response"
|
|
59
60
|
require_relative "growsurf_ruby/models/campaign/commission_delete_params"
|
|
60
61
|
require_relative "growsurf_ruby/models/campaign/commission_delete_response"
|
|
62
|
+
require_relative "growsurf_ruby/models/campaign/delete_reward_response"
|
|
61
63
|
require_relative "growsurf_ruby/models/campaign/fraud_risk_level"
|
|
62
64
|
require_relative "growsurf_ruby/models/campaign/participant_add_params"
|
|
65
|
+
require_relative "growsurf_ruby/models/campaign/participant_cancel_delayed_referral_params"
|
|
66
|
+
require_relative "growsurf_ruby/models/campaign/participant_cancel_delayed_referral_response"
|
|
63
67
|
require_relative "growsurf_ruby/models/campaign/participant_delete_params"
|
|
64
68
|
require_relative "growsurf_ruby/models/campaign/participant_delete_response"
|
|
65
69
|
require_relative "growsurf_ruby/models/campaign/participant_list_commissions_params"
|
|
@@ -69,6 +73,8 @@ require_relative "growsurf_ruby/models/campaign/participant_list_rewards_params"
|
|
|
69
73
|
require_relative "growsurf_ruby/models/campaign/participant_list_rewards_response"
|
|
70
74
|
require_relative "growsurf_ruby/models/campaign/participant_record_transaction_params"
|
|
71
75
|
require_relative "growsurf_ruby/models/campaign/participant_record_transaction_response"
|
|
76
|
+
require_relative "growsurf_ruby/models/campaign/participant_refund_transaction_params"
|
|
77
|
+
require_relative "growsurf_ruby/models/campaign/participant_refund_transaction_response"
|
|
72
78
|
require_relative "growsurf_ruby/models/campaign/participant_retrieve_params"
|
|
73
79
|
require_relative "growsurf_ruby/models/campaign/participant_reward"
|
|
74
80
|
require_relative "growsurf_ruby/models/campaign/participant_send_invites_params"
|
|
@@ -78,15 +84,19 @@ require_relative "growsurf_ruby/models/campaign/participant_trigger_referral_res
|
|
|
78
84
|
require_relative "growsurf_ruby/models/campaign/participant_update_params"
|
|
79
85
|
require_relative "growsurf_ruby/models/campaign/referral_source"
|
|
80
86
|
require_relative "growsurf_ruby/models/campaign/referral_status"
|
|
87
|
+
require_relative "growsurf_ruby/models/campaign/reward"
|
|
81
88
|
require_relative "growsurf_ruby/models/campaign/reward_approve_params"
|
|
82
89
|
require_relative "growsurf_ruby/models/campaign/reward_approve_response"
|
|
90
|
+
require_relative "growsurf_ruby/models/campaign/reward_create_params"
|
|
83
91
|
require_relative "growsurf_ruby/models/campaign/reward_delete_params"
|
|
84
92
|
require_relative "growsurf_ruby/models/campaign/reward_delete_response"
|
|
85
93
|
require_relative "growsurf_ruby/models/campaign/reward_fulfill_params"
|
|
86
94
|
require_relative "growsurf_ruby/models/campaign/reward_fulfill_response"
|
|
95
|
+
require_relative "growsurf_ruby/models/campaign/reward_update_params"
|
|
87
96
|
require_relative "growsurf_ruby/models/campaign"
|
|
88
97
|
require_relative "growsurf_ruby/models/campaign_create_mobile_participant_token_params"
|
|
89
98
|
require_relative "growsurf_ruby/models/campaign_create_mobile_participant_token_response"
|
|
99
|
+
require_relative "growsurf_ruby/models/campaign_create_params"
|
|
90
100
|
require_relative "growsurf_ruby/models/campaign_list_commissions_params"
|
|
91
101
|
require_relative "growsurf_ruby/models/campaign_list_leaderboard_params"
|
|
92
102
|
require_relative "growsurf_ruby/models/campaign_list_params"
|
|
@@ -97,6 +107,7 @@ require_relative "growsurf_ruby/models/campaign_list_response"
|
|
|
97
107
|
require_relative "growsurf_ruby/models/campaign_retrieve_analytics_params"
|
|
98
108
|
require_relative "growsurf_ruby/models/campaign_retrieve_analytics_response"
|
|
99
109
|
require_relative "growsurf_ruby/models/campaign_retrieve_params"
|
|
110
|
+
require_relative "growsurf_ruby/models/campaign_update_params"
|
|
100
111
|
require_relative "growsurf_ruby/models/commission_structure"
|
|
101
112
|
require_relative "growsurf_ruby/models/participant_commission_list"
|
|
102
113
|
require_relative "growsurf_ruby/models/participant_list"
|
|
@@ -107,3 +118,4 @@ require_relative "growsurf_ruby/resources/campaign"
|
|
|
107
118
|
require_relative "growsurf_ruby/resources/campaign/commission"
|
|
108
119
|
require_relative "growsurf_ruby/resources/campaign/participant"
|
|
109
120
|
require_relative "growsurf_ruby/resources/campaign/reward"
|
|
121
|
+
require_relative "growsurf_ruby/resources/campaign/rewards"
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
module Campaign
|
|
6
|
+
class CampaignRewardListResponse < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
OrHash =
|
|
8
|
+
T.type_alias do
|
|
9
|
+
T.any(
|
|
10
|
+
GrowsurfRuby::Models::Campaign::CampaignRewardListResponse,
|
|
11
|
+
GrowsurfRuby::Internal::AnyHash
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# The program's active, visible, and enabled rewards.
|
|
16
|
+
sig { returns(T::Array[GrowsurfRuby::Models::Campaign::Reward]) }
|
|
17
|
+
attr_accessor :rewards
|
|
18
|
+
|
|
19
|
+
# The list of a program's configured rewards.
|
|
20
|
+
sig do
|
|
21
|
+
params(
|
|
22
|
+
rewards: T::Array[GrowsurfRuby::Models::Campaign::Reward::OrHash]
|
|
23
|
+
).returns(T.attached_class)
|
|
24
|
+
end
|
|
25
|
+
def self.new(
|
|
26
|
+
# The program's active, visible, and enabled rewards.
|
|
27
|
+
rewards:
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
sig do
|
|
32
|
+
override.returns(
|
|
33
|
+
{ rewards: T::Array[GrowsurfRuby::Models::Campaign::Reward] }
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
def to_hash
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
module Campaign
|
|
6
|
+
class DeleteRewardResponse < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
OrHash =
|
|
8
|
+
T.type_alias do
|
|
9
|
+
T.any(
|
|
10
|
+
GrowsurfRuby::Models::Campaign::DeleteRewardResponse,
|
|
11
|
+
GrowsurfRuby::Internal::AnyHash
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# The deleted reward ID.
|
|
16
|
+
sig { returns(String) }
|
|
17
|
+
attr_accessor :id
|
|
18
|
+
|
|
19
|
+
sig { returns(T::Boolean) }
|
|
20
|
+
attr_accessor :success
|
|
21
|
+
|
|
22
|
+
sig do
|
|
23
|
+
params(id: String, success: T::Boolean).returns(T.attached_class)
|
|
24
|
+
end
|
|
25
|
+
def self.new(
|
|
26
|
+
# The deleted reward ID.
|
|
27
|
+
id:,
|
|
28
|
+
success:
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
sig { override.returns({ id: String, success: T::Boolean }) }
|
|
33
|
+
def to_hash
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
module Campaign
|
|
6
|
+
class ParticipantCancelDelayedReferralParams < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
extend GrowsurfRuby::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include GrowsurfRuby::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
GrowsurfRuby::Campaign::ParticipantCancelDelayedReferralParams,
|
|
14
|
+
GrowsurfRuby::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
sig { returns(String) }
|
|
19
|
+
attr_accessor :id
|
|
20
|
+
|
|
21
|
+
sig { returns(String) }
|
|
22
|
+
attr_accessor :participant_id_or_email
|
|
23
|
+
|
|
24
|
+
sig do
|
|
25
|
+
params(
|
|
26
|
+
id: String,
|
|
27
|
+
participant_id_or_email: String,
|
|
28
|
+
request_options: GrowsurfRuby::RequestOptions::OrHash
|
|
29
|
+
).returns(T.attached_class)
|
|
30
|
+
end
|
|
31
|
+
def self.new(id:, participant_id_or_email:, request_options: {})
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
sig do
|
|
35
|
+
override.returns(
|
|
36
|
+
{
|
|
37
|
+
id: String,
|
|
38
|
+
participant_id_or_email: String,
|
|
39
|
+
request_options: GrowsurfRuby::RequestOptions
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
end
|
|
43
|
+
def to_hash
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
module Campaign
|
|
6
|
+
class ParticipantCancelDelayedReferralResponse < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
OrHash =
|
|
8
|
+
T.type_alias do
|
|
9
|
+
T.any(
|
|
10
|
+
GrowsurfRuby::Models::Campaign::ParticipantCancelDelayedReferralResponse,
|
|
11
|
+
GrowsurfRuby::Internal::AnyHash
|
|
12
|
+
)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
sig { returns(T::Boolean) }
|
|
16
|
+
attr_accessor :success
|
|
17
|
+
|
|
18
|
+
sig { returns(T.nilable(String)) }
|
|
19
|
+
attr_reader :message
|
|
20
|
+
|
|
21
|
+
sig { params(message: String).void }
|
|
22
|
+
attr_writer :message
|
|
23
|
+
|
|
24
|
+
sig do
|
|
25
|
+
params(success: T::Boolean, message: String).returns(T.attached_class)
|
|
26
|
+
end
|
|
27
|
+
def self.new(success:, message: nil)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
sig { override.returns({ success: T::Boolean, message: String }) }
|
|
31
|
+
def to_hash
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|