Class: Notisend::Collection

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/notisend/collection.rb

Overview

Class for wrapping collection response

Instance Method Summary collapse

Constructor Details

#initialize(response, item_class) ⇒ Collection


4
5
6
7
8
9
# File 'lib/notisend/collection.rb', line 4

def initialize(response, item_class)
  data = response.tap do |resp|
    resp['collection'] = resp['collection'].map { |attributes| item_class.new(attributes) }
  end
  super(data)
end