growsurf-ruby 1.17.0 → 1.18.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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/README.md +1 -1
  4. data/lib/growsurf_ruby/errors.rb +128 -0
  5. data/lib/growsurf_ruby/models/campaign/campaign_custom_domain.rb +109 -0
  6. data/lib/growsurf_ruby/models/campaign/create.rb +18 -4
  7. data/lib/growsurf_ruby/models/campaign/custom_domain_set_params.rb +25 -0
  8. data/lib/growsurf_ruby/models/campaign/delete_campaign_custom_domain_response.rb +27 -0
  9. data/lib/growsurf_ruby/models/campaign/participant.rb +15 -215
  10. data/lib/growsurf_ruby/models/campaign/participant_email_params.rb +12 -8
  11. data/lib/growsurf_ruby/models/campaign/participant_list_referrals_params.rb +0 -3
  12. data/lib/growsurf_ruby/models/campaign/participant_record_transaction_params.rb +16 -2
  13. data/lib/growsurf_ruby/models/campaign/participant_refund_transaction_params.rb +16 -2
  14. data/lib/growsurf_ruby/models/campaign/reward_create_params.rb +20 -0
  15. data/lib/growsurf_ruby/models/campaign/reward_update_params.rb +20 -0
  16. data/lib/growsurf_ruby/models/campaign/webhook_create_params.rb +10 -3
  17. data/lib/growsurf_ruby/models/campaign_create_params.rb +10 -5
  18. data/lib/growsurf_ruby/models/campaign_list_referrals_params.rb +0 -3
  19. data/lib/growsurf_ruby/models/campaign_update_params.rb +4 -4
  20. data/lib/growsurf_ruby/models/commission_structure.rb +3 -0
  21. data/lib/growsurf_ruby/models/referral_list.rb +17 -1
  22. data/lib/growsurf_ruby/resources/campaign/custom_domain.rb +111 -0
  23. data/lib/growsurf_ruby/resources/campaign/design.rb +3 -3
  24. data/lib/growsurf_ruby/resources/campaign/emails.rb +1 -2
  25. data/lib/growsurf_ruby/resources/campaign/installation.rb +1 -2
  26. data/lib/growsurf_ruby/resources/campaign/options.rb +4 -5
  27. data/lib/growsurf_ruby/resources/campaign/participant.rb +9 -4
  28. data/lib/growsurf_ruby/resources/campaign/program_resources.rb +1 -0
  29. data/lib/growsurf_ruby/resources/campaign/rewards.rb +17 -2
  30. data/lib/growsurf_ruby/resources/campaign/webhooks.rb +13 -3
  31. data/lib/growsurf_ruby/resources/campaign.rb +15 -9
  32. data/lib/growsurf_ruby/version.rb +1 -1
  33. data/lib/growsurf_ruby.rb +4 -0
  34. data/rbi/growsurf_ruby/errors.rbi +64 -0
  35. data/rbi/growsurf_ruby/models/campaign/campaign_custom_domain.rbi +193 -0
  36. data/rbi/growsurf_ruby/models/campaign/create.rbi +24 -4
  37. data/rbi/growsurf_ruby/models/campaign/custom_domain_set_params.rbi +47 -0
  38. data/rbi/growsurf_ruby/models/campaign/delete_campaign_custom_domain_response.rbi +40 -0
  39. data/rbi/growsurf_ruby/models/campaign/participant.rbi +15 -292
  40. data/rbi/growsurf_ruby/models/campaign/participant_email_params.rbi +23 -16
  41. data/rbi/growsurf_ruby/models/campaign/participant_list_referrals_params.rbi +0 -15
  42. data/rbi/growsurf_ruby/models/campaign/participant_record_transaction_params.rbi +23 -4
  43. data/rbi/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbi +23 -4
  44. data/rbi/growsurf_ruby/models/campaign/reward_create_params.rbi +24 -0
  45. data/rbi/growsurf_ruby/models/campaign/reward_update_params.rbi +24 -0
  46. data/rbi/growsurf_ruby/models/campaign/webhook_create_params.rbi +18 -4
  47. data/rbi/growsurf_ruby/models/campaign_create_params.rbi +6 -12
  48. data/rbi/growsurf_ruby/models/campaign_list_referrals_params.rbi +0 -15
  49. data/rbi/growsurf_ruby/models/campaign_update_params.rbi +6 -12
  50. data/rbi/growsurf_ruby/models/commission_structure.rbi +3 -0
  51. data/rbi/growsurf_ruby/models/referral_list.rbi +19 -3
  52. data/rbi/growsurf_ruby/resources/campaign/custom_domain.rbi +91 -0
  53. data/rbi/growsurf_ruby/resources/campaign/design.rbi +3 -3
  54. data/rbi/growsurf_ruby/resources/campaign/emails.rbi +1 -2
  55. data/rbi/growsurf_ruby/resources/campaign/installation.rbi +1 -2
  56. data/rbi/growsurf_ruby/resources/campaign/options.rbi +4 -5
  57. data/rbi/growsurf_ruby/resources/campaign/participant.rbi +30 -15
  58. data/rbi/growsurf_ruby/resources/campaign/rewards.rbi +25 -2
  59. data/rbi/growsurf_ruby/resources/campaign/webhooks.rbi +21 -4
  60. data/rbi/growsurf_ruby/resources/campaign.rbi +21 -9
  61. data/sig/growsurf_ruby/errors.rbs +40 -0
  62. data/sig/growsurf_ruby/models/campaign/campaign_custom_domain.rbs +84 -0
  63. data/sig/growsurf_ruby/models/campaign/create.rbs +5 -0
  64. data/sig/growsurf_ruby/models/campaign/custom_domain_set_params.rbs +25 -0
  65. data/sig/growsurf_ruby/models/campaign/delete_campaign_custom_domain_response.rbs +18 -0
  66. data/sig/growsurf_ruby/models/campaign/participant.rbs +7 -205
  67. data/sig/growsurf_ruby/models/campaign/participant_list_referrals_params.rbs +0 -6
  68. data/sig/growsurf_ruby/models/campaign/participant_record_transaction_params.rbs +19 -5
  69. data/sig/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbs +19 -5
  70. data/sig/growsurf_ruby/models/campaign_create_params.rbs +8 -12
  71. data/sig/growsurf_ruby/models/campaign_list_referrals_params.rbs +0 -6
  72. data/sig/growsurf_ruby/models/campaign_update_params.rbs +8 -12
  73. data/sig/growsurf_ruby/models/referral_list.rbs +13 -3
  74. data/sig/growsurf_ruby/resources/campaign/custom_domain.rbs +30 -0
  75. data/sig/growsurf_ruby/resources/campaign/participant.rbs +3 -2
  76. data/sig/growsurf_ruby/resources/campaign.rbs +7 -4
  77. metadata +14 -2
