lib/discourse_api/api/topics.rb in discourse_api-0.38.0 vs lib/discourse_api/api/topics.rb in discourse_api-0.39.0

- old
+ new

@@ -44,11 +44,11 @@ def change_topic_status(topic_slug, topic_id, params = {}) params = API.params(params) .required(:status, :enabled) .optional(:api_username) - put("/t/#{topic_slug}/#{topic_id}/status", params.to_h) + put("/t/#{topic_id}/status", params.to_h) end def topic(id, params = {}) response = get("/t/#{id}.json", params) response[:body] @@ -62,17 +62,15 @@ def delete_topic(id) delete("/t/#{id}.json") end def topic_posts(topic_id, post_ids = []) - url = "/t/#{topic_id}/posts.json" + url = ["/t/#{topic_id}/posts.json"] if post_ids.count > 0 - url << '?' - post_ids.each do |id| - url << "post_ids[]=#{id}&" - end + url.push('?') + url.push(post_ids.map { |id| "post_ids[]=#{id}" }.join('&')) end - response = get(url) + response = get(url.join) response[:body] end end end end