lib/zendesk_api/collection.rb in zendesk_api-3.0.2 vs lib/zendesk_api/collection.rb in zendesk_api-3.0.4

- old
+ new

@@ -223,11 +223,11 @@ def next if @options["page"] && !cbp_request? clear_cache @options["page"] = @options["page"].to_i + 1 elsif (@query = @next_page) - # Send _only_ url param "?after=token" to get the next page + # Send _only_ url param "?page[after]=token" to get the next page @options.page&.delete("before") fetch(true) else clear_cache @resources = [] @@ -241,11 +241,11 @@ def prev if !cbp_request? && @options["page"].to_i > 1 clear_cache @options["page"] -= 1 elsif (@query = @prev_page) - # Send _only_ url param "?before=token" to get the prev page + # Send _only_ url param "?page[before]=token" to get the prev page @options.page&.delete("after") fetch(true) else clear_cache @resources = [] @@ -463,10 +463,10 @@ # If you call client.tickets.foo - and foo is not an attribute nor an association, it ends up here, as a new collection def next_collection(name, *args, &block) opts = args.last.is_a?(Hash) ? args.last : {} opts.merge!(collection_path: [*@collection_path, name], page: nil) - # why page: nil ? + # Why `page: nil`? # when you do client.tickets.fetch followed by client.tickets.foos => the request to /tickets/foos will # have the options page set to whatever the last options were for the tickets collection self.class.new(@client, @resource_class, @options.merge(opts)) end