@@ -27,15 +27,19 @@ module GrowsurfRuby
27
27
  optional :body, String
28
28
 
29
29
  # @!attribute email_type
30
- # The program email template to send (template mode). Send the camelCase key.
31
- # The valid types depend on the program type; `isEnabled` only controls automatic sends.
32
- # Referral programs: `welcomeNonReferred`, `referralLinkViewedFirstTime`,
33
- # `referralLinkUsed`, `referredSignup`, `welcomeReferred`, `goalAchieved`,
30
+ # The program email template to trigger (template mode). Send the camelCase
31
+ # email-type key. The available types depend on the program type; the
32
+ # template's `isEnabled` setting controls automatic sends only. This endpoint
33
+ # can trigger any sendable template. System and transactional types (login
34
+ # link, payout destination confirmation, tax notifications), the invite email,
35
+ # and the follow-up reminder cannot be sent. Referral programs:
36
+ # `welcomeNonReferred`, `referralLinkViewedFirstTime`, `referralLinkUsed`,
37
+ # `referredSignup`, `welcomeReferred`, `offerClaimed`, `goalAchieved`,
34
38
  # `campaignEndedWinners`, `campaignEndedNonWinners`, `progressUpdateMonthly`.
35
39
  # Affiliate programs: `welcomeNonReferred`, `referralLinkViewedFirstTime`,
36
- # `referredSignup`, `commissionGenerated`, `commissionAdjusted`, `payoutPending`,
37
- # `payoutSentSuccess`, `progressUpdateMonthly`. System/transactional types (login
38
- # link, PayPal confirmation, tax) and the invite email cannot be sent.
40
+ # `referredSignup`, `offerClaimed`, `commissionGenerated`,
41
+ # `commissionAdjusted`, `payoutPending`, `payoutSentSuccess`,
42
+ # `progressUpdateMonthly`.
39
43
  # `welcomeNonReferred` can only be sent to advocates or approved, enrolled affiliates in a
40
44
  # program that has not ended.
41
45
  #
@@ -65,7 +69,7 @@ module GrowsurfRuby
65
69
  #
66
70
  # @param body [String] HTML body for a free-form email. You can personalize it with dynamic text, inserting `{{...}}` tokens like `{{firstName}}` or `{{shareUrl}}`. See [Guide to using dynamic text in GrowSurf emails](https://support.growsurf.com/article/213-guide-to-using-dynamic-text-in-growsurf-emails).
67
71
  #
68
- # @param email_type [String] The program email template to send (template mode). Send the camelCase key; it m
72
+ # @param email_type [String] The program email template to trigger (template mode). Send the camelCase email-
69
73
  #
70
74
  # @param preheader [String] Optional preheader text for a free-form email.
71
75
  #
@@ -103,9 +103,6 @@ module GrowsurfRuby
103
103
  UPDATED_AT = :updatedAt
104
104
  CREATED_AT = :createdAt
105
105
  EMAIL = :email
106
- FIRST_NAME = :firstName
107
- LAST_NAME = :lastName
108
- REFERRAL_STATUS = :referralStatus
109
106
  REFERRAL_TRIGGERED_AT = :referralTriggeredAt
110
107
 
111
108
  # @!method self.values
@@ -138,7 +138,9 @@ module GrowsurfRuby
138
138
  optional :transaction_id, String, api_name: :transactionId
139
139
 
140
140
  # Connected provider: `stripe`, `chargebee` or `recurly`. Requires `transactionId` and `testMode`.
141
- optional :payment_provider, String, api_name: :paymentProvider
141
+ optional :payment_provider,
142
+ enum: -> { GrowsurfRuby::Campaign::ParticipantRecordTransactionParams::PaymentProvider },
143
+ api_name: :paymentProvider
142
144
 
