Module: Nuntius
- Defined in:
- app/jobs/nuntius/messenger_job.rb,
lib/nuntius.rb,
lib/nuntius/devise.rb,
lib/nuntius/engine.rb,
lib/nuntius/version.rb,
lib/nuntius/nuntiable.rb,
lib/nuntius/deprecator.rb,
lib/nuntius/i18n_store.rb,
lib/nuntius/transactio.rb,
app/models/nuntius/list.rb,
app/models/nuntius/layout.rb,
app/models/nuntius/locale.rb,
lib/nuntius/configuration.rb,
lib/nuntius/state_machine.rb,
app/models/nuntius/message.rb,
app/models/nuntius/campaign.rb,
app/models/nuntius/template.rb,
lib/nuntius/mail_allow_list.rb,
app/drops/nuntius/layout_drop.rb,
app/models/nuntius/attachment.rb,
app/models/nuntius/subscriber.rb,
app/drops/nuntius/message_drop.rb,
app/drops/nuntius/campaign_drop.rb,
app/drops/nuntius/template_drop.rb,
app/jobs/nuntius/application_job.rb,
app/drops/nuntius/application_drop.rb,
app/jobs/nuntius/purge_message_job.rb,
app/jobs/nuntius/retrieve_mail_job.rb,
app/models/nuntius/inbound_message.rb,
app/models/nuntius/concerns/yamlify.rb,
app/providers/nuntius/base_provider.rb,
app/transports/nuntius/sms_transport.rb,
app/exceptions/nuntius/base_exception.rb,
app/messengers/nuntius/base_messenger.rb,
app/models/nuntius/application_record.rb,
app/transports/nuntius/base_transport.rb,
app/transports/nuntius/mail_transport.rb,
app/transports/nuntius/push_transport.rb,
app/helpers/nuntius/application_helper.rb,
app/jobs/nuntius/transport_refresh_job.rb,
app/runners/nuntius/application_runner.rb,
app/transports/nuntius/slack_transport.rb,
app/transports/nuntius/voice_transport.rb,
app/jobs/nuntius/transport_delivery_job.rb,
app/messengers/nuntius/custom_messenger.rb,
app/providers/nuntius/smtp_mail_provider.rb,
app/services/nuntius/application_service.rb,
app/providers/nuntius/twilio_sms_provider.rb,
app/message_boxes/nuntius/base_message_box.rb,
app/providers/nuntius/slack_slack_provider.rb,
app/controllers/nuntius/feedback_controller.rb,
app/controllers/nuntius/messages_controller.rb,
app/models/nuntius/concerns/metadata_scoped.rb,
app/providers/nuntius/apnotic_push_provider.rb,
app/providers/nuntius/houston_push_provider.rb,
app/providers/nuntius/twilio_voice_provider.rb,
app/runners/nuntius/timebased_events_runner.rb,
app/controllers/nuntius/callbacks_controller.rb,
app/controllers/nuntius/dashboard_controller.rb,
app/jobs/nuntius/deliver_inbound_message_job.rb,
app/jobs/nuntius/process_inbound_message_job.rb,
app/providers/nuntius/firebase_push_provider.rb,
app/reportlets/nuntius/application_reportlet.rb,
app/runners/nuntius/basic_application_runner.rb,
app/controllers/nuntius/api/events_controller.rb,
app/controllers/nuntius/admin/lists_controller.rb,
app/controllers/nuntius/application_controller.rb,
app/services/nuntius/aws_sns_processor_service.rb,
app/providers/nuntius/message_bird_sms_provider.rb,
app/controllers/nuntius/admin/layouts_controller.rb,
app/controllers/nuntius/admin/locales_controller.rb,
app/controllers/nuntius/admin/messages_controller.rb,
app/controllers/nuntius/admin/campaigns_controller.rb,
app/controllers/nuntius/admin/templates_controller.rb,
app/exceptions/nuntius/missing_messenger_exception.rb,
app/services/nuntius/retrieve_inbound_mail_service.rb,
app/controllers/nuntius/application_admin_controller.rb,
app/services/nuntius/deliver_inbound_message_service.rb,
app/controllers/nuntius/admin/lists/subscribers_controller.rb,
app/controllers/nuntius/admin/layouts/attachments_controller.rb,
app/reportlets/nuntius/daily_messages_per_template_reportlet.rb,
app/controllers/nuntius/inbound_messages/twilio_inbound_smses_controller.rb
Overview
Defined Under Namespace
Modules: ActiveRecordHelpers, ActiveStorageHelpers, Admin, ApplicationHelper, Concerns, Devise, InboundMessages, Nuntiable, StateMachine, Transactio Classes: ApnoticPushProvider, ApplicationAdminController, ApplicationController, ApplicationDrop, ApplicationJob, ApplicationRecord, ApplicationReportlet, ApplicationRunner, ApplicationService, Attachment, AwsSnsProcessorService, BaseException, BaseMessageBox, BaseMessenger, BaseProvider, BaseTransport, BasicApplicationRunner, CallbacksController, Campaign, CampaignDrop, Configuration, CustomMessenger, DailyMessagesPerTemplateReportlet, DashboardController, DeliverInboundMessageJob, DeliverInboundMessageService, Deprecator, Engine, Error, FeedbackController, FirebasePushProvider, HoustonPushProvider, I18nStore, InboundMessage, Layout, LayoutDrop, List, Locale, MailAllowList, MailTransport, Message, MessageBirdSmsProvider, MessageDrop, MessagesController, MessengerJob, MissingMessengerException, ProcessInboundMessageJob, PurgeMessageJob, PushTransport, RetrieveInboundMailService, RetrieveMailJob, SlackSlackProvider, SlackTransport, SmsTransport, SmtpMailProvider, Subscriber, Template, TemplateDrop, TimebasedEventsRunner, TransportDeliveryJob, TransportRefreshJob, TwilioSmsProvider, TwilioVoiceProvider, VoiceTransport
Constant Summary collapse
- ROOT_PATH =
Pathname.new(File.join(__dir__, '..'))
- VERSION =
"1.0.27"
Class Attribute Summary collapse
-
.config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
- .active_storage_enabled? ⇒ Boolean
-
.event(event, obj, params = {}) ⇒ Object
Fires an event for use with templates with the object.
- .i18n_store ⇒ Object
- .setup {|config| ... } ⇒ Object
- .templates?(obj, event) ⇒ Boolean
Class Attribute Details
.config ⇒ Object (readonly)
Returns the value of attribute config.
25 26 27 |
# File 'lib/nuntius.rb', line 25 def config @config end |
Class Method Details
.active_storage_enabled? ⇒ Boolean
61 62 63 |
# File 'lib/nuntius.rb', line 61 def active_storage_enabled? ActiveRecord::Base.connection.table_exists? 'active_storage_attachments' end |
.event(event, obj, params = {}) ⇒ Object
Fires an event for use with templates with the object
Nuntius.event(:your_event, car)
When custom events are enabled you can also do the following:
Nuntius.event(‘shipped’, { shipped: { to: ‘[email protected]’, ref: ‘Test-123’} }, attachments: [ { url: ‘example.com’ } ])
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/nuntius.rb', line 45 def event(event, obj, params = {}) return unless event return unless obj.is_a?(Hash) || obj.nuntiable? return unless templates?(obj, event) = params[:options] || {} if [:perform_now] == true Nuntius::MessengerJob.perform_now(obj, event.to_s, params) else job = Nuntius::MessengerJob job.set(wait: [:wait]) if [:wait] job.perform_later(obj, event.to_s, params) end end |
.i18n_store ⇒ Object
32 33 34 |
# File 'lib/nuntius.rb', line 32 def i18n_store @i18n_store ||= Nuntius::I18nStore.new end |
.setup {|config| ... } ⇒ Object
27 28 29 30 |
# File 'lib/nuntius.rb', line 27 def setup @config = Configuration.new yield config end |
.templates?(obj, event) ⇒ Boolean
65 66 67 68 69 70 |
# File 'lib/nuntius.rb', line 65 def templates?(obj, event) Nuntius::Template.where(klass: Nuntius::BaseMessenger.class_names_for(obj), event: Nuntius::BaseMessenger.event_name_for( obj, event )).where(enabled: true).count.positive? end |