Class: CircuitApi::Resources::Message
- Defined in:
- lib/circuit_api/resources/message.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#all, #delete, #delete_all, #find, #initialize, #update
Constructor Details
This class inherits a constructor from CircuitApi::Resources::Base
Instance Method Details
#api_resource ⇒ Object
| 4 5 6 | # File 'lib/circuit_api/resources/message.rb', line 4 def api_resource 'conversations/:id/messages' end | 
#create(conversation_id, params) ⇒ Object
| 8 9 10 11 12 13 14 15 16 17 18 19 20 | # File 'lib/circuit_api/resources/message.rb', line 8 def create(conversation_id, params) path = api_resource.sub(':id', conversation_id) if CircuitApi::Utils::Object.present?(params[:item_id]) path = "#{path}/#{params.delete(:item_id)}" end result = connection(path, params).post response_to_object(result) rescue CircuitApi::BadRequest => e handle_validation_errors(e) end |