143
145
  # `true` for test or `false` for live. Requires `paymentProvider`.
144
146
  optional :test_mode, GrowsurfRuby::Internal::Type::Boolean, api_name: :testMode
@@ -169,9 +171,21 @@ module GrowsurfRuby
169
171
  # @param total_tax_amounts [Array<Hash{Symbol=>Object}>]
170
172
  # @param total_taxes [Array<Hash{Symbol=>Object}>]
171
173
  # @param transaction_id [String]
172
- # @param payment_provider [String]
174
+ # @param payment_provider [Symbol, GrowsurfRuby::Models::Campaign::ParticipantRecordTransactionParams::PaymentProvider]
173
175
  # @param test_mode [Boolean]
174
176
  # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}]
177
+
178
+ # Connected payment provider.
179
+ module PaymentProvider
180
+ extend GrowsurfRuby::Internal::Type::Enum
181
+
182
+ STRIPE = :stripe
183
+ CHARGEBEE = :chargebee
184
+ RECURLY = :recurly
185
+
186
+ # @!method self.values
187
+ # @return [Array<Symbol>]
188
+ end
175
189
  end
176
190
  end
177
191
  end
@@ -103,7 +103,9 @@ module GrowsurfRuby
103
103
  optional :transaction_id, String, api_name: :transactionId
104
104
 
105
105
  # Connected provider: `stripe`, `chargebee` or `recurly`. Requires `transactionId` and `testMode`.
106
- optional :payment_provider, String, api_name: :paymentProvider
106
+ optional :payment_provider,
107
+ enum: -> { GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::PaymentProvider },
108
+ api_name: :paymentProvider
107
109
 
108
110
  # `true` for test or `false` for live. Requires `paymentProvider`.
109
111
  optional :test_mode, GrowsurfRuby::Internal::Type::Boolean, api_name: :testMode
@@ -127,7 +129,7 @@ module GrowsurfRuby
127
129
  # @param refund_id [String]
128
130
  # @param refund_status [String]
129
131
  # @param transaction_id [String]
130
- # @param payment_provider [String]
132
+ # @param payment_provider [Symbol, GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionParams::PaymentProvider]
131
133
  # @param test_mode [Boolean]
132
134
  # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}]
133
135
 
@@ -140,6 +142,18 @@ module GrowsurfRuby
140
142
  # @!method self.values
141
143
  # @return [Array<Symbol>]
142
144
  end
145
+
146
+ # Connected payment provider.
147
+ module PaymentProvider
148
+ extend GrowsurfRuby::Internal::Type::Enum
149
+
150
+ STRIPE = :stripe
151
+ CHARGEBEE = :chargebee
152
+ RECURLY = :recurly
153
+
154
+ # @!method self.values
155
+ # @return [Array<Symbol>]
156
+ end
143
157
  end
144
158
  end
145
159
  end
@@ -92,6 +92,18 @@ module GrowsurfRuby
92
92
 
93
93
  # @!attribute metadata
94
94
  # Custom key/value metadata (single-level; values are stored as strings).
95
+ # Each value must be a string, number, or boolean of up to 500 characters.
96
+ # Each key must have 1 to 40 characters once camelCased, and two keys that
97
+ # camelCase to the same key are rejected. Up to 50 keys. An entry that breaks
98
+ # these rules returns `400`.
99
+ #
100
+ # For `DOUBLE_SIDED` rewards in referral programs, `rewardAmount` is the
101
+ # referrer’s amount and `referredRewardAmount` is the friend’s amount. If
102
+ # `referredRewardAmount` is absent, both use `rewardAmount`. New or changed positive
103
+ # numeric amounts must use whole units for currencies without decimals, such as JPY, and
104
+ # no more than two decimal places for other currencies, including USD and KWD. Excess
105
+ # precision is rejected rather than rounded, including when you clone a program. Existing
106
+ # unchanged amounts and earned rewards keep their saved values.
95
107
  #
96
108
  # @return [Hash{Symbol=>Object}, nil]
97
109
  optional :metadata, GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown]
@@ -195,6 +207,14 @@ module GrowsurfRuby
195
207
  #
196
208
  # @param metadata [Hash{Symbol=>Object}] Custom key/value metadata (single-level; values are stored as strings).
197
209
  #
210
+ # For `DOUBLE_SIDED` rewards in referral programs, `rewardAmount` is the
211
+ # referrer’s amount and `referredRewardAmount` is the friend’s amount. If
212
+ # `referredRewardAmount` is absent, both use `rewardAmount`. New or changed positive
213
+ # numeric amounts must use whole units for currencies without decimals, such as JPY, and
214
+ # no more than two decimal places for other currencies, including USD and KWD. Excess
215
+ # precision is rejected rather than rounded, including when you clone a program. Existing
216
+ # unchanged amounts and earned rewards keep their saved values.
217
+ #
198
218
  # @param next_milestone_prefix [String] Text shown before a participant's referral count in milestone-progress copy. App
199
219
  #
200
220
  # @param next_milestone_suffix [String] Text shown after a participant's referral count in milestone-progress copy. Appl
@@ -97,6 +97,18 @@ module GrowsurfRuby
97
97
 
98
98
  # @!attribute metadata
99
99
  # Custom key/value metadata (single-level; values are stored as strings).
