Class: GrowsurfRuby::Resources::Account
- Inherits:
-
Object
- Object
- GrowsurfRuby::Resources::Account
- Defined in:
- lib/growsurf_ruby/resources/account.rb,
sig/growsurf_ruby/resources/account.rbs
Instance Method Summary collapse
-
#create(email:, company: nil, first_name: nil, last_name: nil, request_options: {}) ⇒ GrowsurfRuby::Models::AccountCreateResponse
Creates a new GrowSurf account.
-
#initialize(client:) ⇒ Account
constructor
private
A new instance of Account.
-
#request_verification(request_options: {}) ⇒ GrowsurfRuby::Models::Account
Requests GrowSurf-team verification of your account (required before a program can email its participants).
-
#resend_verification_email(request_options: {}) ⇒ GrowsurfRuby::Models::AccountResendVerificationEmailResponse
Resends the email-verification email to the account's email address.
-
#retrieve(request_options: {}) ⇒ GrowsurfRuby::Models::Account
Retrieves the account that owns the API key: profile and GrowSurf-team verification state.
-
#rotate_api_key(request_options: {}) ⇒ GrowsurfRuby::Models::AccountRotateAPIKeyResponse
Generates a new API key and invalidates the key used for the request.
-
#update(company: nil, first_name: nil, last_name: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Account
Updates your own account profile (
firstName,lastName,company).
Constructor Details
#initialize(client:) ⇒ Account
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Account.
157 158 159 |
# File 'lib/growsurf_ruby/resources/account.rb', line 157 def initialize(client:) @client = client end |
Instance Method Details
#create(email:, company: nil, first_name: nil, last_name: nil, request_options: {}) ⇒ GrowsurfRuby::Models::AccountCreateResponse
Creates a new GrowSurf account. This is the only endpoint that does not require
an API key. The response includes an API key for the new account, shown once
in the response. The key is locked until the account's email address is
verified: authenticated endpoints outside the Accounts group return a 403
with error code
EMAIL_NOT_VERIFIED_ERROR until then (resend the email via POST /account/verification-email, then retry). A welcome email is sent to the
address with the verification link and a set-password link for dashboard
access. Accounts whose email is never verified are deleted automatically after
7 days. For security, the API key is rotated the first time the account owner
signs in to the GrowSurf dashboard. Some actions (such as emailing
participants) additionally require the GrowSurf team to verify the account
first. By creating an account you agree, on behalf of the account holder, to
GrowSurf's Terms of Service and
Privacy Policy.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/growsurf_ruby/resources/account.rb', line 37 def create(params) parsed, = GrowsurfRuby::AccountCreateParams.dump_request(params) @client.request( method: :post, path: "accounts", body: parsed, model: GrowsurfRuby::Models::AccountCreateResponse, options: ) end |
#request_verification(request_options: {}) ⇒ GrowsurfRuby::Models::Account
Requests GrowSurf-team verification of your account (required before a program can
email its participants). Idempotent — calling it again while a request is pending
does not create a duplicate. Returns the account with its updated
verificationStatus.
126 127 128 129 130 131 132 133 |
# File 'lib/growsurf_ruby/resources/account.rb', line 126 def request_verification(params = {}) @client.request( method: :post, path: "account/verification-request", model: GrowsurfRuby::Account, options: params[:request_options] ) end |
#resend_verification_email(request_options: {}) ⇒ GrowsurfRuby::Models::AccountResendVerificationEmailResponse
Resends the email-verification email to the account's email address. A 200
with status: SENT is only returned when an email was actually dispatched.
Returns a 400 if the email is already verified, or a 429 if a verification
email was sent too recently — wait a moment, then retry.
145 146 147 148 149 150 151 152 |
# File 'lib/growsurf_ruby/resources/account.rb', line 145 def resend_verification_email(params = {}) @client.request( method: :post, path: "account/verification-email", model: GrowsurfRuby::Models::AccountResendVerificationEmailResponse, options: params[:request_options] ) end |
#retrieve(request_options: {}) ⇒ GrowsurfRuby::Models::Account
Retrieves the account that owns the API key: profile and GrowSurf-team
verification state.
verificationStatus is VERIFIED once the GrowSurf team has verified the account
— this is required before you can send participant emails from a program.
58 59 60 61 62 63 64 65 |
# File 'lib/growsurf_ruby/resources/account.rb', line 58 def retrieve(params = {}) @client.request( method: :get, path: "account", model: GrowsurfRuby::Account, options: params[:request_options] ) end |
#rotate_api_key(request_options: {}) ⇒ GrowsurfRuby::Models::AccountRotateAPIKeyResponse
Generates a new API key and invalidates the key used for the request. The SDK
sends a retry-safe Idempotency-Key, so automatic retries return the same
replacement. Store the returned key, then update every integration that used
the old key. The account owner is notified by email whenever the key is rotated.
Requires an API key with api_key:rotate. This operation is available only through
the REST API or a GrowSurf API SDK, not through MCP.
107 108 109 110 111 112 113 114 |
# File 'lib/growsurf_ruby/resources/account.rb', line 107 def rotate_api_key(params = {}) @client.request( method: :post, path: "account/api-key", model: GrowsurfRuby::Models::AccountRotateAPIKeyResponse, options: params[:request_options] ) end |
#update(company: nil, first_name: nil, last_name: nil, request_options: {}) ⇒ GrowsurfRuby::Models::Account
Updates your own account profile (firstName, lastName, company). Any other
property is rejected with a 400 — in particular, the account email cannot be
changed via the API, and billing/subscription is not editable here.
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/growsurf_ruby/resources/account.rb', line 84 def update(params = {}) parsed, = GrowsurfRuby::AccountUpdateParams.dump_request(params) @client.request( method: :patch, path: "account", body: parsed, model: GrowsurfRuby::Account, options: ) end |