lib/tickethub/collection.rb in tickethub-0.3.7 vs lib/tickethub/collection.rb in tickethub-0.3.9

- old
+ new

@@ -28,17 +28,17 @@ super() do |yielder| self.reload! if cache.nil? cache.each do |row| - yielder << @klass.load(endpoint, row) + yielder << @klass.call(endpoint, row) end while (offset + cache.length) < count response = endpoint.get params.merge(offset: cache.length) response.decoded.each do |row| cache << row - yielder << @klass.load(endpoint, row) + yielder << @klass.call(endpoint, row) end end end end @@ -141,18 +141,18 @@ self.offset(search.min).first(search.max) when Array self.filter(id: search) when String endpoint = self.endpoint[@klass.path, CGI::escape(search)] - @klass.load endpoint, endpoint.get(params) + @klass.call endpoint, endpoint.get(params) else raise ArgumentError, 'invalid search value type' end end def create(attributes = {}) - @klass.load endpoint, post(attributes) + @klass.call endpoint, post(attributes) rescue Tickethub::ResourceInvalid => err - @klass.load endpoint, Tickethub::Response.new(err.response).decoded + @klass.call endpoint, Tickethub::Response.new(err.response).decoded end end end \ No newline at end of file