Module: Shikimori::API::V1::Messages
- Included in:
- Shikimori::API::V1
- Defined in:
- lib/shikimori/api/v1/messages.rb
Overview
Methods for the Messages API
Instance Method Summary collapse
-
#create_message(message, frontend: nil, headers: nil, **query) ⇒ Hash
Create a message Requires ‘messages` oauth scope.
-
#delete_all_messages(type:, frontend: nil, headers: nil, **query) ⇒ Hash
Delete all messages by type Requires ‘messages` oauth scope.
-
#delete_message(id, headers: nil, **query) ⇒ Boolean
Delete message.
-
#message(id, headers: nil, **query) ⇒ Hash
Get a message by id.
-
#read_all_messages(type:, frontend: nil, headers: nil, **query) ⇒ Hash
Mark all messages as read by type Requires ‘messages` oauth scope.
-
#update_message(id, message, headers: nil, **query) ⇒ Hash
Update message.
Instance Method Details
#create_message(message, frontend: nil, headers: nil, **query) ⇒ Hash
Create a message Requires ‘messages` oauth scope
53 54 55 56 57 58 59 |
# File 'lib/shikimori/api/v1/messages.rb', line 53 def (, frontend: nil, headers: nil, **query) rest.post( base_url.join('messages').url, { message: , frontend: frontend }.compact, headers: headers, query: query ) end |
#delete_all_messages(type:, frontend: nil, headers: nil, **query) ⇒ Hash
Delete all messages by type Requires ‘messages` oauth scope
156 157 158 159 160 161 162 163 164 |
# File 'lib/shikimori/api/v1/messages.rb', line 156 def (type:, frontend: nil, headers: nil, **query) rest.post( base_url.join('messages', 'delete_all').url, { type: type, frontend: frontend }.compact, headers: headers, query: query ) true end |
#delete_message(id, headers: nil, **query) ⇒ Boolean
Delete message. Requires ‘messages` oauth scope
106 107 108 |
# File 'lib/shikimori/api/v1/messages.rb', line 106 def (id, headers: nil, **query) rest.delete base_url.join('messages', id.to_s).url, headers: headers, query: query end |
#message(id, headers: nil, **query) ⇒ Hash
Get a message by id.
Requires ‘messages` oauth scope
27 28 29 |
# File 'lib/shikimori/api/v1/messages.rb', line 27 def (id, headers: nil, **query) rest.get base_url.join('messages', id.to_s).url, headers: headers, query: query end |
#read_all_messages(type:, frontend: nil, headers: nil, **query) ⇒ Hash
Mark all messages as read by type Requires ‘messages` oauth scope
128 129 130 131 132 133 134 135 136 |
# File 'lib/shikimori/api/v1/messages.rb', line 128 def (type:, frontend: nil, headers: nil, **query) rest.post( base_url.join('messages', 'read_all').url, { type: type, frontend: frontend }.compact, headers: headers, query: query ) true end |
#update_message(id, message, headers: nil, **query) ⇒ Hash
Update message. Requires ‘messages` oauth scope
81 82 83 84 85 86 87 |
# File 'lib/shikimori/api/v1/messages.rb', line 81 def (id, , headers: nil, **query) rest.put( base_url.join('messages', id.to_s).url, { message: , frontend: query.delete(:frontend) }.compact, headers: headers, query: query ) end |