Class: Notifications::Client::NotificationsCollection

Inherits:
Object
  • Object
show all
Defined in:
lib/notifications/client/notifications_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ NotificationsCollection

Returns a new instance of NotificationsCollection.



7
8
9
10
# File 'lib/notifications/client/notifications_collection.rb', line 7

def initialize(response)
  @links = response["links"]
  @collection = collection_from(response["notifications"])
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



4
5
6
# File 'lib/notifications/client/notifications_collection.rb', line 4

def collection
  @collection
end

Returns the value of attribute links.



4
5
6
# File 'lib/notifications/client/notifications_collection.rb', line 4

def links
  @links
end

Instance Method Details

#collection_from(notifications) ⇒ Object



12
13
14
15
16
# File 'lib/notifications/client/notifications_collection.rb', line 12

def collection_from(notifications)
  notifications.map do |notification|
    Notification.new(notification)
  end
end