Class: Hanko::Api::Admin::Emails

Inherits:
BaseResource show all
Defined in:
lib/hanko/api/admin/emails.rb

Overview

Admin resource for managing a user’s email addresses. Inherits list, get, create, update, delete from BaseResource.

Instance Method Summary collapse

Methods inherited from BaseResource

#create, #delete, #get, #list, #update

Constructor Details

#initialize(connection, user_base_path) ⇒ Emails

Initialize the emails resource scoped to a user.

Parameters:

  • connection (Hanko::Connection)

    the HTTP connection to use

  • user_base_path (String)

    the base path for the parent user (e.g. “/users/:id”)



14
15
16
17
# File 'lib/hanko/api/admin/emails.rb', line 14

def initialize(connection, user_base_path)
  super(connection, "#{user_base_path}/emails")
  @connection = connection
end

Instance Method Details

#make_primary(email_id) ⇒ Resource

Mark an email address as the primary email for the user.

Parameters:

  • email_id (String)

    the unique identifier of the email to make primary

Returns:

  • (Resource)

    the updated email resource



23
24
25
26
# File 'lib/hanko/api/admin/emails.rb', line 23

def make_primary(email_id)
  response = @connection.post("#{@base_path}/#{email_id}/set_primary")
  parse_resource(response.body)
end