Class: ReamazeAPI::Message
- Defined in:
- lib/reamaze_api/message.rb
Instance Method Summary collapse
-
#all(params = {}) ⇒ Object
Retrieves messages.
-
#create(params) ⇒ Object
Create a new message under the given conversation.
-
#message_path(conversation_slug = nil) ⇒ Object
private
Private: Messages API path.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from ReamazeAPI::Resource
Instance Method Details
#all(params = {}) ⇒ Object
Retrieves messages.
17 18 19 20 21 22 |
# File 'lib/reamaze_api/message.rb', line 17 def all(params = {}) params = Utils.symbolize_hash(params) url = (params.delete(:conversation_slug)) paginate url, :messages, params end |
#create(params) ⇒ Object
Create a new message under the given conversation.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/reamaze_api/message.rb', line 37 def create(params) params = Utils.symbolize_hash(params) slug = params.fetch(:conversation_slug) params.delete :conversation_slug post (slug), params rescue KeyError => e Utils.error_hash(e) end |
#message_path(conversation_slug = nil) ⇒ Object (private)
Private: Messages API path. If a conversation slug is supplied the returned path is prefixed with “/conversations/#slug”.
56 57 58 59 60 61 62 |
# File 'lib/reamaze_api/message.rb', line 56 def (conversation_slug = nil) if conversation_slug "/conversations/#{conversation_slug}/messages" else "/messages" end end |