Module: DiscourseApi::API::PrivateMessages
- Included in:
- Client
- Defined in:
- lib/discourse_api/api/private_messages.rb
Instance Method Summary collapse
-
#create_private_message(args = {}) ⇒ Object
:target_usernames REQUIRED comma separated list of usernames :category OPTIONAL name of category, not ID :created_at OPTIONAL seconds since epoch.
- #private_messages(username, *args) ⇒ Object
- #sent_private_messages(username, *args) ⇒ Object
Instance Method Details
#create_private_message(args = {}) ⇒ Object
:target_usernames REQUIRED comma separated list of usernames :category OPTIONAL name of category, not ID :created_at OPTIONAL seconds since epoch.
9 10 11 12 13 14 15 |
# File 'lib/discourse_api/api/private_messages.rb', line 9 def (args = {}) args[:archetype] = 'private_message' args = API.params(args) .required(:title, :raw, :target_usernames, :archetype) .optional(:category, :created_at, :api_username) post("/posts", args.to_h) end |
#private_messages(username, *args) ⇒ Object
17 18 19 20 |
# File 'lib/discourse_api/api/private_messages.rb', line 17 def (username, *args) response = get("topics/private-messages/#{username}.json", args) response[:body]['topic_list']['topics'] end |
#sent_private_messages(username, *args) ⇒ Object
22 23 24 25 |
# File 'lib/discourse_api/api/private_messages.rb', line 22 def (username, *args) response = get("topics/private-messages-sent/#{username}.json", args) response[:body]['topic_list']['topics'] end |