lib/eucalyptus/response.rb in eucalyptus-0.2.13 vs lib/eucalyptus/response.rb in eucalyptus-0.3.0
- old
+ new
@@ -11,6 +11,30 @@
new_ostruct_member(k)
end
end
end
+
+ class ResponseCollection
+ def initialize(klass, koala_response)
+ @koala_response = koala_response
+ @klass = klass
+ @array = elements(@koala_response)
+ end
+
+
+ def next_page
+ next_page = @koala_response.next_page
+ self.class.new(@klass, next_page)
+ end
+
+ # for array methods
+ def method_missing(method_sym, *args, &block)
+ @array.send(method_sym)
+ end
+
+ private
+ def elements(response)
+ response.collect{ |res| @klass.new(res) }
+ end
+ end
end