lib/conekta/operations/where.rb in conekta-1.0.0 vs lib/conekta/operations/where.rb in conekta-1.1.0

- old
+ new

@@ -1,13 +1,22 @@ module Conekta module Operations module Where + + def self.handle_type_of_paging(response, class_name, params) + if response.kind_of?(Hash) && response["object"] == "list" + List.new(class_name, params) + else + ConektaObject.new + end + end + module ClassMethods def where(params=nil) - instance = ConektaObject.new _url = Util.types[self.class_name.downcase]._url response = Requestor.new.request(:get, _url, params) + instance = ::Conekta::Operations::Where.handle_type_of_paging(response, self.class_name, params) instance.load_from(response) instance end # <b>DEPRECATED:</b> Please use <tt>where</tt> instead. @@ -16,6 +25,6 @@ def self.included(base) base.extend(ClassMethods) end end end -end +end \ No newline at end of file