lib/discourse_api/api/posts.rb in discourse_api-1.1.0 vs lib/discourse_api/api/posts.rb in discourse_api-2.0.0

- old
+ new

@@ -1,25 +1,21 @@ # frozen_string_literal: true module DiscourseApi module API module Posts def create_post(args) - args = API.params(args) - .required(:topic_id, :raw) - .optional(:created_at, :api_username) + args = API.params(args).required(:topic_id, :raw).optional(:created_at, :api_username) post("/posts", args) end def create_post_action(args) - args = API.params(args) - .required(:id, :post_action_type_id) + args = API.params(args).required(:id, :post_action_type_id) post("/post_actions", args.to_h.merge(flag_topic: false)) end def get_post(id, args = {}) - args = API.params(args) - .optional(:version) + args = API.params(args).optional(:version) response = get("/posts/#{id}.json", args) response[:body] end def posts(args = {}) @@ -43,10 +39,11 @@ def destroy_post_action(post_id, post_action_type_id) delete("/post_actions/#{post_id}.json", post_action_type_id: post_action_type_id) end def post_action_users(post_id, post_action_type_id) - response = get("/post_action_users.json", id: post_id, post_action_type_id: post_action_type_id) + response = + get("/post_action_users.json", id: post_id, post_action_type_id: post_action_type_id) response[:body] end end end end