100
+ # Each value must be a string, number, or boolean of up to 500 characters.
101
+ # Each key must have 1 to 40 characters once camelCased, and two keys that
102
+ # camelCase to the same key are rejected. Up to 50 keys. An entry that breaks
103
+ # these rules returns `400`.
104
+ #
105
+ # For `DOUBLE_SIDED` rewards in referral programs, `rewardAmount` is the
106
+ # referrer’s amount and `referredRewardAmount` is the friend’s amount. If
107
+ # `referredRewardAmount` is absent, both use `rewardAmount`. New or changed positive
108
+ # numeric amounts must use whole units for currencies without decimals, such as JPY, and
109
+ # no more than two decimal places for other currencies, including USD and KWD. Excess
110
+ # precision is rejected rather than rounded, including when you clone a program. Existing
111
+ # unchanged amounts and earned rewards keep their saved values.
100
112
  #
101
113
  # @return [Hash{Symbol=>Object}, nil]
102
114
  optional :metadata, GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown]
@@ -202,6 +214,14 @@ module GrowsurfRuby
202
214
  #
203
215
  # @param metadata [Hash{Symbol=>Object}] Custom key/value metadata (single-level; values are stored as strings).
204
216
  #
217
+ # For `DOUBLE_SIDED` rewards in referral programs, `rewardAmount` is the
218
+ # referrer’s amount and `referredRewardAmount` is the friend’s amount. If
219
+ # `referredRewardAmount` is absent, both use `rewardAmount`. New or changed positive
220
+ # numeric amounts must use whole units for currencies without decimals, such as JPY, and
221
+ # no more than two decimal places for other currencies, including USD and KWD. Excess
222
+ # precision is rejected rather than rounded, including when you clone a program. Existing
223
+ # unchanged amounts and earned rewards keep their saved values.
224
+ #
205
225
  # @param next_milestone_prefix [String] Text shown before a participant's referral count in milestone-progress copy. App
206
226
  #
207
227
  # @param next_milestone_suffix [String] Text shown after a participant's referral count in milestone-progress copy. Appl
@@ -15,8 +15,15 @@ module GrowsurfRuby
15
15
  required :payload_url, String, api_name: :payloadUrl
16
16
 
17
17
  # @!attribute events
18
- # The events this webhook is subscribed to. When omitted, it is subscribed to no
19
- # events.
18
+ # The events this webhook is subscribed to. When omitted, the webhook is
19
+ # subscribed to every event its program type offers, like a webhook added in
20
+ # the dashboard: referral programs offer `PARTICIPANT_REACHED_A_GOAL`,
21
+ # `NEW_PARTICIPANT_ADDED`, `PARTICIPANT_FRAUD_STATUS_UPDATED`, and
22
+ # `CAMPAIGN_ENDED`; affiliate programs offer `NEW_COMMISSION_ADDED`,
23
+ # `COMMISSION_ADJUSTED`, `NEW_PAYOUT_ISSUED`, `NEW_PARTICIPANT_ADDED`,
24
+ # `PARTICIPANT_FRAUD_STATUS_UPDATED`, and `CAMPAIGN_ENDED`. Send `[]` to
25
+ # subscribe to no events. An event the program type does not offer returns
26
+ # `400`.
20
27
  #
21
28
  # @return [Array<Symbol, GrowsurfRuby::Models::Campaign::WebhookEvent>, nil]
22
29
  optional :events, -> { GrowsurfRuby::Internal::Type::ArrayOf[enum: GrowsurfRuby::Campaign::WebhookEvent] }
@@ -39,7 +46,7 @@ module GrowsurfRuby
39
46
  #
40
47
  # @param payload_url [String] The URL that receives webhook deliveries.
41
48
  #
42
- # @param events [Array<Symbol, GrowsurfRuby::Models::Campaign::WebhookEvent>] The events this webhook is subscribed to. When omitted, it is subscribed to no e
49
+ # @param events [Array<Symbol, GrowsurfRuby::Models::Campaign::WebhookEvent>] The events this webhook is subscribed to. When omitted, the webhook is subscribed
43
50
  #
44
51
  # @param is_enabled [Boolean]
45
52
  #
@@ -15,12 +15,12 @@ module GrowsurfRuby
15
15
  # @!attribute company_logo_image_url
16
16
  #
17
17
  # @return [String, nil]
18
- optional :company_logo_image_url, String, api_name: :companyLogoImageUrl
18
+ optional :company_logo_image_url, String, api_name: :companyLogoImageUrl, nil?: true
19
19
 
20
20
  # @!attribute company_name
21
21
  #
22
22
  # @return [String, nil]
23
- optional :company_name, String, api_name: :companyName
23
+ optional :company_name, String, api_name: :companyName, nil?: true
24
24
 
25
25
  # @!attribute currency_iso
26
26
  #
@@ -44,7 +44,12 @@ module GrowsurfRuby
44
44
  # arrives switched off with a placeholder name, so the program awards nothing
45
45
  # until you set the amount and turn one on. `TELEHEALTH` is for consumer
46
46
  # telehealth and wellness subscriptions; `HEALTHCARE_PROVIDERS` is for provider
