Class: Crm::Mailing
- Inherits:
-
Core::BasicResource
- Object
- Core::BasicResource
- Crm::Mailing
- Extended by:
- Core::Mixins::Findable::ClassMethods, Core::Mixins::Modifiable::ClassMethods, Core::Mixins::Searchable::ClassMethods
- Includes:
- Core::Mixins::ChangeLoggable, Core::Mixins::Findable, Core::Mixins::Inspectable, Core::Mixins::Modifiable, Core::Mixins::Searchable
- Defined in:
- lib/crm/mailing.rb
Overview
The purpose of a JustRelate WebCRM mailing is to send an email, e.g. a newsletter, to several recipients. The emails will be sent to the members of the contact collection associated with the mailing (mailing.collection_id
).
JustRelate WebCRM uses the / Liquid template engine for evaluating mailing content.
Instance Method Summary collapse
-
#clone ⇒ BasicResource
Clones a mailing.
-
#release ⇒ self
Releases this mailing.
-
#render_preview(render_for_contact_or_id) ⇒ Hash{String => String}
Renders a preview of the email for the given contact.
-
#send_me_a_proof_email(render_for_contact_or_id) ⇒ Hash{String => String}
Sends a proof email (personalized for a contact) to the current user (the API user).
-
#send_single_email(recipient_contact_or_id) ⇒ Hash{String => String}
Sends this mailing to a single contact.
Methods included from Core::Mixins::Findable::ClassMethods
Methods included from Core::Mixins::Modifiable::ClassMethods
Methods included from Core::Mixins::Searchable::ClassMethods
all, first, query, search_configurator, where, where_not
Methods included from Core::Mixins::Inspectable
Methods included from Core::Mixins::ChangeLoggable
Methods included from Core::Mixins::Modifiable
Methods inherited from Core::BasicResource
base_type, #eql?, #id, path, #path, #reload, resource_name, #type
Methods included from Core::Mixins::AttributeProvider
#[], #attributes, #initialize, #method_missing, #methods, #raw, #respond_to_missing?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Crm::Core::Mixins::AttributeProvider
Instance Method Details
#clone ⇒ BasicResource
Clones a mailing.
28 29 30 |
# File 'lib/crm/mailing.rb', line 28 def clone self.class.new(Core::RestApi.instance.post("#{path}/clone", {})) end |
#release ⇒ self
Releases this mailing.
Sends the mailing to all recipients, marks the mailing as released (released_at
, released_by
), and also sets planned_release_at
to now.
107 108 109 |
# File 'lib/crm/mailing.rb', line 107 def release load_attributes(Core::RestApi.instance.post("#{path}/release", {})) end |
#render_preview(render_for_contact_or_id) ⇒ Hash{String => String}
Renders a preview of the email for the given contact.
54 55 56 57 58 |
# File 'lib/crm/mailing.rb', line 54 def render_preview(render_for_contact_or_id) Core::RestApi.instance.post("#{path}/render_preview", { 'render_for_contact_id' => extract_id(render_for_contact_or_id) }) end |
#send_me_a_proof_email(render_for_contact_or_id) ⇒ Hash{String => String}
Sends a proof email (personalized for a contact) to the current user (the API user).
70 71 72 73 74 |
# File 'lib/crm/mailing.rb', line 70 def send_me_a_proof_email(render_for_contact_or_id) Core::RestApi.instance.post("#{path}/send_me_a_proof_email", { 'render_for_contact_id' => extract_id(render_for_contact_or_id) }) end |
#send_single_email(recipient_contact_or_id) ⇒ Hash{String => String}
Sends this mailing to a single contact.
Use case: If someone registers for a newsletter, you can send them the most recent issue that has already been released.
95 96 97 98 99 |
# File 'lib/crm/mailing.rb', line 95 def send_single_email(recipient_contact_or_id) Core::RestApi.instance.post("#{path}/send_single_email", { 'recipient_contact_id' => extract_id(recipient_contact_or_id) }) end |