Module: Notifly::Models::Flyable

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/notifly/models/flyable.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#_create_notification_for(fly) ⇒ Object



92
93
94
95
96
97
98
99
100
101
102
# File 'lib/notifly/models/flyable.rb', line 92

def _create_notification_for(fly)
  new_fly = _default_fly.merge(fly)

  notification = Notifly::Notification.create _get_attributes_from(new_fly)
  _after_create_notification(notification, new_fly)

rescue => e
  logger.error "Something goes wrong with Notifly, will ignore: #{e}"
  raise e if not Rails.env.production?

end

#notifly_notifications(kind = nil) ⇒ Object



104
105
106
107
# File 'lib/notifly/models/flyable.rb', line 104

def notifly_notifications(kind=nil)
  notifications = Notifly::Notification.all_from(self)
  kind.present? ? notifications.where(kind: kind) : notifications
end