Class: Spree::NewsletterSubscriber
- Inherits:
-
Object
- Object
- Spree::NewsletterSubscriber
show all
- Includes:
- Metafields, Emails
- Defined in:
- app/models/spree/newsletter_subscriber.rb,
app/models/spree/newsletter_subscriber/emails.rb
Defined Under Namespace
Modules: Emails
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Emails
#deliver_newsletter_email_verification
Class Method Details
.subscribe(email:, user: nil) ⇒ Object
54
55
56
|
# File 'app/models/spree/newsletter_subscriber.rb', line 54
def self.subscribe(email:, user: nil)
Spree::Newsletter::Subscribe.new(email: email, current_user: user).call
end
|
.verify(token:) ⇒ Object
58
59
60
61
62
|
# File 'app/models/spree/newsletter_subscriber.rb', line 58
def self.verify(token:)
subscriber = unverified.find_by!(verification_token: token)
Spree::Newsletter::Verify.new(subscriber: subscriber).call
end
|
Instance Method Details
#accepts_email_marketing ⇒ Object
40
41
42
43
44
|
# File 'app/models/spree/newsletter_subscriber.rb', line 40
def accepts_email_marketing
return user.accepts_email_marketing if user.present?
verified?
end
|
#to_csv(_store = nil) ⇒ Object
50
51
52
|
# File 'app/models/spree/newsletter_subscriber.rb', line 50
def to_csv(_store = nil)
Spree::CSV::NewsletterSubscriberPresenter.new(self).call
end
|
46
47
48
|
# File 'app/models/spree/newsletter_subscriber.rb', line 46
def verified?
verified_at.present?
end
|