auth v1.2.1 Auth.Person

Link to this section Summary

Functions

Default attributes validation for Person

get_person_by_email/1 returns the person based on email address.

transform_github_profile_data_to_person/1 transforms the profile data received from invoking ElixirAuthGithub.github_auth/1 into a person record that can be inserted into the people table.

transform_profile_data_to_person/1 transforms the profile data received from invoking ElixirAuthGoogle.get_user_profile/1 into a person record that can be inserted into the people table.

Link to this section Functions

Link to this function

changeset(person, attrs)

Default attributes validation for Person

Link to this function

create_github_person(profile)

Link to this function

create_google_person(profile)

Link to this function

create_person(person)

Link to this function

get_person_by_email(email)

get_person_by_email/1 returns the person based on email address.

Link to this function

put_email_status_verified(changeset)

Link to this function

transform_github_profile_data_to_person(profile)

transform_github_profile_data_to_person/1 transforms the profile data received from invoking ElixirAuthGithub.github_auth/1 into a person record that can be inserted into the people table.

Example

iex> transform_profile_data_to_person(%{

avatar_url: "https://avatars3.githubusercontent.com/u/194400?v=4",
email: "alex@gmail.com",
followers: 2846,
login: "alex",
name: "Alex McAwesome",
type: "User",
url: "https://api.github.com/users/alex"

}) %{

"email" => "nelson@gmail.com",
"picture" => "https://avatars3.githubusercontent.com/u/194400?v=4",
"status" => 1,
"givenName" => "Alex McAwesome"

}

Link to this function

transform_google_profile_data_to_person(profile)

transform_profile_data_to_person/1 transforms the profile data received from invoking ElixirAuthGoogle.get_user_profile/1 into a person record that can be inserted into the people table.

Example

iex> transform_profile_data_to_person(%{

"email" => "nelson@gmail.com",
"email_verified" => true,
"family_name" => "Correia",
"given_name" => "Nelson",
"locale" => "en",
"name" => "Nelson Correia",
"picture" => "https://lh3.googleusercontent.com/a-/AAuE7mApnYb260YC1JY7a",
"sub" => "940732358705212133793"

}) %{

"email" => "nelson@gmail.com",
"email_verified" => true,
"family_name" => "Correia",
"given_name" => "Nelson",
"locale" => "en",
"name" => "Nelson Correia",
"picture" => "https://lh3.googleusercontent.com/a-/AAuE7mApnYb260YC1JY7a",
"sub" => "940732358705212133793"
"status" => 1,
"familyName" => "Correia",
"givenName" => "Nelson"

}