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.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/loco/notification/fetcher.rb', line 8 def initialize( synced_at:, permissions: [], recipient_token: nil, max_size: nil ) @synced_at = synced_at = @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.
6 7 8 |
# File 'app/services/loco/notification/fetcher.rb', line 6 def max_size @max_size end |
Instance Method Details
#formatted_notifications ⇒ Object
21 22 23 |
# File 'app/services/loco/notification/fetcher.rb', line 21 def formatted_notifications notifications.map(&:compact) end |
#next_sync_time ⇒ Object
25 26 27 28 29 30 31 |
# File 'app/services/loco/notification/fetcher.rb', line 25 def next_sync_time if notifications.size == max_size notifications.last.created_at else Time.current end end |