47
- # networks and clinician-facing products. `INSURANCE` replaces
47
+ # networks and clinician-facing products. A `TELEHEALTH` program also starts
48
+ # with `useGrowSurfHostedLinks` on, so each referral link is a GrowSurf-hosted
49
+ # link; turn it off with `PATCH /campaign/{id}/installation`. It also starts
50
+ # with `offerPageRedirectSeconds` set to `10` and with starter offer-page
51
+ # content (`referredExperience.offerPageDescription` and `offerPageSteps`).
52
+ # Values you send in the create request are kept. `INSURANCE` replaces
48
53
  # `ONLINE_INSURANCE`, which is still accepted. Omit it and every share button
49
54
  # keeps its standard default. Set only when the program is created; it is not
50
55
  # accepted on update.
@@ -66,9 +71,9 @@ module GrowsurfRuby
66
71
  # @!method initialize(type:, company_logo_image_url: nil, company_name: nil, currency_iso: nil, goal: nil, name: nil, rewards: nil, request_options: {})
67
72
  # @param type [Symbol, GrowsurfRuby::Models::CampaignCreateParams::Type]
68
73
  #
69
- # @param company_logo_image_url [String]
74
+ # @param company_logo_image_url [String, nil]
70
75
  #
71
- # @param company_name [String]
76
+ # @param company_name [String, nil]
72
77
  #
73
78
  # @param currency_iso [String]
74
79
  #
@@ -95,9 +95,6 @@ module GrowsurfRuby
95
95
  UPDATED_AT = :updatedAt
96
96
  CREATED_AT = :createdAt
97
97
  EMAIL = :email
98
- FIRST_NAME = :firstName
99
- LAST_NAME = :lastName
100
- REFERRAL_STATUS = :referralStatus
101
98
  REFERRAL_TRIGGERED_AT = :referralTriggeredAt
102
99
 
103
100
  # @!method self.values
@@ -15,12 +15,12 @@ module GrowsurfRuby
15
15
  # @!attribute company_logo_image_url
16
16
  #
17
17
  # @return [String, nil]
18
- optional :company_logo_image_url, String, api_name: :companyLogoImageUrl
18
+ optional :company_logo_image_url, String, api_name: :companyLogoImageUrl, nil?: true
19
19
 
20
20
  # @!attribute company_name
21
21
  #
22
22
  # @return [String, nil]
23
- optional :company_name, String, api_name: :companyName
23
+ optional :company_name, String, api_name: :companyName, nil?: true
24
24
 
25
25
  # @!attribute name
26
26
  #
@@ -35,9 +35,9 @@ module GrowsurfRuby
35
35
  # @!method initialize(id:, company_logo_image_url: nil, company_name: nil, name: nil, status: nil, request_options: {})
36
36
  # @param id [String]
37
37
  #
38
- # @param company_logo_image_url [String]
38
+ # @param company_logo_image_url [String, nil]
39
39
  #
40
- # @param company_name [String]
40
+ # @param company_name [String, nil]
41
41
  #
42
42
  # @param name [String]
43
43
  #
@@ -4,6 +4,9 @@ module GrowsurfRuby
4
4
  module Models
5
5
  class CommissionStructure < GrowsurfRuby::Internal::Type::BaseModel
6
6
  # @!attribute amount
7
+ # Fixed commission amount in the currency's smallest denomination, used when
8
+ # `type` is `FIXED`. The maximum is `100000000` (1,000,000.00) for USD, EUR,
9
+ # and GBP. `null` for percentage-based commissions.
7
10
  #
8
11
  # @return [Integer, nil]
9
12
  optional :amount, Integer, nil?: true
@@ -81,7 +81,19 @@ module GrowsurfRuby
81
81
  # @return [String, nil]
82
82
  optional :last_name, String, api_name: :lastName, nil?: true
83
83
 
84
- # @!method initialize(id:, created_at:, email:, referral_status:, referred_by:, updated_at:, first_name: nil, last_name: nil)
84
+ # @!attribute referral_credit_expired_at
85
+ # When the referrer's credit for this referral expired, as a Unix timestamp in milliseconds. `null` when the credit has not expired.
86
+ #
87
+ # @return [Integer, nil]
88
+ optional :referral_credit_expired_at, Integer, api_name: :referralCreditExpiredAt, nil?: true
89
+
90
+ # @!attribute referral_triggered_at
91
+ # When the referral was triggered, as a Unix timestamp in milliseconds. `null` until the referral is triggered, and for invites.
92
+ #
93
+ # @return [Integer, nil]
94
+ optional :referral_triggered_at, Integer, api_name: :referralTriggeredAt, nil?: true
95
+
96
+ # @!method initialize(id:, created_at:, email:, referral_status:, referred_by:, updated_at:, first_name: nil, last_name: nil, referral_credit_expired_at: nil, referral_triggered_at: nil)
85
97
  # @param id [String]
86
98
  # @param created_at [Integer]
87
99
  # @param email [String]
@@ -90,6 +102,10 @@ module GrowsurfRuby
90
102
  # @param updated_at [Integer]
91
103
  # @param first_name [String, nil]
92
104
  # @param last_name [String, nil]
105
+ #
106
+ # @param referral_credit_expired_at [Integer, nil] When the referrer's credit for this referral expired, as a Unix timestamp in milliseconds. `null` when the credit has not expired.
107
+ #
108
+ # @param referral_triggered_at [Integer, nil] When the referral was triggered, as a Unix timestamp in milliseconds. `null` until the referral is triggered, and for invites.
93
109
  end
