Class: Notifications::Client::NotificationsCollection
- Inherits:
-
Object
- Object
- Notifications::Client::NotificationsCollection
- Defined in:
- lib/notifications/client/notifications_collection.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#links ⇒ Object
readonly
Returns the value of attribute links.
Instance Method Summary collapse
- #collection_from(notifications) ⇒ Object
-
#initialize(response) ⇒ NotificationsCollection
constructor
A new instance of NotificationsCollection.
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
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
4 5 6 |
# File 'lib/notifications/client/notifications_collection.rb', line 4 def collection @collection end |
#links ⇒ Object (readonly)
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 |