Class: GrowsurfRuby::Resources::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/growsurf_ruby/resources/account.rb,
sig/growsurf_ruby/resources/account.rbs

Instance Method Summary collapse

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.

Parameters:



51
52
53
# File 'lib/growsurf_ruby/resources/account.rb', line 51

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 team owner's email address is verified: authenticated program and resource endpoints return a 403 with error code EMAIL_NOT_VERIFIED_ERROR until then (resend the email via POST /team/owner/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 GrowSurf to verify the team first. By creating an account you agree, on behalf of the account holder, to GrowSurf's Terms of Service and Privacy Policy.

Parameters:

  • email (String)

    The email address for the new GrowSurf account. Personal emails and disposable email addresses are not accepted.

  • company (String)

    Company name for the new account.

  • first_name (String)

    First name for the new account owner.

  • last_name (String)

    Last name for the new account owner.

  • request_options (GrowsurfRuby::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/growsurf_ruby/resources/account.rb', line 36

def create(params)
  parsed, options = GrowsurfRuby::AccountCreateParams.dump_request(params)
  options[:extra_headers] = options[:extra_headers].to_h.merge("authorization" => nil)
  @client.request(
    method: :post,
    path: "accounts",
    body: parsed,
    model: GrowsurfRuby::Models::AccountCreateResponse,
    options: options
  )
end