Class: ActivityNotification::ORM::Dynamoid::Notification

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::AttributeAssignment, Association, Common, DynamoidExtension, NotificationApi, Renderable, Dynamoid::Document, GlobalID::Identification
Defined in:
lib/activity_notification/orm/dynamoid/notification.rb

Overview

Notification model implementation generated by ActivityNotification.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from NotificationApi

all_index!, available_options, earliest, earliest!, #earliest_order, #earliest_order!, #email_subscribed?, filtered_by_key, filtered_by_options, filtered_by_target_type, filtered_by_type, generate_notification, #group_member?, #group_member_count, group_member_exists?, #group_member_exists?, #group_member_notifier_count, #group_member_notifier_exists?, #group_notification_count, #group_notifier_count, latest, latest!, #latest_group_member, #latest_order, #latest_order!, #notifiable_path, notify, notify_all, notify_all_later, notify_later, notify_later_to, notify_to, #open!, open_all_of, #opened?, opened_index, #optional_target_names, #optional_target_subscribed?, #optional_targets, #prepare_to_store, #printable_notifiable_name, #publish_to_optional_targets, #remove_from_group, send_batch_notification_email, #send_notification_email, set_notification_mailer, #subscribed?, uniq_keys, #unopened?, unopened_index, valid_group_owner

Methods included from Association

belongs_to_composite_xdb_record, belongs_to_polymorphic_xdb_record, filtered_by_association, has_many_composite_xdb_records, has_many_polymorphic_xdb_records, has_many_records, #update

Methods included from Renderable

#layout_path, #partial_path, #prepare_assigns, #prepare_locals, #prepare_parameters, #render, #text

Methods included from Common

#printable_name, #printable_type, #resolve_value, #to_class_name, #to_resource_name, #to_resources_name

Methods included from DynamoidExtension

#becomes, delete_all

Class Method Details

.raise_delete_restriction_error(error_text) ⇒ void

This method returns an undefined value.

Raise ActivityNotification::DeleteRestrictionError for notifications.

Parameters:

  • error_text (String)

    Error text for raised exception

Raises:



121
122
123
# File 'lib/activity_notification/orm/dynamoid/notification.rb', line 121

def self.raise_delete_restriction_error(error_text)
  raise ActivityNotification::DeleteRestrictionError, error_text
end

Instance Method Details

#groupObject

Belongs to group instance of this notification as polymorphic association using composite key.

Returns:

  • (Object)

    Group instance of this notification



33
# File 'lib/activity_notification/orm/dynamoid/notification.rb', line 33

belongs_to_composite_xdb_record :group

#group_membersDynamoid::Criteria::Chain

Has many group member notification instances of this notification. Only group owner instance has :group_members value. Group member instance has nil as :group_members association. has_many :group_members, class_name: “ActivityNotification::Notification”, foreign_key: :group_owner_id

Returns:

  • (Dynamoid::Criteria::Chain)

    Database query of the group member notification instances of this notification



60
61
62
# File 'lib/activity_notification/orm/dynamoid/notification.rb', line 60

def group_members
  Notification.where(group_owner_id: id)
end

#group_ownerNotification

Customized method that belongs to group owner notification instance of this notification.

Returns:

  • (Notification)

    Group owner notification instance of this notification

Raises:

  • (Errors::RecordNotFound)

    Record not found error



45
# File 'lib/activity_notification/orm/dynamoid/notification.rb', line 45

belongs_to :group_owner, { class_name: "ActivityNotification::Notification", foreign_key: :group_owner_id }.merge(Rails::VERSION::MAJOR >= 5 ? { optional: true } : {})

#group_owner?Boolean

Returns if the notification is group owner. Calls NotificationApi#group_owner? as super method.

Returns:

  • (Boolean)

    If the notification is group owner



113
114
115
# File 'lib/activity_notification/orm/dynamoid/notification.rb', line 113

def group_owner?
  super
end

#notifiableObject

Belongs to notifiable instance of this notification as polymorphic association using composite key.

Returns:

  • (Object)

    Notifiable instance of this notification



28
# File 'lib/activity_notification/orm/dynamoid/notification.rb', line 28

belongs_to_composite_xdb_record :notifiable, store_with_associated_records: true

#notifierObject

Belongs to :otifier instance of this notification.

Returns:

  • (Object)

    Notifier instance of this notification



67
# File 'lib/activity_notification/orm/dynamoid/notification.rb', line 67

belongs_to_composite_xdb_record :notifier, store_with_associated_records: true

#targetObject

Belongs to target instance of this notification as polymorphic association using composite key.

Returns:

  • (Object)

    Target instance of this notification



23
# File 'lib/activity_notification/orm/dynamoid/notification.rb', line 23

belongs_to_composite_xdb_record :target, store_with_associated_records: true