Class: Loco::Notification::Fetcher
- Inherits:
-
Object
- Object
- Loco::Notification::Fetcher
- Defined in:
- app/services/loco/notification/fetcher.rb
Instance Attribute Summary collapse
-
#max_size ⇒ Object
Returns the value of attribute max_size.
Instance Method Summary collapse
- #formatted_notifications ⇒ Object
-
#initialize(synced_at:, permissions: [], recipient_token: nil, max_size: nil) ⇒ Fetcher
constructor
A new instance of Fetcher.
- #next_sync_time ⇒ Object
Constructor Details
#initialize(synced_at:, permissions: [], recipient_token: nil, max_size: nil) ⇒ Fetcher
Returns a new instance of Fetcher.
5 6 7 8 9 10 11 |
# File 'app/services/loco/notification/fetcher.rb', line 5 def initialize synced_at:, permissions: [], recipient_token: nil, max_size: nil @synced_at = synced_at @permissions = @recipient_token = recipient_token @notifications = nil @max_size = max_size || Loco::Config.notifications_size end |
Instance Attribute Details
#max_size ⇒ Object
Returns the value of attribute max_size.
3 4 5 |
# File 'app/services/loco/notification/fetcher.rb', line 3 def max_size @max_size end |
Instance Method Details
#formatted_notifications ⇒ Object
13 14 15 |
# File 'app/services/loco/notification/fetcher.rb', line 13 def formatted_notifications notifications.map(&:compact) end |
#next_sync_time ⇒ Object
17 18 19 |
# File 'app/services/loco/notification/fetcher.rb', line 17 def next_sync_time notifications.size == max_size ? notifications.last.created_at : Time.current end |