94
110
  end
95
111
  end
@@ -0,0 +1,111 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GrowsurfRuby
4
+ module Resources
5
+ class Campaign
6
+ # Custom domain operations: the custom domain that serves a program's landing pages.
7
+ class CustomDomain
8
+ # Retrieves the custom domain that serves a program's landing pages, and whether its
9
+ # DNS is verified. When no custom domain is set, `domain` is `null`. This call does
10
+ # not check DNS; use {#verify} for a live check.
11
+ #
12
+ # @overload retrieve(id, request_options: {})
13
+ #
14
+ # @param id [String] GrowSurf program ID.
15
+ #
16
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
17
+ #
18
+ # @return [GrowsurfRuby::Models::Campaign::CampaignCustomDomain]
19
+ def retrieve(id, params = {})
20
+ @client.request(
21
+ method: :get,
22
+ path: ["campaign/%1$s/custom-domain", id],
23
+ model: GrowsurfRuby::Models::Campaign::CampaignCustomDomain,
24
+ options: params[:request_options]
25
+ )
26
+ end
27
+
28
+ # Sets the custom domain for a program's landing pages, or replaces the current one.
29
+ # Send a hostname such as `refer.piedpiper.com`; `https://` is added if you leave it
30
+ # out. Paths, ports, queries and `http://` return a `400`.
31
+ # Replacing a domain removes the old one right away, and its pages stop loading
32
+ # there. Sending the current domain again changes nothing. A domain used by another
33
+ # program returns a `409`.
34
+ # A new domain starts unverified. Point a `CNAME` record from the hostname to the
35
+ # `dns_record.value` in the response, then call {#verify}.
36
+ #
37
+ # @overload set(id, domain:, request_options: {})
38
+ #
39
+ # @param id [String] Path param: GrowSurf program ID.
40
+ #
41
+ # @param domain [String] Body param: The hostname to serve the program's landing pages from, with or without `https://`.
42
+ #
43
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
44
+ #
45
+ # @return [GrowsurfRuby::Models::Campaign::CampaignCustomDomain]
46
+ #
47
+ # @see GrowsurfRuby::Models::Campaign::CustomDomainSetParams
48
+ def set(id, params)
49
+ parsed, options = GrowsurfRuby::Campaign::CustomDomainSetParams.dump_request(params)
50
+ @client.request(
51
+ method: :put,
52
+ path: ["campaign/%1$s/custom-domain", id],
53
+ body: parsed,
54
+ model: GrowsurfRuby::Models::Campaign::CampaignCustomDomain,
55
+ options: options
56
+ )
57
+ end
58
+
59
+ # Checks the custom domain's DNS now and returns the result in `is_verified`. The
60
+ # first time the check passes, GrowSurf sets up the domain's SSL certificate; pages
61
+ # can take a few minutes to load over `https://` after that. If the record is wrong
62
+ # or has not propagated yet, `is_verified` stays `false`; call again later. More than
63
+ # one `CNAME` record on the hostname returns a `400`. Returns a `404` when no custom
64
+ # domain is set. A domain that is already verified is returned as is, without a new
65
+ # check.
66
+ #
67
+ # @overload verify(id, request_options: {})
68
+ #
69
+ # @param id [String] GrowSurf program ID.
70
+ #
71
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
72
+ #
73
+ # @return [GrowsurfRuby::Models::Campaign::CampaignCustomDomain]
74
+ def verify(id, params = {})
75
+ @client.request(
76
+ method: :post,
77
+ path: ["campaign/%1$s/custom-domain/verify", id],
78
+ model: GrowsurfRuby::Models::Campaign::CampaignCustomDomain,
79
+ options: params[:request_options]
80
+ )
81
+ end
82
+
83
+ # Removes a program's custom domain. Its landing pages go back to their GrowSurf
84
+ # URL. Returns a `404` when no custom domain is set.
85
+ #
86
+ # @overload delete(id, request_options: {})
87
+ #
88
+ # @param id [String] GrowSurf program ID.
89
+ #
90
+ # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
91
+ #
92
+ # @return [GrowsurfRuby::Models::Campaign::DeleteCampaignCustomDomainResponse]
93
+ def delete(id, params = {})
94
+ @client.request(
95
+ method: :delete,
96
+ path: ["campaign/%1$s/custom-domain", id],
97
+ model: GrowsurfRuby::Models::Campaign::DeleteCampaignCustomDomainResponse,
98
+ options: params[:request_options]
99
+ )
100
+ end
101
+
102
+ # @api private
103
+ #
104
+ # @param client [GrowsurfRuby::Client]
105
+ def initialize(client:)
106
+ @client = client
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
@@ -16,7 +16,8 @@ module GrowsurfRuby
16
16
  # programs and hidden for referral programs, and `GET` returns every setting with its
17
17
  # default copy.
18
18
  # `participantAvatarStyle` is `CHARACTERS`, `INITIALS`, `ANIMALS`, or `GRADIENT`; missing or
19
- # unknown values mean `INITIALS`.
19
+ # unknown values mean `INITIALS`. `visualStyle` is `GLOW`, `CLEAN`, `FLAT`, `ROUND`, `TINT`,
20
+ # or `GLASS`, and is omitted when the program has no saved Style.
20
21
  # `payoutDestinationConfirmation` is omitted when no confirmation fields are stored. Stored
