growsurf-ruby 0.7.0 → 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 +7 -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/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/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 +8 -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/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/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/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/rewards.rbs +70 -0
- data/sig/growsurf_ruby/resources/campaign.rbs +35 -0
- metadata +26 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see GrowsurfRuby::Resources::Campaign#create
|
|
6
|
+
class CampaignCreateParams < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
extend GrowsurfRuby::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include GrowsurfRuby::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute type
|
|
11
|
+
#
|
|
12
|
+
# @return [Symbol, GrowsurfRuby::Models::CampaignCreateParams::Type]
|
|
13
|
+
required :type, enum: -> { GrowsurfRuby::CampaignCreateParams::Type }
|
|
14
|
+
|
|
15
|
+
# @!attribute company_logo_image_url
|
|
16
|
+
#
|
|
17
|
+
# @return [String, nil]
|
|
18
|
+
optional :company_logo_image_url, String, api_name: :companyLogoImageUrl
|
|
19
|
+
|
|
20
|
+
# @!attribute company_name
|
|
21
|
+
#
|
|
22
|
+
# @return [String, nil]
|
|
23
|
+
optional :company_name, String, api_name: :companyName
|
|
24
|
+
|
|
25
|
+
# @!attribute currency_iso
|
|
26
|
+
#
|
|
27
|
+
# @return [String, nil]
|
|
28
|
+
optional :currency_iso, String, api_name: :currencyISO
|
|
29
|
+
|
|
30
|
+
# @!attribute goal
|
|
31
|
+
#
|
|
32
|
+
# @return [String, nil]
|
|
33
|
+
optional :goal, String
|
|
34
|
+
|
|
35
|
+
# @!attribute name
|
|
36
|
+
#
|
|
37
|
+
# @return [String, nil]
|
|
38
|
+
optional :name, String
|
|
39
|
+
|
|
40
|
+
# @!attribute options
|
|
41
|
+
#
|
|
42
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
43
|
+
optional :options, GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown]
|
|
44
|
+
|
|
45
|
+
# @!attribute rewards
|
|
46
|
+
#
|
|
47
|
+
# @return [Array<GrowsurfRuby::Models::Campaign::RewardCreateParams>, nil]
|
|
48
|
+
optional :rewards,
|
|
49
|
+
-> { GrowsurfRuby::Internal::Type::ArrayOf[GrowsurfRuby::Campaign::RewardCreateParams] }
|
|
50
|
+
|
|
51
|
+
# @!method initialize(type:, company_logo_image_url: nil, company_name: nil, currency_iso: nil, goal: nil, name: nil, options: nil, rewards: nil, request_options: {})
|
|
52
|
+
# @param type [Symbol, GrowsurfRuby::Models::CampaignCreateParams::Type]
|
|
53
|
+
#
|
|
54
|
+
# @param company_logo_image_url [String]
|
|
55
|
+
#
|
|
56
|
+
# @param company_name [String]
|
|
57
|
+
#
|
|
58
|
+
# @param currency_iso [String]
|
|
59
|
+
#
|
|
60
|
+
# @param goal [String]
|
|
61
|
+
#
|
|
62
|
+
# @param name [String]
|
|
63
|
+
#
|
|
64
|
+
# @param options [Hash{Symbol=>Object}]
|
|
65
|
+
#
|
|
66
|
+
# @param rewards [Array<GrowsurfRuby::Models::Campaign::RewardCreateParams>]
|
|
67
|
+
#
|
|
68
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}]
|
|
69
|
+
|
|
70
|
+
# @see GrowsurfRuby::Models::CampaignCreateParams#type
|
|
71
|
+
module Type
|
|
72
|
+
extend GrowsurfRuby::Internal::Type::Enum
|
|
73
|
+
|
|
74
|
+
REFERRAL = :REFERRAL
|
|
75
|
+
AFFILIATE = :AFFILIATE
|
|
76
|
+
|
|
77
|
+
# @!method self.values
|
|
78
|
+
# @return [Array<Symbol>]
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see GrowsurfRuby::Resources::Campaign#update
|
|
6
|
+
class CampaignUpdateParams < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
extend GrowsurfRuby::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include GrowsurfRuby::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute id
|
|
11
|
+
#
|
|
12
|
+
# @return [String]
|
|
13
|
+
required :id, String
|
|
14
|
+
|
|
15
|
+
# @!attribute company_logo_image_url
|
|
16
|
+
#
|
|
17
|
+
# @return [String, nil]
|
|
18
|
+
optional :company_logo_image_url, String, api_name: :companyLogoImageUrl
|
|
19
|
+
|
|
20
|
+
# @!attribute company_name
|
|
21
|
+
#
|
|
22
|
+
# @return [String, nil]
|
|
23
|
+
optional :company_name, String, api_name: :companyName
|
|
24
|
+
|
|
25
|
+
# @!attribute currency_iso
|
|
26
|
+
#
|
|
27
|
+
# @return [String, nil]
|
|
28
|
+
optional :currency_iso, String, api_name: :currencyISO
|
|
29
|
+
|
|
30
|
+
# @!attribute design
|
|
31
|
+
#
|
|
32
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
33
|
+
optional :design, GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown]
|
|
34
|
+
|
|
35
|
+
# @!attribute emails
|
|
36
|
+
#
|
|
37
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
38
|
+
optional :emails, GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown]
|
|
39
|
+
|
|
40
|
+
# @!attribute goal
|
|
41
|
+
#
|
|
42
|
+
# @return [String, nil]
|
|
43
|
+
optional :goal, String
|
|
44
|
+
|
|
45
|
+
# @!attribute installation
|
|
46
|
+
#
|
|
47
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
48
|
+
optional :installation, GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown]
|
|
49
|
+
|
|
50
|
+
# @!attribute name
|
|
51
|
+
#
|
|
52
|
+
# @return [String, nil]
|
|
53
|
+
optional :name, String
|
|
54
|
+
|
|
55
|
+
# @!attribute notifications
|
|
56
|
+
#
|
|
57
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
58
|
+
optional :notifications, GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown]
|
|
59
|
+
|
|
60
|
+
# @!attribute options
|
|
61
|
+
#
|
|
62
|
+
# @return [Hash{Symbol=>Object}, nil]
|
|
63
|
+
optional :options, GrowsurfRuby::Internal::Type::HashOf[GrowsurfRuby::Internal::Type::Unknown]
|
|
64
|
+
|
|
65
|
+
# @!attribute status
|
|
66
|
+
#
|
|
67
|
+
# @return [Symbol, GrowsurfRuby::Models::CampaignUpdateParams::Status, nil]
|
|
68
|
+
optional :status, enum: -> { GrowsurfRuby::CampaignUpdateParams::Status }
|
|
69
|
+
|
|
70
|
+
# @!method initialize(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: {})
|
|
71
|
+
# @param id [String]
|
|
72
|
+
#
|
|
73
|
+
# @param company_logo_image_url [String]
|
|
74
|
+
#
|
|
75
|
+
# @param company_name [String]
|
|
76
|
+
#
|
|
77
|
+
# @param currency_iso [String]
|
|
78
|
+
#
|
|
79
|
+
# @param design [Hash{Symbol=>Object}]
|
|
80
|
+
#
|
|
81
|
+
# @param emails [Hash{Symbol=>Object}]
|
|
82
|
+
#
|
|
83
|
+
# @param goal [String]
|
|
84
|
+
#
|
|
85
|
+
# @param installation [Hash{Symbol=>Object}]
|
|
86
|
+
#
|
|
87
|
+
# @param name [String]
|
|
88
|
+
#
|
|
89
|
+
# @param notifications [Hash{Symbol=>Object}]
|
|
90
|
+
#
|
|
91
|
+
# @param options [Hash{Symbol=>Object}]
|
|
92
|
+
#
|
|
93
|
+
# @param status [Symbol, GrowsurfRuby::Models::CampaignUpdateParams::Status]
|
|
94
|
+
#
|
|
95
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}]
|
|
96
|
+
|
|
97
|
+
# @see GrowsurfRuby::Models::CampaignUpdateParams#status
|
|
98
|
+
module Status
|
|
99
|
+
extend GrowsurfRuby::Internal::Type::Enum
|
|
100
|
+
|
|
101
|
+
DRAFT = :DRAFT
|
|
102
|
+
PENDING = :PENDING
|
|
103
|
+
IN_PROGRESS = :IN_PROGRESS
|
|
104
|
+
COMPLETE = :COMPLETE
|
|
105
|
+
CANCELLED = :CANCELLED
|
|
106
|
+
|
|
107
|
+
# @!method self.values
|
|
108
|
+
# @return [Array<Symbol>]
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
data/lib/growsurf_ruby/models.rb
CHANGED
|
@@ -46,6 +46,8 @@ module GrowsurfRuby
|
|
|
46
46
|
CampaignCreateMobileParticipantTokenParams =
|
|
47
47
|
GrowsurfRuby::Models::CampaignCreateMobileParticipantTokenParams
|
|
48
48
|
|
|
49
|
+
CampaignCreateParams = GrowsurfRuby::Models::CampaignCreateParams
|
|
50
|
+
|
|
49
51
|
CampaignListCommissionsParams = GrowsurfRuby::Models::CampaignListCommissionsParams
|
|
50
52
|
|
|
51
53
|
CampaignListLeaderboardParams = GrowsurfRuby::Models::CampaignListLeaderboardParams
|
|
@@ -62,6 +64,8 @@ module GrowsurfRuby
|
|
|
62
64
|
|
|
63
65
|
CampaignRetrieveParams = GrowsurfRuby::Models::CampaignRetrieveParams
|
|
64
66
|
|
|
67
|
+
CampaignUpdateParams = GrowsurfRuby::Models::CampaignUpdateParams
|
|
68
|
+
|
|
65
69
|
CommissionStructure = GrowsurfRuby::Models::CommissionStructure
|
|
66
70
|
|
|
67
71
|
ParticipantCommissionList = GrowsurfRuby::Models::ParticipantCommissionList
|
|
@@ -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,10 +54,12 @@ 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"
|
|
63
65
|
require_relative "growsurf_ruby/models/campaign/participant_cancel_delayed_referral_params"
|
|
@@ -82,15 +84,19 @@ require_relative "growsurf_ruby/models/campaign/participant_trigger_referral_res
|
|
|
82
84
|
require_relative "growsurf_ruby/models/campaign/participant_update_params"
|
|
83
85
|
require_relative "growsurf_ruby/models/campaign/referral_source"
|
|
84
86
|
require_relative "growsurf_ruby/models/campaign/referral_status"
|
|
87
|
+
require_relative "growsurf_ruby/models/campaign/reward"
|
|
85
88
|
require_relative "growsurf_ruby/models/campaign/reward_approve_params"
|
|
86
89
|
require_relative "growsurf_ruby/models/campaign/reward_approve_response"
|
|
90
|
+
require_relative "growsurf_ruby/models/campaign/reward_create_params"
|
|
87
91
|
require_relative "growsurf_ruby/models/campaign/reward_delete_params"
|
|
88
92
|
require_relative "growsurf_ruby/models/campaign/reward_delete_response"
|
|
89
93
|
require_relative "growsurf_ruby/models/campaign/reward_fulfill_params"
|
|
90
94
|
require_relative "growsurf_ruby/models/campaign/reward_fulfill_response"
|
|
95
|
+
require_relative "growsurf_ruby/models/campaign/reward_update_params"
|
|
91
96
|
require_relative "growsurf_ruby/models/campaign"
|
|
92
97
|
require_relative "growsurf_ruby/models/campaign_create_mobile_participant_token_params"
|
|
93
98
|
require_relative "growsurf_ruby/models/campaign_create_mobile_participant_token_response"
|
|
99
|
+
require_relative "growsurf_ruby/models/campaign_create_params"
|
|
94
100
|
require_relative "growsurf_ruby/models/campaign_list_commissions_params"
|
|
95
101
|
require_relative "growsurf_ruby/models/campaign_list_leaderboard_params"
|
|
96
102
|
require_relative "growsurf_ruby/models/campaign_list_params"
|
|
@@ -101,6 +107,7 @@ require_relative "growsurf_ruby/models/campaign_list_response"
|
|
|
101
107
|
require_relative "growsurf_ruby/models/campaign_retrieve_analytics_params"
|
|
102
108
|
require_relative "growsurf_ruby/models/campaign_retrieve_analytics_response"
|
|
103
109
|
require_relative "growsurf_ruby/models/campaign_retrieve_params"
|
|
110
|
+
require_relative "growsurf_ruby/models/campaign_update_params"
|
|
104
111
|
require_relative "growsurf_ruby/models/commission_structure"
|
|
105
112
|
require_relative "growsurf_ruby/models/participant_commission_list"
|
|
106
113
|
require_relative "growsurf_ruby/models/participant_list"
|
|
@@ -111,3 +118,4 @@ require_relative "growsurf_ruby/resources/campaign"
|
|
|
111
118
|
require_relative "growsurf_ruby/resources/campaign/commission"
|
|
112
119
|
require_relative "growsurf_ruby/resources/campaign/participant"
|
|
113
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
|