growsurf-ruby 1.3.0 → 1.5.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 +29 -0
- data/README.md +10 -7
- data/lib/growsurf_ruby/internal/transport/base_client.rb +6 -1
- data/lib/growsurf_ruby/internal/type/base_model.rb +26 -0
- data/lib/growsurf_ruby/internal/type/base_page.rb +6 -0
- data/lib/growsurf_ruby/models/account_create_response.rb +3 -3
- data/lib/growsurf_ruby/models/analytics_availability.rb +16 -0
- data/lib/growsurf_ruby/models/analytics_unavailable_reason.rb +20 -0
- data/lib/growsurf_ruby/models/campaign/delete_program_resource_response.rb +12 -0
- data/lib/growsurf_ruby/models/campaign/integration.rb +69 -0
- data/lib/growsurf_ruby/models/campaign/integration_list_response.rb +24 -0
- data/lib/growsurf_ruby/models/campaign/participant_activation_analytics.rb +75 -0
- data/lib/growsurf_ruby/models/campaign/participant_analytics_response.rb +11 -0
- data/lib/growsurf_ruby/models/campaign/participant_get_payout_destination_response.rb +17 -17
- data/lib/growsurf_ruby/models/campaign/participant_record_transaction_params.rb +9 -1
- data/lib/growsurf_ruby/models/campaign/participant_refund_transaction_params.rb +17 -1
- data/lib/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_response.rb +8 -8
- data/lib/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rb +15 -11
- data/lib/growsurf_ruby/models/campaign/participant_reward.rb +16 -3
- data/lib/growsurf_ruby/models/campaign/program_resource.rb +51 -0
- data/lib/growsurf_ruby/models/campaign/program_resource_create_params.rb +32 -0
- data/lib/growsurf_ruby/models/campaign/program_resource_delete_params.rb +14 -0
- data/lib/growsurf_ruby/models/campaign/program_resource_list_response.rb +12 -0
- data/lib/growsurf_ruby/models/campaign/program_resource_update_params.rb +35 -0
- data/lib/growsurf_ruby/models/campaign/program_resource_upload_result.rb +33 -0
- data/lib/growsurf_ruby/models/campaign/program_resource_upload_ticket.rb +26 -0
- data/lib/growsurf_ruby/models/campaign/program_resource_upload_ticket_params.rb +17 -0
- data/lib/growsurf_ruby/models/campaign/reward.rb +22 -1
- data/lib/growsurf_ruby/models/campaign/reward_create_params.rb +32 -9
- data/lib/growsurf_ruby/models/campaign/reward_update_params.rb +32 -9
- data/lib/growsurf_ruby/models/campaign.rb +25 -2
- data/lib/growsurf_ruby/models/campaign_activation_analytics_response.rb +186 -0
- data/lib/growsurf_ruby/models/campaign_create_params.rb +37 -1
- data/lib/growsurf_ruby/models/campaign_engagement_analytics.rb +174 -0
- data/lib/growsurf_ruby/models/campaign_retrieve_activation_analytics_params.rb +35 -0
- data/lib/growsurf_ruby/models/campaign_retrieve_analytics_params.rb +37 -4
- data/lib/growsurf_ruby/models/campaign_retrieve_analytics_response.rb +3 -0
- data/lib/growsurf_ruby/models/commission_structure.rb +19 -3
- data/lib/growsurf_ruby/models/participant_commission_list.rb +24 -6
- data/lib/growsurf_ruby/models/participant_payout_list.rb +5 -5
- data/lib/growsurf_ruby/models.rb +7 -0
- data/lib/growsurf_ruby/resources/account.rb +17 -11
- data/lib/growsurf_ruby/resources/campaign/design.rb +11 -5
- data/lib/growsurf_ruby/resources/campaign/emails.rb +2 -1
- data/lib/growsurf_ruby/resources/campaign/integrations.rb +41 -0
- data/lib/growsurf_ruby/resources/campaign/participant.rb +28 -25
- data/lib/growsurf_ruby/resources/campaign/program_resources.rb +112 -0
- data/lib/growsurf_ruby/resources/campaign/rewards.rb +12 -6
- data/lib/growsurf_ruby/resources/campaign.rb +53 -7
- data/lib/growsurf_ruby/resources/team.rb +7 -5
- data/lib/growsurf_ruby/version.rb +1 -1
- data/lib/growsurf_ruby.rb +19 -0
- data/rbi/growsurf_ruby/internal/type/base_model.rbi +10 -0
- data/rbi/growsurf_ruby/internal/type/base_page.rbi +3 -0
- data/rbi/growsurf_ruby/models/analytics_availability.rbi +19 -0
- data/rbi/growsurf_ruby/models/analytics_unavailable_reason.rbi +23 -0
- data/rbi/growsurf_ruby/models/campaign/delete_program_resource_response.rbi +33 -0
- data/rbi/growsurf_ruby/models/campaign/integration.rbi +93 -0
- data/rbi/growsurf_ruby/models/campaign/integration_list_response.rbi +46 -0
- data/rbi/growsurf_ruby/models/campaign/participant_activation_analytics.rbi +133 -0
- data/rbi/growsurf_ruby/models/campaign/participant_analytics_response.rbi +35 -0
- data/rbi/growsurf_ruby/models/campaign/participant_get_payout_destination_response.rbi +17 -23
- data/rbi/growsurf_ruby/models/campaign/participant_record_transaction_params.rbi +18 -0
- data/rbi/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbi +18 -0
- data/rbi/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_response.rbi +7 -9
- data/rbi/growsurf_ruby/models/campaign/participant_retrieve_analytics_params.rbi +16 -10
- data/rbi/growsurf_ruby/models/campaign/participant_reward.rbi +29 -6
- data/rbi/growsurf_ruby/models/campaign/program_resource.rbi +186 -0
- data/rbi/growsurf_ruby/models/campaign/program_resource_create_params.rbi +95 -0
- data/rbi/growsurf_ruby/models/campaign/program_resource_delete_params.rbi +37 -0
- data/rbi/growsurf_ruby/models/campaign/program_resource_list_response.rbi +29 -0
- data/rbi/growsurf_ruby/models/campaign/program_resource_update_params.rbi +105 -0
- data/rbi/growsurf_ruby/models/campaign/program_resource_upload_result.rbi +94 -0
- data/rbi/growsurf_ruby/models/campaign/program_resource_upload_ticket.rbi +57 -0
- data/rbi/growsurf_ruby/models/campaign/program_resource_upload_ticket_params.rbi +53 -0
- data/rbi/growsurf_ruby/models/campaign/reward.rbi +55 -0
- data/rbi/growsurf_ruby/models/campaign/reward_create_params.rbi +97 -24
- data/rbi/growsurf_ruby/models/campaign/reward_update_params.rbi +97 -24
- data/rbi/growsurf_ruby/models/campaign.rbi +52 -3
- data/rbi/growsurf_ruby/models/campaign_activation_analytics_response.rbi +325 -0
- data/rbi/growsurf_ruby/models/campaign_create_params.rbi +91 -0
- data/rbi/growsurf_ruby/models/campaign_engagement_analytics.rbi +369 -0
- data/rbi/growsurf_ruby/models/campaign_retrieve_activation_analytics_params.rbi +59 -0
- data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_params.rbi +56 -3
- data/rbi/growsurf_ruby/models/campaign_retrieve_analytics_response.rbi +27 -7
- data/rbi/growsurf_ruby/models/commission_structure.rbi +36 -3
- data/rbi/growsurf_ruby/models/participant_commission_list.rbi +63 -15
- data/rbi/growsurf_ruby/models/participant_payout_list.rbi +15 -15
- data/rbi/growsurf_ruby/models.rbi +7 -0
- data/rbi/growsurf_ruby/resources/account.rbi +9 -6
- data/rbi/growsurf_ruby/resources/campaign/design.rbi +32 -4
- data/rbi/growsurf_ruby/resources/campaign/emails.rbi +2 -1
- data/rbi/growsurf_ruby/resources/campaign/integrations.rbi +35 -0
- data/rbi/growsurf_ruby/resources/campaign/participant.rbi +38 -24
- data/rbi/growsurf_ruby/resources/campaign/program_resources.rbi +116 -0
- data/rbi/growsurf_ruby/resources/campaign/rewards.rbi +35 -16
- data/rbi/growsurf_ruby/resources/campaign.rbi +53 -5
- data/rbi/growsurf_ruby/resources/team.rbi +7 -5
- data/sig/growsurf_ruby/internal/type/base_model.rbs +6 -0
- data/sig/growsurf_ruby/internal/type/base_page.rbs +2 -0
- data/sig/growsurf_ruby/models/analytics_availability.rbs +15 -0
- data/sig/growsurf_ruby/models/analytics_unavailable_reason.rbs +26 -0
- data/sig/growsurf_ruby/models/campaign/delete_program_resource_response.rbs +14 -0
- data/sig/growsurf_ruby/models/campaign/integration.rbs +47 -0
- data/sig/growsurf_ruby/models/campaign/integration_list_response.rbs +20 -0
- data/sig/growsurf_ruby/models/campaign/participant_activation_analytics.rbs +96 -0
- data/sig/growsurf_ruby/models/campaign/participant_analytics_response.rbs +22 -1
- data/sig/growsurf_ruby/models/campaign/participant_get_payout_destination_response.rbs +17 -22
- data/sig/growsurf_ruby/models/campaign/participant_record_transaction_params.rbs +15 -1
- data/sig/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbs +15 -1
- data/sig/growsurf_ruby/models/campaign/participant_request_payout_destination_confirmation_response.rbs +8 -10
- data/sig/growsurf_ruby/models/campaign/participant_reward.rbs +24 -9
- data/sig/growsurf_ruby/models/campaign/program_resource.rbs +94 -0
- data/sig/growsurf_ruby/models/campaign/program_resource_create_params.rbs +45 -0
- data/sig/growsurf_ruby/models/campaign/program_resource_delete_params.rbs +22 -0
- data/sig/growsurf_ruby/models/campaign/program_resource_list_response.rbs +14 -0
- data/sig/growsurf_ruby/models/campaign/program_resource_update_params.rbs +48 -0
- data/sig/growsurf_ruby/models/campaign/program_resource_upload_result.rbs +58 -0
- data/sig/growsurf_ruby/models/campaign/program_resource_upload_ticket.rbs +29 -0
- data/sig/growsurf_ruby/models/campaign/program_resource_upload_ticket_params.rbs +29 -0
- data/sig/growsurf_ruby/models/campaign/reward.rbs +16 -0
- data/sig/growsurf_ruby/models/campaign/reward_create_params.rbs +54 -34
- data/sig/growsurf_ruby/models/campaign/reward_update_params.rbs +54 -34
- data/sig/growsurf_ruby/models/campaign.rbs +23 -5
- data/sig/growsurf_ruby/models/campaign_activation_analytics_response.rbs +202 -0
- data/sig/growsurf_ruby/models/campaign_create_params.rbs +29 -0
- data/sig/growsurf_ruby/models/campaign_engagement_analytics.rbs +186 -0
- data/sig/growsurf_ruby/models/campaign_retrieve_activation_analytics_params.rbs +45 -0
- data/sig/growsurf_ruby/models/campaign_retrieve_analytics_params.rbs +30 -1
- data/sig/growsurf_ruby/models/campaign_retrieve_analytics_response.rbs +21 -3
- data/sig/growsurf_ruby/models/commission_structure.rbs +16 -4
- data/sig/growsurf_ruby/models/participant_commission_list.rbs +36 -20
- data/sig/growsurf_ruby/models/participant_payout_list.rbs +20 -20
- data/sig/growsurf_ruby/models.rbs +6 -0
- data/sig/growsurf_ruby/resources/campaign/design.rbs +19 -0
- data/sig/growsurf_ruby/resources/campaign/integrations.rbs +14 -0
- data/sig/growsurf_ruby/resources/campaign/participant.rbs +4 -0
- data/sig/growsurf_ruby/resources/campaign/program_resources.rbs +58 -0
- data/sig/growsurf_ruby/resources/campaign/rewards.rbs +14 -12
- data/sig/growsurf_ruby/resources/campaign.rbs +17 -0
- metadata +59 -2
|
@@ -46,6 +46,12 @@ module GrowsurfRuby
|
|
|
46
46
|
# @return [String]
|
|
47
47
|
required :currency_iso, String, api_name: :currencyISO
|
|
48
48
|
|
|
49
|
+
# @!attribute event
|
|
50
|
+
# The event that generated this commission. Legacy commissions return `SALE`.
|
|
51
|
+
#
|
|
52
|
+
# @return [Symbol, GrowsurfRuby::Models::ParticipantCommissionList::Commission::Event]
|
|
53
|
+
required :event, enum: -> { GrowsurfRuby::ParticipantCommissionList::Commission::Event }
|
|
54
|
+
|
|
49
55
|
# @!attribute referred_id
|
|
50
56
|
#
|
|
51
57
|
# @return [String]
|
|
@@ -74,7 +80,7 @@ module GrowsurfRuby
|
|
|
74
80
|
# @!attribute approved_at
|
|
75
81
|
#
|
|
76
82
|
# @return [Integer, nil]
|
|
77
|
-
optional :approved_at, Integer, api_name: :approvedAt
|
|
83
|
+
optional :approved_at, Integer, api_name: :approvedAt, nil?: true
|
|
78
84
|
|
|
79
85
|
# @!attribute campaign_currency_iso
|
|
80
86
|
#
|
|
@@ -89,7 +95,7 @@ module GrowsurfRuby
|
|
|
89
95
|
# @!attribute exchange_rate_at
|
|
90
96
|
#
|
|
91
97
|
# @return [Integer, nil]
|
|
92
|
-
optional :exchange_rate_at, Integer, api_name: :exchangeRateAt
|
|
98
|
+
optional :exchange_rate_at, Integer, api_name: :exchangeRateAt, nil?: true
|
|
93
99
|
|
|
94
100
|
# @!attribute fx_error
|
|
95
101
|
#
|
|
@@ -104,12 +110,12 @@ module GrowsurfRuby
|
|
|
104
110
|
# @!attribute paid_at
|
|
105
111
|
#
|
|
106
112
|
# @return [Integer, nil]
|
|
107
|
-
optional :paid_at, Integer, api_name: :paidAt
|
|
113
|
+
optional :paid_at, Integer, api_name: :paidAt, nil?: true
|
|
108
114
|
|
|
109
115
|
# @!attribute payout_queued_at
|
|
110
116
|
#
|
|
111
117
|
# @return [Integer, nil]
|
|
112
|
-
optional :payout_queued_at, Integer, api_name: :payoutQueuedAt
|
|
118
|
+
optional :payout_queued_at, Integer, api_name: :payoutQueuedAt, nil?: true
|
|
113
119
|
|
|
114
120
|
# @!attribute provider
|
|
115
121
|
#
|
|
@@ -119,7 +125,7 @@ module GrowsurfRuby
|
|
|
119
125
|
# @!attribute reversed_at
|
|
120
126
|
#
|
|
121
127
|
# @return [Integer, nil]
|
|
122
|
-
optional :reversed_at, Integer, api_name: :reversedAt
|
|
128
|
+
optional :reversed_at, Integer, api_name: :reversedAt, nil?: true
|
|
123
129
|
|
|
124
130
|
# @!attribute sale_amount_in_campaign_currency
|
|
125
131
|
#
|
|
@@ -129,11 +135,12 @@ module GrowsurfRuby
|
|
|
129
135
|
api_name: :saleAmountInCampaignCurrency,
|
|
130
136
|
nil?: true
|
|
131
137
|
|
|
132
|
-
# @!method initialize(id:, amount:, created_at:, currency_iso:, referred_id:, referrer_id:, sale_amount:, status:, amount_in_campaign_currency: nil, approved_at: nil, campaign_currency_iso: nil, exchange_rate: nil, exchange_rate_at: nil, fx_error: nil, hold_duration: nil, paid_at: nil, payout_queued_at: nil, provider: nil, reversed_at: nil, sale_amount_in_campaign_currency: nil)
|
|
138
|
+
# @!method initialize(id:, amount:, created_at:, currency_iso:, event:, referred_id:, referrer_id:, sale_amount:, status:, amount_in_campaign_currency: nil, approved_at: nil, campaign_currency_iso: nil, exchange_rate: nil, exchange_rate_at: nil, fx_error: nil, hold_duration: nil, paid_at: nil, payout_queued_at: nil, provider: nil, reversed_at: nil, sale_amount_in_campaign_currency: nil)
|
|
133
139
|
# @param id [String]
|
|
134
140
|
# @param amount [Integer, nil]
|
|
135
141
|
# @param created_at [Integer]
|
|
136
142
|
# @param currency_iso [String]
|
|
143
|
+
# @param event [Symbol, GrowsurfRuby::Models::ParticipantCommissionList::Commission::Event] The event that generated this commission. Legacy commissions return `SALE`.
|
|
137
144
|
# @param referred_id [String]
|
|
138
145
|
# @param referrer_id [String]
|
|
139
146
|
# @param sale_amount [Integer, nil]
|
|
@@ -151,6 +158,17 @@ module GrowsurfRuby
|
|
|
151
158
|
# @param reversed_at [Integer]
|
|
152
159
|
# @param sale_amount_in_campaign_currency [Integer, nil]
|
|
153
160
|
|
|
161
|
+
# @see GrowsurfRuby::Models::ParticipantCommissionList::Commission#event
|
|
162
|
+
module Event
|
|
163
|
+
extend GrowsurfRuby::Internal::Type::Enum
|
|
164
|
+
|
|
165
|
+
LEAD = :LEAD
|
|
166
|
+
SALE = :SALE
|
|
167
|
+
|
|
168
|
+
# @!method self.values
|
|
169
|
+
# @return [Array<Symbol>]
|
|
170
|
+
end
|
|
171
|
+
|
|
154
172
|
# @see GrowsurfRuby::Models::ParticipantCommissionList::Commission#status
|
|
155
173
|
module Status
|
|
156
174
|
extend GrowsurfRuby::Internal::Type::Enum
|
|
@@ -79,12 +79,12 @@ module GrowsurfRuby
|
|
|
79
79
|
# @!attribute exchange_rate_at
|
|
80
80
|
#
|
|
81
81
|
# @return [Integer, nil]
|
|
82
|
-
optional :exchange_rate_at, Integer, api_name: :exchangeRateAt
|
|
82
|
+
optional :exchange_rate_at, Integer, api_name: :exchangeRateAt, nil?: true
|
|
83
83
|
|
|
84
84
|
# @!attribute failed_at
|
|
85
85
|
#
|
|
86
86
|
# @return [Integer, nil]
|
|
87
|
-
optional :failed_at, Integer, api_name: :failedAt
|
|
87
|
+
optional :failed_at, Integer, api_name: :failedAt, nil?: true
|
|
88
88
|
|
|
89
89
|
# @!attribute fx_error
|
|
90
90
|
#
|
|
@@ -94,7 +94,7 @@ module GrowsurfRuby
|
|
|
94
94
|
# @!attribute issued_at
|
|
95
95
|
#
|
|
96
96
|
# @return [Integer, nil]
|
|
97
|
-
optional :issued_at, Integer, api_name: :issuedAt
|
|
97
|
+
optional :issued_at, Integer, api_name: :issuedAt, nil?: true
|
|
98
98
|
|
|
99
99
|
# @!attribute provider
|
|
100
100
|
#
|
|
@@ -104,12 +104,12 @@ module GrowsurfRuby
|
|
|
104
104
|
# @!attribute queued_at
|
|
105
105
|
#
|
|
106
106
|
# @return [Integer, nil]
|
|
107
|
-
optional :queued_at, Integer, api_name: :queuedAt
|
|
107
|
+
optional :queued_at, Integer, api_name: :queuedAt, nil?: true
|
|
108
108
|
|
|
109
109
|
# @!attribute reversed_at
|
|
110
110
|
#
|
|
111
111
|
# @return [Integer, nil]
|
|
112
|
-
optional :reversed_at, Integer, api_name: :reversedAt
|
|
112
|
+
optional :reversed_at, Integer, api_name: :reversedAt, nil?: true
|
|
113
113
|
|
|
114
114
|
# @!method initialize(id:, amount:, commission_ids:, created_at:, currency_iso:, participant_id:, status:, amount_in_campaign_currency: nil, campaign_currency_iso: nil, exchange_rate: nil, exchange_rate_at: nil, failed_at: nil, fx_error: nil, issued_at: nil, provider: nil, queued_at: nil, reversed_at: nil)
|
|
115
115
|
# @param id [String]
|
data/lib/growsurf_ruby/models.rb
CHANGED
|
@@ -41,6 +41,10 @@ module GrowsurfRuby
|
|
|
41
41
|
|
|
42
42
|
AccountCreateParams = GrowsurfRuby::Models::AccountCreateParams
|
|
43
43
|
|
|
44
|
+
AnalyticsAvailability = GrowsurfRuby::Models::AnalyticsAvailability
|
|
45
|
+
|
|
46
|
+
AnalyticsUnavailableReason = GrowsurfRuby::Models::AnalyticsUnavailableReason
|
|
47
|
+
|
|
44
48
|
AffiliateApplication = GrowsurfRuby::Models::AffiliateApplication
|
|
45
49
|
|
|
46
50
|
AffiliateInvite = GrowsurfRuby::Models::AffiliateInvite
|
|
@@ -81,6 +85,9 @@ module GrowsurfRuby
|
|
|
81
85
|
CampaignRetrieveAffiliateApplicationParams =
|
|
82
86
|
GrowsurfRuby::Models::CampaignRetrieveAffiliateApplicationParams
|
|
83
87
|
|
|
88
|
+
CampaignRetrieveActivationAnalyticsParams =
|
|
89
|
+
GrowsurfRuby::Models::CampaignRetrieveActivationAnalyticsParams
|
|
90
|
+
|
|
84
91
|
CampaignRetrieveAnalyticsParams = GrowsurfRuby::Models::CampaignRetrieveAnalyticsParams
|
|
85
92
|
|
|
86
93
|
CampaignRetrieveParams = GrowsurfRuby::Models::CampaignRetrieveParams
|
|
@@ -4,19 +4,25 @@ module GrowsurfRuby
|
|
|
4
4
|
module Resources
|
|
5
5
|
class Account
|
|
6
6
|
# Creates a new GrowSurf account. This is the only endpoint that does not require
|
|
7
|
-
# an API key.
|
|
8
|
-
#
|
|
7
|
+
# an API key. Before calling it, an authorized account owner must review and
|
|
8
|
+
# approve GrowSurf's [Terms of Service](https://growsurf.com/terms) and [Privacy
|
|
9
|
+
# Policy](https://growsurf.com/privacy). The account starts a 14-day Business
|
|
10
|
+
# trial without a credit card. The response includes an API key for the new
|
|
11
|
+
# account, shown once in the response. The key is a secret: store it in a secret
|
|
12
|
+
# manager and do not put it in logs, screenshots, URLs, model context, analytics,
|
|
13
|
+
# or generated output. The key is locked until the team owner's email address is
|
|
9
14
|
# verified: authenticated program and resource endpoints return a `403` with error
|
|
10
15
|
# code `EMAIL_NOT_VERIFIED_ERROR` until then (resend the email via `POST
|
|
11
|
-
# /team/owner/verification-email`, then retry).
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
16
|
+
# /team/owner/verification-email`, then retry). Verification unlocks this same key
|
|
17
|
+
# - keep it and retry rather than requesting a replacement. A welcome email is
|
|
18
|
+
# sent to the address with the verification link and a set-password link for
|
|
19
|
+
# dashboard access. Accounts whose email is never verified are deleted
|
|
20
|
+
# automatically after 7 days. Separately, for security, the API key is replaced
|
|
21
|
+
# the first time the account owner signs in to the GrowSurf dashboard; email
|
|
22
|
+
# verification does not trigger that, and the previous key then returns a `403`
|
|
23
|
+
# with error code `NOT_AUTHORIZED_ERROR`. Some actions (such as emailing participants)
|
|
24
|
+
# additionally require GrowSurf to verify the team first. Calling this endpoint
|
|
25
|
+
# accepts those policies on the account holder's behalf.
|
|
20
26
|
#
|
|
21
27
|
# @overload create(email:, company: nil, first_name: nil, last_name: nil, request_options: {})
|
|
22
28
|
#
|
|
@@ -7,8 +7,11 @@ module GrowsurfRuby
|
|
|
7
7
|
# Retrieves a program's configured design fields: the dashboard Program Editor's **Design**
|
|
8
8
|
# tab plus the payout-destination confirmation page copy configured from payout integration
|
|
9
9
|
# cards. This includes the GrowSurf window layout, header, share channels and invites,
|
|
10
|
-
# signup form, portal and landing pages, theme styling, and referral
|
|
11
|
-
# and status sections.
|
|
10
|
+
# signup form, Resources presentation, portal and landing pages, theme styling, and referral
|
|
11
|
+
# or affiliate summary and status sections. `referredExperience` includes the Claim Offer Popup for both program
|
|
12
|
+
# types, with its colors under `theme.referredExperienceOfferPopup`.
|
|
13
|
+
# `participantAvatarStyle` is `CHARACTERS`, `INITIALS`, `ANIMALS`, or `GRADIENT`; missing or
|
|
14
|
+
# unknown values mean `INITIALS`.
|
|
12
15
|
# `payoutDestinationConfirmation` is omitted when no confirmation fields are stored. Stored
|
|
13
16
|
# `null` fields are returned as `null`; omitted and `null` fields use localized defaults.
|
|
14
17
|
#
|
|
@@ -29,7 +32,8 @@ module GrowsurfRuby
|
|
|
29
32
|
end
|
|
30
33
|
|
|
31
34
|
# Updates a program's design configuration, including the payout-destination confirmation
|
|
32
|
-
# page copy
|
|
35
|
+
# page copy and the Claim Offer Popup under `referredExperience`. Only the fields you send
|
|
36
|
+
# are changed;
|
|
33
37
|
# anything you leave out is untouched (arrays such as `signup.fields` replace wholesale).
|
|
34
38
|
# Unknown fields, fields not available for the program type, and invalid values return a
|
|
35
39
|
# `400`. Landing-page custom code and JavaScript are not editable via the API.
|
|
@@ -38,8 +42,10 @@ module GrowsurfRuby
|
|
|
38
42
|
#
|
|
39
43
|
# @param id [String] GrowSurf program ID.
|
|
40
44
|
#
|
|
41
|
-
# @param body [Hash{Symbol=>Object}] Partial design configuration to merge
|
|
42
|
-
# `
|
|
45
|
+
# @param body [Hash{Symbol=>Object}] Partial design configuration to merge. `resources`
|
|
46
|
+
# accepts `isPublicDisplayed`, `title`, `viewResourcesLinkText`, `backLinkText`,
|
|
47
|
+
# `copyButtonText`, `copiedText`, `emptyState`, and `icon` (`type`: `DEFAULT`, `IMAGE`, or `NONE`, plus
|
|
48
|
+
# `imageUrl` for `IMAGE`). Resource items use the Program Resources operations.
|
|
43
49
|
#
|
|
44
50
|
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
45
51
|
#
|
|
@@ -8,7 +8,8 @@ module GrowsurfRuby
|
|
|
8
8
|
# Program Editor's **Emails** tab. Returns each editable email template
|
|
9
9
|
# (`subject`, `preheader`, `body`, `isEnabled`) plus the `settings` block (sender,
|
|
10
10
|
# contact, and design). The set of email templates returned depends on the program
|
|
11
|
-
# type (referral vs affiliate).
|
|
11
|
+
# type (referral vs affiliate). `offerClaimed` is available to both program types and sends
|
|
12
|
+
# while the Claim Offer Popup is enabled.
|
|
12
13
|
#
|
|
13
14
|
# @overload retrieve(id, request_options: {})
|
|
14
15
|
#
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Resources
|
|
5
|
+
class Campaign
|
|
6
|
+
class Integrations
|
|
7
|
+
# Lists every integration this program can connect, each with its current state.
|
|
8
|
+
# Integrations that do not apply to the program type are omitted (for example,
|
|
9
|
+
# Wise on a referral program). Read-only: connecting an integration is an OAuth or
|
|
10
|
+
# credential handshake completed in the GrowSurf dashboard, so it cannot be done
|
|
11
|
+
# over the API. `connected` means credentials are stored, `enabled` means the
|
|
12
|
+
# integration is switched on and working, and `autoDisabled` means GrowSurf
|
|
13
|
+
# switched it off after repeated delivery failures — its credentials are still
|
|
14
|
+
# stored, but it delivers nothing until it is reconnected in the dashboard.
|
|
15
|
+
#
|
|
16
|
+
# @overload list(id, request_options: {})
|
|
17
|
+
#
|
|
18
|
+
# @param id [String] GrowSurf program ID.
|
|
19
|
+
#
|
|
20
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
21
|
+
#
|
|
22
|
+
# @return [GrowsurfRuby::Models::Campaign::IntegrationListResponse]
|
|
23
|
+
def list(id, params = {})
|
|
24
|
+
@client.request(
|
|
25
|
+
method: :get,
|
|
26
|
+
path: ["campaign/%1$s/integrations", id],
|
|
27
|
+
model: GrowsurfRuby::Models::Campaign::IntegrationListResponse,
|
|
28
|
+
options: params[:request_options]
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# @api private
|
|
33
|
+
#
|
|
34
|
+
# @param client [GrowsurfRuby::Client]
|
|
35
|
+
def initialize(client:)
|
|
36
|
+
@client = client
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -8,7 +8,7 @@ module GrowsurfRuby
|
|
|
8
8
|
#
|
|
9
9
|
# @overload retrieve(participant_id_or_email, id:, request_options: {})
|
|
10
10
|
#
|
|
11
|
-
# @param participant_id_or_email [String] GrowSurf participant ID or
|
|
11
|
+
# @param participant_id_or_email [String] GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
12
12
|
#
|
|
13
13
|
# @param id [String] GrowSurf program ID.
|
|
14
14
|
#
|
|
@@ -39,7 +39,7 @@ module GrowsurfRuby
|
|
|
39
39
|
#
|
|
40
40
|
# @overload update(participant_id_or_email, id:, affiliate_status: nil, email: nil, first_name: nil, last_name: nil, metadata: nil, notes: nil, referral_status: nil, referred_by: nil, unsubscribed: nil, vanity_keys: nil, request_options: {})
|
|
41
41
|
#
|
|
42
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
42
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
43
43
|
#
|
|
44
44
|
# @param id [String] Path param: GrowSurf program ID.
|
|
45
45
|
#
|
|
@@ -87,7 +87,7 @@ module GrowsurfRuby
|
|
|
87
87
|
#
|
|
88
88
|
# @overload delete(participant_id_or_email, id:, request_options: {})
|
|
89
89
|
#
|
|
90
|
-
# @param participant_id_or_email [String] GrowSurf participant ID or
|
|
90
|
+
# @param participant_id_or_email [String] GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
91
91
|
#
|
|
92
92
|
# @param id [String] GrowSurf program ID.
|
|
93
93
|
#
|
|
@@ -200,7 +200,7 @@ module GrowsurfRuby
|
|
|
200
200
|
#
|
|
201
201
|
# @overload list_commissions(participant_id_or_email, id:, limit: nil, next_id: nil, status: nil, request_options: {})
|
|
202
202
|
#
|
|
203
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
203
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
204
204
|
#
|
|
205
205
|
# @param id [String] Path param: GrowSurf program ID.
|
|
206
206
|
#
|
|
@@ -236,7 +236,7 @@ module GrowsurfRuby
|
|
|
236
236
|
#
|
|
237
237
|
# @overload list_payouts(participant_id_or_email, id:, limit: nil, next_id: nil, status: nil, request_options: {})
|
|
238
238
|
#
|
|
239
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
239
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
240
240
|
#
|
|
241
241
|
# @param id [String] Path param: GrowSurf program ID.
|
|
242
242
|
#
|
|
@@ -271,7 +271,7 @@ module GrowsurfRuby
|
|
|
271
271
|
#
|
|
272
272
|
# @overload list_referrals(participant_id_or_email, 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: {})
|
|
273
273
|
#
|
|
274
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
274
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
275
275
|
#
|
|
276
276
|
# @param id [String] Path param: GrowSurf program ID.
|
|
277
277
|
#
|
|
@@ -324,7 +324,7 @@ module GrowsurfRuby
|
|
|
324
324
|
#
|
|
325
325
|
# @overload list_rewards(participant_id_or_email, id:, limit: nil, next_id: nil, request_options: {})
|
|
326
326
|
#
|
|
327
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
327
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
328
328
|
#
|
|
329
329
|
# @param id [String] Path param: GrowSurf program ID.
|
|
330
330
|
#
|
|
@@ -360,9 +360,9 @@ module GrowsurfRuby
|
|
|
360
360
|
# de-duplicated — without one, a resent sale would create a second commission.
|
|
361
361
|
# Reuse the same identifier(s) when refunding.
|
|
362
362
|
#
|
|
363
|
-
# @overload record_transaction(participant_id_or_email, id:, currency:, gross_amount:, amount_cash_net: nil, amount_paid: nil, charge_id: nil, customer_id: nil, description: nil, external_id: nil, invoice_id: nil, invoice_subtotal_excluding_tax: nil, invoice_total: nil, invoice_total_excluding_tax: nil, net_amount: nil, order_id: nil, paid_at: nil, payment_id: nil, payment_intent_id: nil, subscription_id: nil, tax_amount: nil, total_tax_amount: nil, total_tax_amounts: nil, total_taxes: nil, transaction_id: nil, request_options: {})
|
|
363
|
+
# @overload record_transaction(participant_id_or_email, id:, currency:, gross_amount:, amount_cash_net: nil, amount_paid: nil, charge_id: nil, customer_id: nil, description: nil, external_id: nil, invoice_id: nil, invoice_subtotal_excluding_tax: nil, invoice_total: nil, invoice_total_excluding_tax: nil, net_amount: nil, order_id: nil, paid_at: nil, payment_id: nil, payment_intent_id: nil, subscription_id: nil, tax_amount: nil, total_tax_amount: nil, total_tax_amounts: nil, total_taxes: nil, transaction_id: nil, payment_provider: nil, test_mode: nil, request_options: {})
|
|
364
364
|
#
|
|
365
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
365
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
366
366
|
#
|
|
367
367
|
# @param id [String] Path param: GrowSurf program ID.
|
|
368
368
|
#
|
|
@@ -437,11 +437,12 @@ module GrowsurfRuby
|
|
|
437
437
|
# and reverses or adjusts the referrer's commission. The inverse of Record
|
|
438
438
|
# Affiliate Transaction. Identify the original transaction with the same
|
|
439
439
|
# identifier(s) you sent when recording it. Commissions already paid out to the
|
|
440
|
-
# affiliate are not clawed back
|
|
440
|
+
# affiliate are not clawed back. The amendment still updates the sale revenue used
|
|
441
|
+
# in program reporting; full refunds and chargebacks also update tax reporting.
|
|
441
442
|
#
|
|
442
|
-
# @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: {})
|
|
443
|
+
# @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, payment_provider: nil, test_mode: nil, request_options: {})
|
|
443
444
|
#
|
|
444
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
445
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
445
446
|
#
|
|
446
447
|
# @param id [String] Path param: GrowSurf program ID.
|
|
447
448
|
#
|
|
@@ -501,7 +502,7 @@ module GrowsurfRuby
|
|
|
501
502
|
#
|
|
502
503
|
# @overload send_invites(participant_id_or_email, id:, email_addresses:, message_text:, subject_text:, request_options: {})
|
|
503
504
|
#
|
|
504
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
505
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
505
506
|
#
|
|
506
507
|
# @param id [String] Path param: GrowSurf program ID.
|
|
507
508
|
#
|
|
@@ -543,7 +544,7 @@ module GrowsurfRuby
|
|
|
543
544
|
#
|
|
544
545
|
# @overload trigger_referral(participant_id_or_email, id:, delay_in_days: nil, request_options: {})
|
|
545
546
|
#
|
|
546
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
547
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
547
548
|
#
|
|
548
549
|
# @param id [String] Path param: GrowSurf program ID.
|
|
549
550
|
#
|
|
@@ -577,7 +578,7 @@ module GrowsurfRuby
|
|
|
577
578
|
#
|
|
578
579
|
# @overload cancel_delayed_referral(participant_id_or_email, id:, request_options: {})
|
|
579
580
|
#
|
|
580
|
-
# @param participant_id_or_email [String] GrowSurf participant ID or
|
|
581
|
+
# @param participant_id_or_email [String] GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
581
582
|
#
|
|
582
583
|
# @param id [String] GrowSurf program ID.
|
|
583
584
|
#
|
|
@@ -611,7 +612,7 @@ module GrowsurfRuby
|
|
|
611
612
|
#
|
|
612
613
|
# @overload email(participant_id_or_email, id:, body: nil, email_type: nil, preheader: nil, subject: nil, request_options: {})
|
|
613
614
|
#
|
|
614
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
615
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
615
616
|
#
|
|
616
617
|
# @param id [String] Path param: GrowSurf program ID.
|
|
617
618
|
#
|
|
@@ -648,7 +649,7 @@ module GrowsurfRuby
|
|
|
648
649
|
#
|
|
649
650
|
# @overload list_activity_logs(participant_id_or_email, id:, limit: nil, offset: nil, request_options: {})
|
|
650
651
|
#
|
|
651
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
652
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
652
653
|
#
|
|
653
654
|
# @param id [String] Path param: GrowSurf program ID.
|
|
654
655
|
#
|
|
@@ -686,24 +687,26 @@ module GrowsurfRuby
|
|
|
686
687
|
# commission, and payout metrics for affiliate programs). Pass `include=email`
|
|
687
688
|
# for `sent` (accepted for delivery), `delivered`, `opened`, `clicked`,
|
|
688
689
|
# `bounced`, and `spamComplaints` metrics attributed to this participant,
|
|
689
|
-
# including invitations they sent.
|
|
690
|
-
#
|
|
690
|
+
# including invitations they sent. Add `activation` for the cohort anchor and
|
|
691
|
+
# covered first milestones. Use `include=activation,series` to add covered portal
|
|
692
|
+
# views and share actions to each series bucket. Unknown history stays `null` with
|
|
693
|
+
# an explicit coverage state.
|
|
691
694
|
#
|
|
692
695
|
# @overload retrieve_analytics(participant_id_or_email, id:, days: nil, end_date: nil, include: nil, interval: nil, start_date: nil, request_options: {})
|
|
693
696
|
#
|
|
694
|
-
# @param participant_id_or_email [String] GrowSurf participant ID or
|
|
697
|
+
# @param participant_id_or_email [String] GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
695
698
|
#
|
|
696
699
|
# @param id [String] GrowSurf program ID.
|
|
697
700
|
#
|
|
698
|
-
# @param days [Integer] Last number of days
|
|
701
|
+
# @param days [Integer] Last number of days for optional `series` and `email` analytics. Defaults to 365. Maxi
|
|
699
702
|
#
|
|
700
|
-
# @param end_date [Integer] End
|
|
703
|
+
# @param end_date [Integer] End of a custom `series` and `email` analytics window as a Unix timestamp in milli
|
|
701
704
|
#
|
|
702
705
|
# @param include [String] Comma-separated optional data. `series` returns this participant's own activity
|
|
703
706
|
#
|
|
704
707
|
# @param interval [Symbol, GrowsurfRuby::Models::Campaign::ParticipantRetrieveAnalyticsParams::Interval] Bucket size for the `series` (only used when `include` contains `series`).
|
|
705
708
|
#
|
|
706
|
-
# @param start_date [Integer] Start
|
|
709
|
+
# @param start_date [Integer] Start of a custom `series` and `email` analytics window as a Unix timestamp in mi
|
|
707
710
|
#
|
|
708
711
|
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
709
712
|
#
|
|
@@ -735,7 +738,7 @@ module GrowsurfRuby
|
|
|
735
738
|
#
|
|
736
739
|
# @overload get_payout_destination(participant_id_or_email, id:, request_options: {})
|
|
737
740
|
#
|
|
738
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
741
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
739
742
|
#
|
|
740
743
|
# @param id [String] Path param: GrowSurf program ID.
|
|
741
744
|
#
|
|
@@ -765,7 +768,7 @@ module GrowsurfRuby
|
|
|
765
768
|
#
|
|
766
769
|
# @overload request_payout_destination_confirmation(participant_id_or_email, id:, provider:, request_options: {})
|
|
767
770
|
#
|
|
768
|
-
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or
|
|
771
|
+
# @param participant_id_or_email [String] Path param: GrowSurf participant ID or unencoded participant email address (the SDK encodes it automatically).
|
|
769
772
|
#
|
|
770
773
|
# @param id [String] Path param: GrowSurf program ID.
|
|
771
774
|
#
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Resources
|
|
5
|
+
class Campaign
|
|
6
|
+
# Program Resource management and secure FILE upload operations.
|
|
7
|
+
class ProgramResources
|
|
8
|
+
def list(id, params = {})
|
|
9
|
+
@client.request(
|
|
10
|
+
method: :get,
|
|
11
|
+
path: ["campaign/%1$s/resources", id],
|
|
12
|
+
model: GrowsurfRuby::Campaign::ProgramResourceListResponse,
|
|
13
|
+
options: params[:request_options]
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create(id, params)
|
|
18
|
+
parsed, options = GrowsurfRuby::Campaign::ProgramResourceCreateParams.dump_request(params)
|
|
19
|
+
validate_write!(parsed, creating: true)
|
|
20
|
+
@client.request(
|
|
21
|
+
method: :post,
|
|
22
|
+
path: ["campaign/%1$s/resources", id],
|
|
23
|
+
body: parsed,
|
|
24
|
+
model: GrowsurfRuby::Campaign::ProgramResource,
|
|
25
|
+
options: options
|
|
26
|
+
)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def update(resource_id, params)
|
|
30
|
+
parsed, options = GrowsurfRuby::Campaign::ProgramResourceUpdateParams.dump_request(params)
|
|
31
|
+
id = parsed.delete(:id) { raise ArgumentError.new("missing required path argument id") }
|
|
32
|
+
validate_write!(parsed, creating: false)
|
|
33
|
+
@client.request(
|
|
34
|
+
method: :patch,
|
|
35
|
+
path: ["campaign/%1$s/resources/%2$s", id, resource_id],
|
|
36
|
+
body: parsed,
|
|
37
|
+
model: GrowsurfRuby::Campaign::ProgramResource,
|
|
38
|
+
options: options
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def delete(resource_id, params)
|
|
43
|
+
parsed, options = GrowsurfRuby::Campaign::ProgramResourceDeleteParams.dump_request(params)
|
|
44
|
+
id = parsed.delete(:id) { raise ArgumentError.new("missing required path argument id") }
|
|
45
|
+
@client.request(
|
|
46
|
+
method: :delete,
|
|
47
|
+
path: ["campaign/%1$s/resources/%2$s", id, resource_id],
|
|
48
|
+
model: GrowsurfRuby::Campaign::DeleteProgramResourceResponse,
|
|
49
|
+
options: options
|
|
50
|
+
)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def create_upload_ticket(id, params)
|
|
54
|
+
parsed, options = GrowsurfRuby::Campaign::ProgramResourceUploadTicketParams.dump_request(params)
|
|
55
|
+
file_name = parsed[:fileName]
|
|
56
|
+
unless file_name.is_a?(String) && file_name.length.between?(1, 120)
|
|
57
|
+
raise ArgumentError.new("Program Resource file_name must contain 1 through 120 characters")
|
|
58
|
+
end
|
|
59
|
+
@client.request(
|
|
60
|
+
method: :post,
|
|
61
|
+
path: ["campaign/%1$s/resource-upload-tickets", id],
|
|
62
|
+
body: parsed,
|
|
63
|
+
model: GrowsurfRuby::Campaign::ProgramResourceUploadTicket,
|
|
64
|
+
options: options
|
|
65
|
+
)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# @api private
|
|
69
|
+
def initialize(client:)
|
|
70
|
+
@client = client
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
private
|
|
74
|
+
|
|
75
|
+
# Rejects Resource field combinations excluded by the public REST contract.
|
|
76
|
+
def validate_write!(params, creating:)
|
|
77
|
+
if !creating && params.empty?
|
|
78
|
+
raise ArgumentError.new("Program Resource update requires at least one field")
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
position = params[:position]
|
|
82
|
+
if params.key?(:position) && (!position.is_a?(Integer) || !position.between?(0, 99))
|
|
83
|
+
raise ArgumentError.new("Program Resource position must be an integer from 0 through 99")
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
has_upload_ticket = params.key?(:uploadTicket)
|
|
87
|
+
has_upload_result = params.key?(:uploadResult)
|
|
88
|
+
if has_upload_ticket != has_upload_result
|
|
89
|
+
raise ArgumentError.new("upload_ticket and upload_result must be supplied together")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
supplied_types = []
|
|
93
|
+
supplied_types << :LINK if params.key?(:url)
|
|
94
|
+
supplied_types << :TEXT if params.key?(:text)
|
|
95
|
+
supplied_types << :FILE if has_upload_ticket
|
|
96
|
+
raise ArgumentError.new("send content fields for only one Program Resource type") if supplied_types.length > 1
|
|
97
|
+
|
|
98
|
+
type = params[:type]
|
|
99
|
+
if supplied_types.any? && !type.nil? && supplied_types.first != type
|
|
100
|
+
raise ArgumentError.new("content fields must match the selected Program Resource type")
|
|
101
|
+
end
|
|
102
|
+
if !creating && !type.nil? && supplied_types != [type]
|
|
103
|
+
raise ArgumentError.new("changing a Program Resource type requires its replacement content")
|
|
104
|
+
end
|
|
105
|
+
return unless creating && (supplied_types.empty? || supplied_types.first != type)
|
|
106
|
+
|
|
107
|
+
raise ArgumentError.new("create requires content fields for the selected Program Resource type")
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -28,15 +28,16 @@ module GrowsurfRuby
|
|
|
28
28
|
# The reward type must be compatible with the program type (affiliate programs
|
|
29
29
|
# support only `AFFILIATE` rewards; referral programs support all other types).
|
|
30
30
|
# Enabling an active reward of a type automatically enables that reward type on
|
|
31
|
-
# the program.
|
|
31
|
+
# the program. For an affiliate reward, `commissionStructure.event: LEAD`
|
|
32
|
+
# requires a `FIXED` commission with a positive `amount`.
|
|
32
33
|
#
|
|
33
|
-
# @overload create(id, type:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: 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, referred_value: nil, title: nil, value: nil, request_options: {})
|
|
34
|
+
# @overload create(id, type:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, event: nil, image_url: 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, referred_value: nil, title: nil, value: nil, request_options: {})
|
|
34
35
|
#
|
|
35
36
|
# @param id [String] Path param: GrowSurf program ID.
|
|
36
37
|
#
|
|
37
38
|
# @param type [Symbol, GrowsurfRuby::Models::Campaign::RewardCreateParams::Type] Body param: The reward type. Immutable after creation.
|
|
38
39
|
#
|
|
39
|
-
# @param commission_structure [GrowsurfRuby::Models::CommissionStructure] Body param
|
|
40
|
+
# @param commission_structure [GrowsurfRuby::Models::CommissionStructure] Body param: The affiliate commission structure. Required when creating an `AFFILIATE` reward. A `FIXED` commission requires `amount`; a `PERCENT` commission requires `percent`.
|
|
40
41
|
#
|
|
41
42
|
# @param conversions_required [Integer] Body param
|
|
42
43
|
#
|
|
@@ -44,6 +45,8 @@ module GrowsurfRuby
|
|
|
44
45
|
#
|
|
45
46
|
# @param description [String] Body param
|
|
46
47
|
#
|
|
48
|
+
# @param event [Symbol, GrowsurfRuby::Models::Campaign::RewardCreateParams::Event] Body param: The referral event that earns this Campaign Reward. Use `LEAD` or `CONVERSION`. `LEAD` requires the program installation's `referralTrigger` to be `CUSTOM`. This field applies only to `SINGLE_SIDED`, `DOUBLE_SIDED`, and `MILESTONE` rewards. When omitted, it defaults to `CONVERSION`.
|
|
49
|
+
#
|
|
47
50
|
# @param image_url [String] Body param
|
|
48
51
|
#
|
|
49
52
|
# @param is_unlimited [Boolean] Body param: Whether the reward can be earned an unlimited number of times. Defaul
|
|
@@ -96,15 +99,16 @@ module GrowsurfRuby
|
|
|
96
99
|
# immutable and cannot be changed. When the update replaces `metadata`, renamed
|
|
97
100
|
# keys automatically rewrite any `{{campaignReward[…]}}` references in campaign
|
|
98
101
|
# copy; removing a key that campaign copy still references returns a `409` listing
|
|
99
|
-
# the referencing fields.
|
|
102
|
+
# the referencing fields. For an affiliate reward, `commissionStructure.event:
|
|
103
|
+
# LEAD` requires a `FIXED` commission with a positive `amount`.
|
|
100
104
|
#
|
|
101
|
-
# @overload update(campaign_reward_id, id:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, image_url: 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, referred_value: nil, title: nil, value: nil, request_options: {})
|
|
105
|
+
# @overload update(campaign_reward_id, id:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, event: nil, image_url: 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, referred_value: nil, title: nil, value: nil, request_options: {})
|
|
102
106
|
#
|
|
103
107
|
# @param campaign_reward_id [String] Path param: Campaign reward ID.
|
|
104
108
|
#
|
|
105
109
|
# @param id [String] Path param: GrowSurf program ID.
|
|
106
110
|
#
|
|
107
|
-
# @param commission_structure [GrowsurfRuby::Models::CommissionStructure] Body param
|
|
111
|
+
# @param commission_structure [GrowsurfRuby::Models::CommissionStructure] Body param: The affiliate commission structure. A `FIXED` commission requires `amount`; a `PERCENT` commission requires `percent`.
|
|
108
112
|
#
|
|
109
113
|
# @param conversions_required [Integer] Body param
|
|
110
114
|
#
|
|
@@ -112,6 +116,8 @@ module GrowsurfRuby
|
|
|
112
116
|
#
|
|
113
117
|
# @param description [String] Body param
|
|
114
118
|
#
|
|
119
|
+
# @param event [Symbol, GrowsurfRuby::Models::Campaign::RewardUpdateParams::Event] Body param: The referral event that earns this Campaign Reward. Use `LEAD` or `CONVERSION`. `LEAD` requires the program installation's `referralTrigger` to be `CUSTOM`. This field applies only to `SINGLE_SIDED`, `DOUBLE_SIDED`, and `MILESTONE` rewards. When omitted, the stored event is preserved.
|
|
120
|
+
#
|
|
115
121
|
# @param image_url [String] Body param
|
|
116
122
|
#
|
|
117
123
|
# @param is_unlimited [Boolean] Body param: Whether the reward can be earned an unlimited number of times. Defaul
|