21
22
  # `null` fields are returned as `null`; omitted and `null` fields use localized defaults.
22
23
  #
@@ -45,8 +46,7 @@ module GrowsurfRuby
45
46
  # Unknown fields, fields not available for the program type, and invalid values return a
46
47
  # `400`. Landing-page custom code and JavaScript are not editable via the API.
47
48
  # Changes to participant email content are checked before saving. Rejected content
48
- # returns `400`; if the check is unavailable, `503` asks you to retry. Neither
49
- # response saves the change. A concurrent edit can return `409`; reload the
49
+ # returns `400` and is not saved. A concurrent edit can return `409`; reload the
50
50
  # program before retrying.
51
51
  #
52
52
  # @overload update(id, body, request_options: {})
@@ -40,8 +40,7 @@ module GrowsurfRuby
40
40
  # (`settings.sender.fromEmail`, whose custom value requires dashboard domain
41
41
  # verification).
42
42
  # Changes to participant email content are checked before saving. Rejected content
43
- # returns `400`; if the check is unavailable, `503` asks you to retry. Neither
44
- # response saves the change. A concurrent edit can return `409`; reload the
43
+ # returns `400` and is not saved. A concurrent edit can return `409`; reload the
45
44
  # program before retrying.
46
45
  #
47
46
  # @overload update(id, body, request_options: {})
@@ -33,8 +33,7 @@ module GrowsurfRuby
33
33
  # redirect destinations, which may take a moment to complete. URLs must include an
34
34
  # explicit `http://` or `https://` scheme.
35
35
  # Changes to participant email content are checked before saving. Rejected content
36
- # returns `400`; if the check is unavailable, `503` asks you to retry. Neither
37
- # response saves the change. A concurrent edit can return `409`; reload the
36
+ # returns `400` and is not saved. A concurrent edit can return `409`; reload the
38
37
  # program before retrying.
39
38
  #
40
39
  # @overload update(id, body, request_options: {})
@@ -33,12 +33,11 @@ module GrowsurfRuby
33
33
  # and `payoutThreshold`/`taxDocumentation` are affiliate-only, and affiliate
34
34
  # programs require `requireParticipantAuth: true`). `fraud.recaptcha.secretKey`
35
35
  # is write-only. `referralCreditWindowDays: null` means "never expires".
36
- # Turning on `languages.additionalLanguages` requires the Business plan or
37
- # higher. While any are on, every `languages` change, including turning them
38
- # off, requires it too (`403` otherwise).
36
+ # Turning on `languages.additionalLanguages` returns `403` if your account does
37
+ # not include additional languages. While any are on, every `languages` change,
38
+ # including turning them off, returns the same `403`.
39
39
  # Changes to participant email content are checked before saving. Rejected content
40
- # returns `400`; if the check is unavailable, `503` asks you to retry. Neither
41
- # response saves the change. A concurrent edit can return `409`; reload the
40
+ # returns `400` and is not saved. A concurrent edit can return `409`; reload the
42
41
  # program before retrying.
43
42
  #
44
43
  # @overload update(id, body, request_options: {})
@@ -147,7 +147,10 @@ module GrowsurfRuby
147
147
  # {GrowsurfRuby::Models::Campaign::ParticipantAddParams} for more details.
148
148
  #
149
149
  # Adds a new participant to the program. If the email already exists, the existing
150
- # participant is returned unchanged. For affiliate programs, set `isAffiliate` to
150
+ # participant is returned unchanged. One exception: if that participant claimed an
151
+ # offer in the Claim Offer Popup and the signup is not complete yet, this call completes
152
+ # the signup with the original referrer and saves any non-blank `firstName`,
153
+ # `lastName`, and `metadata` you send. For affiliate programs, set `isAffiliate` to
151
154
  # `true` to enroll a new participant as an approved affiliate or `false` to create
152
155
  # a non-affiliate. If you omit `isAffiliate`, a valid `referredBy` creates a
153
156
  # referred non-affiliate; without a valid referrer, the new participant is enrolled
@@ -155,7 +158,7 @@ module GrowsurfRuby
155
158
  # `isAffiliate: true` to keep the referral attribution and enroll the participant
156
159
  # as an affiliate.
157
160
  #
158
- # @overload add(id, email:, fingerprint: nil, first_name: nil, ip_address: nil, is_affiliate: nil, language: nil, last_name: nil, metadata: nil, mobile_instance_id: nil, referral_status: nil, referred_by: nil, request_options: {})
161
+ # @overload add(id, email:, fingerprint: nil, first_name: nil, ip_address: nil, is_affiliate: nil, language: nil, last_name: nil, metadata: nil, mobile_instance_id: nil, referral_status: nil, referred_at: nil, referred_by: nil, request_options: {})
159
162
  #
160
163
  # @param id [String] GrowSurf program ID.
161
164
  #
@@ -169,7 +172,7 @@ module GrowsurfRuby
169
172
  #
170
173
  # @param is_affiliate [Boolean] Affiliate programs only. Controls affiliate enrollment for a new participant. `true` enrolls the participant with `affiliateStatus: APPROVED`; `false` creates a non-affiliate without `affiliateStatus`. Existing participants are returned unchanged.
171
174
  #
