Class: Notifications::Client::TemplateCollection

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ TemplateCollection

Returns a new instance of TemplateCollection.



5
6
7
# File 'lib/notifications/client/template_collection.rb', line 5

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

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



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

def collection
  @collection
end

Instance Method Details

#collection_from(templates) ⇒ Object



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

def collection_from(templates)
  templates.map do |template|
    Template.new(template)
  end
end