Class: ReamazeAPI::Message
- Defined in:
- lib/reamaze_api/message.rb
Instance Method Summary collapse
-
#all(params = {}) ⇒ Object
Public: Retrieves messages.
-
#create(params) ⇒ Object
Public: Create a new message under the given conversation.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from ReamazeAPI::Resource
Instance Method Details
#all(params = {}) ⇒ Object
Public: Retrieves messages.
params - Hash of parameters (those not listed below are passed directly
to the API):
:conversation_slug - Optional conversation slug
API Routes
GET /messages
GET /conversations/{slug}/messages
See also: www.reamaze.com/api/get_messages
Returns a Hash.
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
Public: Create a new message under the given conversation.
params - Hash of parameters (those not listed below are passed directly
to the API):
:conversation_slug - Required conversation slug
API Routes
POST /conversations/{slug}/messages
See also: www.reamaze.com/api/post_messages
Returns a Hash.
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 |