Class: Warbler::UsersController

Inherits:
ApplicationController show all
Defined in:
lib/warbler/controllers/users_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#initialize

Constructor Details

This class inherits a constructor from Warbler::ApplicationController

Instance Method Details

#identify(email, first_name: nil, last_name: nil) ⇒ Object

This endpoint lets you tie a user with his/her activities. You’ll want to identify a user with any relevant information as soon as they log-in or sign-up.

Parameters:

  • email (String)

    Required parameter: The user’s email address

  • first_name (String) (defaults to: nil)

    Optional parameter: The user’s first name

  • last_name (String) (defaults to: nil)

    Optional parameter: The user’s last name

Returns:

  • mixed response from the API call



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/warbler/controllers/users_controller.rb', line 11

def identify email, first_name: nil, last_name: nil
  # the base uri for api requests
  query_builder = base_uri

  # prepare query string for API call
  query_builder << "/v3/users"

  # process optional query parameters
  query_builder = APIHelper.append_url_with_query_parameters query_builder, {
    "email" => CGI::escape(email),
    "first_name" => first_name,
    "last_name" => last_name,
  }

  perform_query('post', query_builder)
end