growsurf-ruby 1.1.1 → 1.2.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 +14 -0
- data/README.md +1 -1
- data/lib/growsurf_ruby/client.rb +6 -5
- data/lib/growsurf_ruby/models/account_create_response.rb +5 -12
- data/lib/growsurf_ruby/models/team.rb +48 -0
- data/lib/growsurf_ruby/models/team_resend_owner_verification_email_response.rb +34 -0
- data/lib/growsurf_ruby/models/team_rotate_api_key_response.rb +17 -0
- data/lib/growsurf_ruby/models/team_update_params.rb +22 -0
- data/lib/growsurf_ruby/models.rb +3 -3
- data/lib/growsurf_ruby/resources/account.rb +9 -122
- data/lib/growsurf_ruby/resources/campaign/participant.rb +2 -2
- data/lib/growsurf_ruby/resources/campaign/reward.rb +3 -2
- data/lib/growsurf_ruby/resources/campaign.rb +2 -2
- data/lib/growsurf_ruby/resources/team.rb +109 -0
- data/lib/growsurf_ruby/version.rb +1 -1
- data/lib/growsurf_ruby.rb +5 -4
- data/rbi/growsurf_ruby/client.rbi +4 -1
- data/rbi/growsurf_ruby/models/account_create_response.rbi +0 -8
- data/rbi/growsurf_ruby/models/team.rbi +65 -0
- data/rbi/growsurf_ruby/models/{account_resend_verification_email_response.rbi → team_resend_owner_verification_email_response.rbi} +8 -18
- data/rbi/growsurf_ruby/models/{account_rotate_api_key_response.rbi → team_rotate_api_key_response.rbi} +3 -7
- data/rbi/growsurf_ruby/models/team_update_params.rbi +35 -0
- data/rbi/growsurf_ruby/models.rbi +3 -3
- data/rbi/growsurf_ruby/resources/account.rbi +0 -83
- data/rbi/growsurf_ruby/resources/campaign/participant.rbi +2 -2
- data/rbi/growsurf_ruby/resources/campaign/reward.rbi +3 -2
- data/rbi/growsurf_ruby/resources/campaign.rbi +3 -2
- data/rbi/growsurf_ruby/resources/team.rbi +52 -0
- data/sig/growsurf_ruby/client.rbs +3 -1
- data/sig/growsurf_ruby/models/account_create_response.rbs +0 -5
- data/sig/growsurf_ruby/models/team.rbs +36 -0
- data/sig/growsurf_ruby/models/team_resend_owner_verification_email_response.rbs +31 -0
- data/sig/growsurf_ruby/models/{account_rotate_api_key_response.rbs → team_rotate_api_key_response.rbs} +2 -2
- data/sig/growsurf_ruby/models/team_update_params.rbs +23 -0
- data/sig/growsurf_ruby/models.rbs +3 -3
- data/sig/growsurf_ruby/resources/account.rbs +0 -23
- data/sig/growsurf_ruby/resources/team.rbs +28 -0
- metadata +17 -14
- data/lib/growsurf_ruby/models/account.rb +0 -90
- data/lib/growsurf_ruby/models/account_resend_verification_email_response.rb +0 -33
- data/lib/growsurf_ruby/models/account_rotate_api_key_response.rb +0 -17
- data/lib/growsurf_ruby/models/account_update_params.rb +0 -35
- data/rbi/growsurf_ruby/models/account.rbi +0 -125
- data/rbi/growsurf_ruby/models/account_update_params.rbi +0 -65
- data/sig/growsurf_ruby/models/account.rbs +0 -67
- data/sig/growsurf_ruby/models/account_resend_verification_email_response.rbs +0 -35
- data/sig/growsurf_ruby/models/account_update_params.rbs +0 -42
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 42193bcccd25c0e13bb8fe762d66313d57b6c673b820322dc1a633dc8d3cd70e
|
|
4
|
+
data.tar.gz: 6280026d747b838e22cdf1db95a0f07eed13b0d049efca6af74d46e99f833f3a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7ec17bcbb93999329df4edd4c5d0e64e1385e9278c4168059d3f66817e49bf3e3463f0ab3c8cbef14742f9ee6bd3efc6461da26e53d11a4bced6120352da2c3f
|
|
7
|
+
data.tar.gz: cf651a17a07aa569619bc58d2e90c9d236ec8d7a2aebf9b10102d38dca72b120f2514d06eeb5853919235ab2e466e71db2c45cc937ae27b9cb7fbbe817922185
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0](https://github.com/growsurf/growsurf-ruby/compare/v1.1.2...v1.2.0) (2026-07-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **api:** add Team resource ([8b11d89](https://github.com/growsurf/growsurf-ruby/commit/8b11d89403a00bb2c381dd46295252d929d48370))
|
|
9
|
+
|
|
10
|
+
## [1.1.2](https://github.com/growsurf/growsurf-ruby/compare/v1.1.1...v1.1.2) (2026-07-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* support retry-safe API key rotation ([939cd05](https://github.com/growsurf/growsurf-ruby/commit/939cd054446d85e411652ae77d37d4351c1ad6ab))
|
|
16
|
+
|
|
3
17
|
## [1.1.1](https://github.com/growsurf/growsurf-ruby/compare/v1.1.0...v1.1.1) (2026-07-09)
|
|
4
18
|
|
|
5
19
|
|
data/README.md
CHANGED
data/lib/growsurf_ruby/client.rb
CHANGED
|
@@ -22,6 +22,9 @@ module GrowsurfRuby
|
|
|
22
22
|
# @return [GrowsurfRuby::Resources::Account]
|
|
23
23
|
attr_reader :account
|
|
24
24
|
|
|
25
|
+
# @return [GrowsurfRuby::Resources::Team]
|
|
26
|
+
attr_reader :team
|
|
27
|
+
|
|
25
28
|
# @return [GrowsurfRuby::Resources::Campaign]
|
|
26
29
|
attr_reader :campaign
|
|
27
30
|
|
|
@@ -59,10 +62,6 @@ module GrowsurfRuby
|
|
|
59
62
|
)
|
|
60
63
|
base_url ||= "https://api.growsurf.com/v2"
|
|
61
64
|
|
|
62
|
-
if api_key.nil?
|
|
63
|
-
raise ArgumentError.new("api_key is required, and can be set via environ: \"GROWSURF_API_KEY\"")
|
|
64
|
-
end
|
|
65
|
-
|
|
66
65
|
headers = {}
|
|
67
66
|
custom_headers_env = ENV["GROWSURF_CUSTOM_HEADERS"]
|
|
68
67
|
unless custom_headers_env.nil?
|
|
@@ -76,7 +75,7 @@ module GrowsurfRuby
|
|
|
76
75
|
headers = parsed.merge(headers)
|
|
77
76
|
end
|
|
78
77
|
|
|
79
|
-
@api_key = api_key
|
|
78
|
+
@api_key = api_key&.to_s
|
|
80
79
|
|
|
81
80
|
super(
|
|
82
81
|
base_url: base_url,
|
|
@@ -84,10 +83,12 @@ module GrowsurfRuby
|
|
|
84
83
|
max_retries: max_retries,
|
|
85
84
|
initial_retry_delay: initial_retry_delay,
|
|
86
85
|
max_retry_delay: max_retry_delay,
|
|
86
|
+
idempotency_header: "Idempotency-Key",
|
|
87
87
|
headers: headers
|
|
88
88
|
)
|
|
89
89
|
|
|
90
90
|
@account = GrowsurfRuby::Resources::Account.new(client: self)
|
|
91
|
+
@team = GrowsurfRuby::Resources::Team.new(client: self)
|
|
91
92
|
@campaign = GrowsurfRuby::Resources::Campaign.new(client: self)
|
|
92
93
|
end
|
|
93
94
|
end
|
|
@@ -14,18 +14,13 @@ module GrowsurfRuby
|
|
|
14
14
|
required :api_key, String, api_name: :apiKey
|
|
15
15
|
|
|
16
16
|
# @!attribute email
|
|
17
|
+
# Email address for the new account.
|
|
17
18
|
#
|
|
18
19
|
# @return [String]
|
|
19
20
|
required :email, String
|
|
20
21
|
|
|
21
|
-
# @!attribute id
|
|
22
|
-
# The new account's unique identifier.
|
|
23
|
-
#
|
|
24
|
-
# @return [String]
|
|
25
|
-
required :id, String
|
|
26
|
-
|
|
27
22
|
# @!attribute verification_status
|
|
28
|
-
# GrowSurf
|
|
23
|
+
# GrowSurf team verification state. `VERIFIED` is required before a program
|
|
29
24
|
# can send participant emails.
|
|
30
25
|
#
|
|
31
26
|
# @return [Symbol, GrowsurfRuby::Models::AccountCreateResponse::VerificationStatus]
|
|
@@ -33,7 +28,7 @@ module GrowsurfRuby
|
|
|
33
28
|
enum: -> { GrowsurfRuby::Models::AccountCreateResponse::VerificationStatus },
|
|
34
29
|
api_name: :verificationStatus
|
|
35
30
|
|
|
36
|
-
# @!method initialize(api_key:, email:,
|
|
31
|
+
# @!method initialize(api_key:, email:, verification_status:)
|
|
37
32
|
# Some parameter documentations has been truncated, see
|
|
38
33
|
# {GrowsurfRuby::Models::AccountCreateResponse} for more details.
|
|
39
34
|
#
|
|
@@ -41,11 +36,9 @@ module GrowsurfRuby
|
|
|
41
36
|
#
|
|
42
37
|
# @param email [String]
|
|
43
38
|
#
|
|
44
|
-
# @param
|
|
45
|
-
#
|
|
46
|
-
# @param verification_status [Symbol, GrowsurfRuby::Models::AccountCreateResponse::VerificationStatus] GrowSurf account verification state. `VERIFIED` is required before a program can
|
|
39
|
+
# @param verification_status [Symbol, GrowsurfRuby::Models::AccountCreateResponse::VerificationStatus] GrowSurf team verification state. `VERIFIED` is required before a program can
|
|
47
40
|
|
|
48
|
-
# GrowSurf
|
|
41
|
+
# GrowSurf team verification state. `VERIFIED` is required before a program
|
|
49
42
|
# can send participant emails.
|
|
50
43
|
#
|
|
51
44
|
# @see GrowsurfRuby::Models::AccountCreateResponse#verification_status
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see GrowsurfRuby::Resources::Team#retrieve
|
|
6
|
+
class Team < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute name
|
|
8
|
+
# The team's display name.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :name, String
|
|
12
|
+
|
|
13
|
+
# @!attribute verification_status
|
|
14
|
+
# GrowSurf team verification state. `VERIFIED` is required before a program can
|
|
15
|
+
# send participant emails.
|
|
16
|
+
#
|
|
17
|
+
# @return [Symbol, GrowsurfRuby::Models::Team::VerificationStatus]
|
|
18
|
+
required :verification_status,
|
|
19
|
+
enum: -> { GrowsurfRuby::Models::Team::VerificationStatus },
|
|
20
|
+
api_name: :verificationStatus
|
|
21
|
+
|
|
22
|
+
# @!attribute verification_requested_at
|
|
23
|
+
# When team verification was last requested, as a Unix timestamp in milliseconds.
|
|
24
|
+
#
|
|
25
|
+
# @return [Integer, nil]
|
|
26
|
+
required :verification_requested_at, Integer, api_name: :verificationRequestedAt, nil?: true
|
|
27
|
+
|
|
28
|
+
# @!method initialize(name:, verification_status:, verification_requested_at:)
|
|
29
|
+
# @param name [String] The team's display name.
|
|
30
|
+
#
|
|
31
|
+
# @param verification_status [Symbol, GrowsurfRuby::Models::Team::VerificationStatus] GrowSurf team verification state.
|
|
32
|
+
#
|
|
33
|
+
# @param verification_requested_at [Integer, nil] When team verification was last requested, as a Unix timestamp in milliseconds.
|
|
34
|
+
|
|
35
|
+
# GrowSurf team verification state.
|
|
36
|
+
module VerificationStatus
|
|
37
|
+
extend GrowsurfRuby::Internal::Type::Enum
|
|
38
|
+
|
|
39
|
+
NOT_REQUESTED = :NOT_REQUESTED
|
|
40
|
+
REQUESTED = :REQUESTED
|
|
41
|
+
VERIFIED = :VERIFIED
|
|
42
|
+
|
|
43
|
+
# @!method self.values
|
|
44
|
+
# @return [Array<Symbol>]
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see GrowsurfRuby::Resources::Team#resend_owner_verification_email
|
|
6
|
+
class TeamResendOwnerVerificationEmailResponse < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute status
|
|
8
|
+
# Status of the verification email request.
|
|
9
|
+
#
|
|
10
|
+
# @return [Symbol, GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse::Status]
|
|
11
|
+
required :status, enum: -> { GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse::Status }
|
|
12
|
+
|
|
13
|
+
# @!attribute success
|
|
14
|
+
# Whether the verification email request was accepted.
|
|
15
|
+
#
|
|
16
|
+
# @return [Boolean]
|
|
17
|
+
required :success, GrowsurfRuby::Internal::Type::Boolean
|
|
18
|
+
|
|
19
|
+
# @!method initialize(status:, success:)
|
|
20
|
+
# @param status [Symbol, GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse::Status]
|
|
21
|
+
#
|
|
22
|
+
# @param success [Boolean]
|
|
23
|
+
|
|
24
|
+
module Status
|
|
25
|
+
extend GrowsurfRuby::Internal::Type::Enum
|
|
26
|
+
|
|
27
|
+
SENT = :SENT
|
|
28
|
+
|
|
29
|
+
# @!method self.values
|
|
30
|
+
# @return [Array<Symbol>]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see GrowsurfRuby::Resources::Team#rotate_api_key
|
|
6
|
+
class TeamRotateAPIKeyResponse < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
# @!attribute api_key
|
|
8
|
+
# The new API key. Store it now; the key used for rotation stops working immediately.
|
|
9
|
+
#
|
|
10
|
+
# @return [String]
|
|
11
|
+
required :api_key, String, api_name: :apiKey
|
|
12
|
+
|
|
13
|
+
# @!method initialize(api_key:)
|
|
14
|
+
# @param api_key [String] The new API key.
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Models
|
|
5
|
+
# @see GrowsurfRuby::Resources::Team#update
|
|
6
|
+
class TeamUpdateParams < GrowsurfRuby::Internal::Type::BaseModel
|
|
7
|
+
extend GrowsurfRuby::Internal::Type::RequestParameters::Converter
|
|
8
|
+
include GrowsurfRuby::Internal::Type::RequestParameters
|
|
9
|
+
|
|
10
|
+
# @!attribute name
|
|
11
|
+
# The team's display name.
|
|
12
|
+
#
|
|
13
|
+
# @return [String]
|
|
14
|
+
required :name, String
|
|
15
|
+
|
|
16
|
+
# @!method initialize(name:, request_options: {})
|
|
17
|
+
# @param name [String] The team's display name.
|
|
18
|
+
#
|
|
19
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}]
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/growsurf_ruby/models.rb
CHANGED
|
@@ -39,11 +39,11 @@ module GrowsurfRuby
|
|
|
39
39
|
mod.define_sorbet_constant!(const) { T.type_alias { mod.to_sorbet_type } }
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
Account = GrowsurfRuby::Models::Account
|
|
43
|
-
|
|
44
42
|
AccountCreateParams = GrowsurfRuby::Models::AccountCreateParams
|
|
45
43
|
|
|
46
|
-
|
|
44
|
+
Team = GrowsurfRuby::Models::Team
|
|
45
|
+
|
|
46
|
+
TeamUpdateParams = GrowsurfRuby::Models::TeamUpdateParams
|
|
47
47
|
|
|
48
48
|
Campaign = GrowsurfRuby::Models::Campaign
|
|
49
49
|
|
|
@@ -3,30 +3,20 @@
|
|
|
3
3
|
module GrowsurfRuby
|
|
4
4
|
module Resources
|
|
5
5
|
class Account
|
|
6
|
-
# Creates a new GrowSurf account
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
# `EMAIL_NOT_VERIFIED_ERROR` until then (resend the email via `POST
|
|
11
|
-
# /account/verification-email`, then retry). A welcome email is sent to the
|
|
12
|
-
# address with the verification link and a set-password link for dashboard
|
|
13
|
-
# access. Accounts whose email is never verified are deleted automatically after
|
|
14
|
-
# 7 days. For security, the API key is rotated the first time the account owner
|
|
15
|
-
# signs in to the GrowSurf dashboard. Some actions (such as emailing
|
|
16
|
-
# participants) additionally require the GrowSurf team to verify the account
|
|
17
|
-
# first. By creating an account you agree, on behalf of the account holder, to
|
|
18
|
-
# GrowSurf's [Terms of Service](https://growsurf.com/terms) and
|
|
19
|
-
# [Privacy Policy](https://growsurf.com/privacy).
|
|
6
|
+
# Creates a new GrowSurf account and returns an API key shown once in the
|
|
7
|
+
# response. The key is locked until the team owner's email address is verified and
|
|
8
|
+
# rotates the first time the account owner signs in to the GrowSurf dashboard.
|
|
9
|
+
# Accounts whose email is never verified are deleted automatically after 7 days.
|
|
20
10
|
#
|
|
21
11
|
# @overload create(email:, company: nil, first_name: nil, last_name: nil, request_options: {})
|
|
22
12
|
#
|
|
23
|
-
# @param email [String] The email address for the new account. Personal emails and disposable email addresses are not accepted.
|
|
13
|
+
# @param email [String] The email address for the new GrowSurf account. Personal emails and disposable email addresses are not accepted.
|
|
24
14
|
#
|
|
25
|
-
# @param company [String]
|
|
15
|
+
# @param company [String] Company name for the new account.
|
|
26
16
|
#
|
|
27
|
-
# @param first_name [String]
|
|
17
|
+
# @param first_name [String] First name for the new account owner.
|
|
28
18
|
#
|
|
29
|
-
# @param last_name [String]
|
|
19
|
+
# @param last_name [String] Last name for the new account owner.
|
|
30
20
|
#
|
|
31
21
|
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
32
22
|
#
|
|
@@ -35,6 +25,7 @@ module GrowsurfRuby
|
|
|
35
25
|
# @see GrowsurfRuby::Models::AccountCreateParams
|
|
36
26
|
def create(params)
|
|
37
27
|
parsed, options = GrowsurfRuby::AccountCreateParams.dump_request(params)
|
|
28
|
+
options[:extra_headers] = options[:extra_headers].to_h.merge("authorization" => nil)
|
|
38
29
|
@client.request(
|
|
39
30
|
method: :post,
|
|
40
31
|
path: "accounts",
|
|
@@ -44,110 +35,6 @@ module GrowsurfRuby
|
|
|
44
35
|
)
|
|
45
36
|
end
|
|
46
37
|
|
|
47
|
-
# Retrieves the account that owns the API key: profile and GrowSurf-team
|
|
48
|
-
# verification state.
|
|
49
|
-
# `verificationStatus` is `VERIFIED` once the GrowSurf team has verified the account
|
|
50
|
-
# — this is required before you can send participant emails from a program.
|
|
51
|
-
#
|
|
52
|
-
# @overload retrieve(request_options: {})
|
|
53
|
-
#
|
|
54
|
-
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
55
|
-
#
|
|
56
|
-
# @return [GrowsurfRuby::Models::Account]
|
|
57
|
-
def retrieve(params = {})
|
|
58
|
-
@client.request(
|
|
59
|
-
method: :get,
|
|
60
|
-
path: "account",
|
|
61
|
-
model: GrowsurfRuby::Account,
|
|
62
|
-
options: params[:request_options]
|
|
63
|
-
)
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
# Updates your own account profile (`firstName`, `lastName`, `company`). Any other
|
|
67
|
-
# property is rejected with a `400` — in particular, the account `email` cannot be
|
|
68
|
-
# changed via the API, and billing/subscription is not editable here.
|
|
69
|
-
#
|
|
70
|
-
# @overload update(company: nil, first_name: nil, last_name: nil, request_options: {})
|
|
71
|
-
#
|
|
72
|
-
# @param company [String]
|
|
73
|
-
#
|
|
74
|
-
# @param first_name [String]
|
|
75
|
-
#
|
|
76
|
-
# @param last_name [String]
|
|
77
|
-
#
|
|
78
|
-
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
79
|
-
#
|
|
80
|
-
# @return [GrowsurfRuby::Models::Account]
|
|
81
|
-
#
|
|
82
|
-
# @see GrowsurfRuby::Models::AccountUpdateParams
|
|
83
|
-
def update(params = {})
|
|
84
|
-
parsed, options = GrowsurfRuby::AccountUpdateParams.dump_request(params)
|
|
85
|
-
@client.request(
|
|
86
|
-
method: :patch,
|
|
87
|
-
path: "account",
|
|
88
|
-
body: parsed,
|
|
89
|
-
model: GrowsurfRuby::Account,
|
|
90
|
-
options: options
|
|
91
|
-
)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
# Generates a new API key and immediately revokes the old one. The key used to make
|
|
95
|
-
# this request stops working as soon as the response is returned — update every
|
|
96
|
-
# integration that used the old key with the new one. The account owner is
|
|
97
|
-
# notified by email whenever the key is rotated.
|
|
98
|
-
#
|
|
99
|
-
# @overload rotate_api_key(request_options: {})
|
|
100
|
-
#
|
|
101
|
-
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
102
|
-
#
|
|
103
|
-
# @return [GrowsurfRuby::Models::AccountRotateAPIKeyResponse]
|
|
104
|
-
def rotate_api_key(params = {})
|
|
105
|
-
@client.request(
|
|
106
|
-
method: :post,
|
|
107
|
-
path: "account/api-key",
|
|
108
|
-
model: GrowsurfRuby::Models::AccountRotateAPIKeyResponse,
|
|
109
|
-
options: params[:request_options]
|
|
110
|
-
)
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
# Requests GrowSurf-team verification of your account (required before a program can
|
|
114
|
-
# email its participants). Idempotent — calling it again while a request is pending
|
|
115
|
-
# does not create a duplicate. Returns the account with its updated
|
|
116
|
-
# `verificationStatus`.
|
|
117
|
-
#
|
|
118
|
-
# @overload request_verification(request_options: {})
|
|
119
|
-
#
|
|
120
|
-
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
121
|
-
#
|
|
122
|
-
# @return [GrowsurfRuby::Models::Account]
|
|
123
|
-
def request_verification(params = {})
|
|
124
|
-
@client.request(
|
|
125
|
-
method: :post,
|
|
126
|
-
path: "account/verification-request",
|
|
127
|
-
model: GrowsurfRuby::Account,
|
|
128
|
-
options: params[:request_options]
|
|
129
|
-
)
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
# Resends the email-verification email to the account's email address. A `200`
|
|
133
|
-
# with `status: SENT` is only returned when an email was actually dispatched.
|
|
134
|
-
# Returns a `400` if the email is already verified, or a `429` if a verification
|
|
135
|
-
# email was sent too recently — wait a moment, then retry.
|
|
136
|
-
#
|
|
137
|
-
# @overload resend_verification_email(request_options: {})
|
|
138
|
-
#
|
|
139
|
-
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
140
|
-
#
|
|
141
|
-
# @return [GrowsurfRuby::Models::AccountResendVerificationEmailResponse]
|
|
142
|
-
def resend_verification_email(params = {})
|
|
143
|
-
@client.request(
|
|
144
|
-
method: :post,
|
|
145
|
-
path: "account/verification-email",
|
|
146
|
-
model: GrowsurfRuby::Models::AccountResendVerificationEmailResponse,
|
|
147
|
-
options: params[:request_options]
|
|
148
|
-
)
|
|
149
|
-
end
|
|
150
|
-
|
|
151
38
|
# @api private
|
|
152
39
|
#
|
|
153
40
|
# @param client [GrowsurfRuby::Client]
|
|
@@ -584,8 +584,8 @@ module GrowsurfRuby
|
|
|
584
584
|
# program's configured email templates, OR `subject` + `body` for a free-form email.
|
|
585
585
|
# Free-form emails are sent with the same compliance handling (company name,
|
|
586
586
|
# postal address, and an unsubscribe link are added automatically, and unsubscribed
|
|
587
|
-
# participants are suppressed). Sending requires the
|
|
588
|
-
# GrowSurf
|
|
587
|
+
# participants are suppressed). Sending requires the team to be verified by
|
|
588
|
+
# GrowSurf. Requires a verified custom email domain on the program (set up
|
|
589
589
|
# in Campaign Editor > 3. Emails > Email Settings). Returns `400` until one is
|
|
590
590
|
# verified.
|
|
591
591
|
# The email is accepted for delivery.
|
|
@@ -33,7 +33,8 @@ module GrowsurfRuby
|
|
|
33
33
|
)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
# Approves a manually approved reward earned by a participant.
|
|
36
|
+
# Approves a manually approved reward earned by a participant. Requires
|
|
37
|
+
# `reward:write`. Passing `fulfill: true` also requires `reward:fulfill`.
|
|
37
38
|
#
|
|
38
39
|
# @overload approve(reward_id, id:, fulfill: nil, request_options: {})
|
|
39
40
|
#
|
|
@@ -63,7 +64,7 @@ module GrowsurfRuby
|
|
|
63
64
|
)
|
|
64
65
|
end
|
|
65
66
|
|
|
66
|
-
# Marks an approved participant reward as fulfilled.
|
|
67
|
+
# Marks an approved participant reward as fulfilled. Requires `reward:fulfill`.
|
|
67
68
|
#
|
|
68
69
|
# @overload fulfill(reward_id, id:, request_options: {})
|
|
69
70
|
#
|
|
@@ -76,8 +76,8 @@ module GrowsurfRuby
|
|
|
76
76
|
)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
# Creates a program. Only `type` is required;
|
|
80
|
-
# server-defaulted. Editor-tab configuration (design, emails, options,
|
|
79
|
+
# Creates a program owned by the API key's bound team. Only `type` is required;
|
|
80
|
+
# everything else is server-defaulted. Editor-tab configuration (design, emails, options,
|
|
81
81
|
# installation) is not accepted here — configure it via the config sub-resources
|
|
82
82
|
# (e.g. `campaign.options.update`) after the program is created.
|
|
83
83
|
#
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GrowsurfRuby
|
|
4
|
+
module Resources
|
|
5
|
+
class Team
|
|
6
|
+
# Retrieves the team bound to the API key or OAuth connection. A credential that
|
|
7
|
+
# can act across multiple teams cannot use this operation because it has no single
|
|
8
|
+
# Team resource.
|
|
9
|
+
#
|
|
10
|
+
# @overload retrieve(request_options: {})
|
|
11
|
+
#
|
|
12
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
13
|
+
#
|
|
14
|
+
# @return [GrowsurfRuby::Models::Team]
|
|
15
|
+
def retrieve(params = {})
|
|
16
|
+
@client.request(
|
|
17
|
+
method: :get,
|
|
18
|
+
path: "team",
|
|
19
|
+
model: GrowsurfRuby::Models::Team,
|
|
20
|
+
options: params[:request_options]
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Updates the name of the team bound to the API key or OAuth connection. Any
|
|
25
|
+
# other property is rejected with a `400`.
|
|
26
|
+
#
|
|
27
|
+
# @overload update(name:, request_options: {})
|
|
28
|
+
#
|
|
29
|
+
# @param name [String] The team's display name.
|
|
30
|
+
#
|
|
31
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
32
|
+
#
|
|
33
|
+
# @return [GrowsurfRuby::Models::Team]
|
|
34
|
+
#
|
|
35
|
+
# @see GrowsurfRuby::Models::TeamUpdateParams
|
|
36
|
+
def update(params)
|
|
37
|
+
parsed, options = GrowsurfRuby::TeamUpdateParams.dump_request(params)
|
|
38
|
+
@client.request(
|
|
39
|
+
method: :patch,
|
|
40
|
+
path: "team",
|
|
41
|
+
body: parsed,
|
|
42
|
+
model: GrowsurfRuby::Models::Team,
|
|
43
|
+
options: options
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Generates a new API key and makes the key used on this request stop working
|
|
48
|
+
# when rotation succeeds. The SDK sends a retry-safe `Idempotency-Key`, so
|
|
49
|
+
# automatic retries return the same replacement. Store the new key, then update
|
|
50
|
+
# every integration that used the old key. This operation is unavailable through
|
|
51
|
+
# MCP.
|
|
52
|
+
#
|
|
53
|
+
# @overload rotate_api_key(request_options: {})
|
|
54
|
+
#
|
|
55
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
56
|
+
#
|
|
57
|
+
# @return [GrowsurfRuby::Models::TeamRotateAPIKeyResponse]
|
|
58
|
+
def rotate_api_key(params = {})
|
|
59
|
+
@client.request(
|
|
60
|
+
method: :post,
|
|
61
|
+
path: "api-key/rotate",
|
|
62
|
+
model: GrowsurfRuby::Models::TeamRotateAPIKeyResponse,
|
|
63
|
+
options: params[:request_options]
|
|
64
|
+
)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Requests GrowSurf verification for the bound team. Calling this again while a
|
|
68
|
+
# request is pending does not create a duplicate.
|
|
69
|
+
#
|
|
70
|
+
# @overload request_verification(request_options: {})
|
|
71
|
+
#
|
|
72
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
73
|
+
#
|
|
74
|
+
# @return [GrowsurfRuby::Models::Team]
|
|
75
|
+
def request_verification(params = {})
|
|
76
|
+
@client.request(
|
|
77
|
+
method: :post,
|
|
78
|
+
path: "team/verification-request",
|
|
79
|
+
model: GrowsurfRuby::Models::Team,
|
|
80
|
+
options: params[:request_options]
|
|
81
|
+
)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Resends the email-verification message to the bound team's owner. The response
|
|
85
|
+
# never reveals the owner's email address.
|
|
86
|
+
#
|
|
87
|
+
# @overload resend_owner_verification_email(request_options: {})
|
|
88
|
+
#
|
|
89
|
+
# @param request_options [GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
90
|
+
#
|
|
91
|
+
# @return [GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse]
|
|
92
|
+
def resend_owner_verification_email(params = {})
|
|
93
|
+
@client.request(
|
|
94
|
+
method: :post,
|
|
95
|
+
path: "team/owner/verification-email",
|
|
96
|
+
model: GrowsurfRuby::Models::TeamResendOwnerVerificationEmailResponse,
|
|
97
|
+
options: params[:request_options]
|
|
98
|
+
)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# @api private
|
|
102
|
+
#
|
|
103
|
+
# @param client [GrowsurfRuby::Client]
|
|
104
|
+
def initialize(client:)
|
|
105
|
+
@client = client
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
data/lib/growsurf_ruby.rb
CHANGED
|
@@ -110,12 +110,12 @@ require_relative "growsurf_ruby/models/campaign/webhook_list_response"
|
|
|
110
110
|
require_relative "growsurf_ruby/models/campaign/webhook_test_params"
|
|
111
111
|
require_relative "growsurf_ruby/models/campaign/webhook_test_response"
|
|
112
112
|
require_relative "growsurf_ruby/models/campaign/webhook_update_params"
|
|
113
|
-
require_relative "growsurf_ruby/models/account"
|
|
114
113
|
require_relative "growsurf_ruby/models/account_create_params"
|
|
115
114
|
require_relative "growsurf_ruby/models/account_create_response"
|
|
116
|
-
require_relative "growsurf_ruby/models/
|
|
117
|
-
require_relative "growsurf_ruby/models/
|
|
118
|
-
require_relative "growsurf_ruby/models/
|
|
115
|
+
require_relative "growsurf_ruby/models/team"
|
|
116
|
+
require_relative "growsurf_ruby/models/team_resend_owner_verification_email_response"
|
|
117
|
+
require_relative "growsurf_ruby/models/team_rotate_api_key_response"
|
|
118
|
+
require_relative "growsurf_ruby/models/team_update_params"
|
|
119
119
|
require_relative "growsurf_ruby/models/campaign"
|
|
120
120
|
require_relative "growsurf_ruby/models/campaign_create_mobile_participant_token_params"
|
|
121
121
|
require_relative "growsurf_ruby/models/campaign_create_mobile_participant_token_response"
|
|
@@ -139,6 +139,7 @@ require_relative "growsurf_ruby/models/referral_list"
|
|
|
139
139
|
require_relative "growsurf_ruby/models/reward_tax_valuation"
|
|
140
140
|
require_relative "growsurf_ruby/models"
|
|
141
141
|
require_relative "growsurf_ruby/resources/account"
|
|
142
|
+
require_relative "growsurf_ruby/resources/team"
|
|
142
143
|
require_relative "growsurf_ruby/resources/campaign"
|
|
143
144
|
require_relative "growsurf_ruby/resources/campaign/commission"
|
|
144
145
|
require_relative "growsurf_ruby/resources/campaign/design"
|
|
@@ -11,12 +11,15 @@ module GrowsurfRuby
|
|
|
11
11
|
DEFAULT_MAX_RETRY_DELAY = T.let(8.0, Float)
|
|
12
12
|
|
|
13
13
|
# GrowSurf REST API key supplied as `Authorization: Bearer <api_key>`.
|
|
14
|
-
sig { returns(String) }
|
|
14
|
+
sig { returns(T.nilable(String)) }
|
|
15
15
|
attr_reader :api_key
|
|
16
16
|
|
|
17
17
|
sig { returns(GrowsurfRuby::Resources::Account) }
|
|
18
18
|
attr_reader :account
|
|
19
19
|
|
|
20
|
+
sig { returns(GrowsurfRuby::Resources::Team) }
|
|
21
|
+
attr_reader :team
|
|
22
|
+
|
|
20
23
|
sig { returns(GrowsurfRuby::Resources::Campaign) }
|
|
21
24
|
attr_reader :campaign
|
|
22
25
|
|
|
@@ -21,10 +21,6 @@ module GrowsurfRuby
|
|
|
21
21
|
sig { returns(String) }
|
|
22
22
|
attr_accessor :email
|
|
23
23
|
|
|
24
|
-
# The new account's unique identifier.
|
|
25
|
-
sig { returns(String) }
|
|
26
|
-
attr_accessor :id
|
|
27
|
-
|
|
28
24
|
# GrowSurf account verification state. `VERIFIED` is required before a program
|
|
29
25
|
# can send participant emails.
|
|
30
26
|
sig do
|
|
@@ -38,7 +34,6 @@ module GrowsurfRuby
|
|
|
38
34
|
params(
|
|
39
35
|
api_key: String,
|
|
40
36
|
email: String,
|
|
41
|
-
id: String,
|
|
42
37
|
verification_status:
|
|
43
38
|
GrowsurfRuby::Models::AccountCreateResponse::VerificationStatus::OrSymbol
|
|
44
39
|
).returns(T.attached_class)
|
|
@@ -50,8 +45,6 @@ module GrowsurfRuby
|
|
|
50
45
|
# dashboard.
|
|
51
46
|
api_key:,
|
|
52
47
|
email:,
|
|
53
|
-
# The new account's unique identifier.
|
|
54
|
-
id:,
|
|
55
48
|
# GrowSurf account verification state. `VERIFIED` is required before a program
|
|
56
49
|
# can send participant emails.
|
|
57
50
|
verification_status:
|
|
@@ -63,7 +56,6 @@ module GrowsurfRuby
|
|
|
63
56
|
{
|
|
64
57
|
api_key: String,
|
|
65
58
|
email: String,
|
|
66
|
-
id: String,
|
|
67
59
|
verification_status:
|
|
68
60
|
GrowsurfRuby::Models::AccountCreateResponse::VerificationStatus::TaggedSymbol
|
|
69
61
|
}
|