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.



9
10
11
12
13
14
# File 'lib/notifications/client/notifications_collection.rb', line 9

def initialize(response)
  @links = response["links"]
  @total = response["total"]
  @page_size = response["page_size"]
  @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

#page_sizeObject (readonly)

Returns the value of attribute page_size.



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

def page_size
  @page_size
end

#totalObject (readonly)

Returns the value of attribute total.



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

def total
  @total
end

Instance Method Details

#collection_from(notifications) ⇒ Object



16
17
18
19
20
# File 'lib/notifications/client/notifications_collection.rb', line 16

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