Peacemaker.Optin (Peacemaker v3.3.5-rc.7) View Source
This module interfaces with anything WealthFit Optin Related.
At the time of writing, we have 3 main optin domains for entry points:
-
Lead Magnet Optin -
Expired Tripwire Offer Optin -
Expired Intensive Offer Optin.png)
Link to this section Summary
Functions
Creates a %Peacemaker.Optin{} changeset
Creates an Optin with an associated Segment record.
Attemps to find the Optin by the email first. If none exists, will create an %Optin{} record
Finds a Optin by en email
Link to this section Types
Specs
insert_raw_optin_response() :: Segment.t() | Ecto.Changeset.t()
Specs
Link to this section Functions
Creates a %Peacemaker.Optin{} changeset
Specs
create(t()) :: {atom(), insert_raw_optin_response()}
Creates an Optin with an associated Segment record.
This method should be the main entry point for creating optins within the WealthFit system.
This method returns an Optin record with the Segment record preloaded. We want to ensure that every Optin or Account has a Segment association. For more information on this pattern, check out the Ecto docs.
Example Usage:
Peacemaker.Optin.create(%{
first_name: "Bob",
last_name: "Loblaw",
email: "braddahman@wealthfit.com"
})
Specs
find_or_create(%{
first_name: String.t(),
last_name: String.t(),
email: String.t()
}) ::
{atom(),
%Peacemaker.Optin{
__meta__: term(),
allowed_intensives: term(),
email: term(),
first_name: term(),
id: term(),
last_name: term(),
user_profile: term()
}}
Attemps to find the Optin by the email first. If none exists, will create an %Optin{} record
Example Usage:
Peacemaker.Optin.find_or_create(%{
first_name: "Bob",
last_name: "Loblaw",
email: "braddahman@wealthfit.com"
})
Specs
get_optin_by([{:email, String.t()}]) ::
nil
| %Peacemaker.Optin{
__meta__: term(),
allowed_intensives: term(),
email: term(),
first_name: term(),
id: term(),
last_name: term(),
user_profile: term()
}
Finds a Optin by en email