172
- # @param language [Symbol, GrowsurfRuby::Models::Campaign::Language] The language of the participant's portal and program emails. Must be one of the program's languages. Applied only when this request creates the participant.
175
+ # @param language [Symbol, GrowsurfRuby::Models::Campaign::Language] The language of the participant's portal and program emails. Stored when it is one of the program's languages. A regional tag maps to its language (for example, `es-MX` is stored as `es`). Any other value is ignored and the program's base language applies. Applied only when this request creates the participant.
173
176
  #
174
177
  # @param last_name [String]
175
178
  #
@@ -179,6 +182,8 @@ module GrowsurfRuby
179
182
  #
180
183
  # @param referral_status [Symbol, GrowsurfRuby::Models::Campaign::Create::ReferralStatus] The referral credit status; only meaningful when `referred_by` resolves to a ref
181
184
  #
185
+ # @param referred_at [Integer, nil] When the participant was referred, in Unix milliseconds. Used only with a valid `referredBy`. If you omit `referralStatus`, GrowSurf compares this time with the program's referral credit window to set it. Defaults to the time of the request.
186
+ #
182
187
  # @param referred_by [String] Referrer participant ID or email address.
183
188
  #
184
189
  # @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
@@ -620,7 +625,7 @@ module GrowsurfRuby
620
625
  #
621
626
  # @param body [String] Body param: HTML body for a free-form email. You can personalize it with dynamic text, inserting `{{...}}` tokens like `{{firstName}}` or `{{shareUrl}}`. See [Guide to using dynamic text in GrowSurf emails](https://support.growsurf.com/article/213-guide-to-using-dynamic-text-in-growsurf-emails).
622
627
  #
623
- # @param email_type [String] Body param: The program email template to send (template mode). Send the camelCase
628
+ # @param email_type [String] Body param: The program email template to trigger (template mode). Send the camelC
624
629
  #
625
630
  # @param preheader [String] Body param: Optional preheader text for a free-form email.
626
631
  #
@@ -96,6 +96,7 @@ module GrowsurfRuby
96
96
  raise ArgumentError.new("send content fields for only one Program Resource type") if supplied_types.length > 1
97
97
 
98
98
  type = params[:type]
99
+ type = type.to_sym if type.is_a?(String)
99
100
  if supplied_types.any? && !type.nil? && supplied_types.first != type
100
101
  raise ArgumentError.new("content fields must match the selected Program Resource type")
101
102
  end
@@ -63,6 +63,14 @@ module GrowsurfRuby
63
63
  #
64
64
  # @param metadata [Hash{Symbol=>Object}] Body param: Custom key/value metadata (single-level; values are stored as string
65
65
  #
66
+ # For `DOUBLE_SIDED` rewards in referral programs, `rewardAmount` is the
67
+ # referrer’s amount and `referredRewardAmount` is the friend’s amount. If
68
+ # `referredRewardAmount` is absent, both use `rewardAmount`. New or changed positive
69
+ # numeric amounts must use whole units for currencies without decimals, such as JPY, and
70
+ # no more than two decimal places for other currencies, including USD and KWD. Excess
71
+ # precision is rejected rather than rounded, including when you clone a program. Existing
72
+ # unchanged amounts and earned rewards keep their saved values.
73
+ #
66
74
  # @param next_milestone_prefix [String] Body param: Text shown before a participant's referral count in milestone-prog
67
75
  #
68
76
  # @param next_milestone_suffix [String] Body param: Text shown after a participant's referral count in milestone-progr
@@ -106,8 +114,7 @@ module GrowsurfRuby
106
114
  # the referencing fields. For an affiliate reward, `commissionStructure.event:
107
115
  # LEAD` requires a `FIXED` commission with a positive `amount`.
108
116
  # Changes to participant email content are checked before saving. Rejected content
109
- # returns `400`; if the check is unavailable, `503` asks you to retry. Neither
110
- # response saves the change. A concurrent edit can return `409`; reload the
117
+ # returns `400` and is not saved. A concurrent edit can return `409`; reload the
111
118
  # program before retrying.
112
119
  #
113
120
  # @overload update(campaign_reward_id, id:, commission_structure: nil, conversions_required: nil, coupon_code: nil, description: nil, event: nil, image_url: nil, image_icon_key: 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: {})
@@ -140,6 +147,14 @@ module GrowsurfRuby
140
147
  #
141
148
  # @param metadata [Hash{Symbol=>Object}] Body param: Custom key/value metadata (single-level; values are stored as string
142
149
  #
150
+ # For `DOUBLE_SIDED` rewards in referral programs, `rewardAmount` is the
151
+ # referrer’s amount and `referredRewardAmount` is the friend’s amount. If
152
+ # `referredRewardAmount` is absent, both use `rewardAmount`. New or changed positive
153
+ # numeric amounts must use whole units for currencies without decimals, such as JPY, and
154
+ # no more than two decimal places for other currencies, including USD and KWD. Excess
155
+ # precision is rejected rather than rounded, including when you clone a program. Existing
156
+ # unchanged amounts and earned rewards keep their saved values.
157
+ #
143
158
  # @param next_milestone_prefix [String] Body param: Text shown before a participant's referral count in milestone-prog
144
159
  #
145
160
  # @param next_milestone_suffix [String] Body param: Text shown after a participant's referral count in milestone-progr