class CircuitApi::Resources::Message

Public Instance Methods

api_resource() click to toggle source
# File lib/circuit_api/resources/message.rb, line 4
def api_resource
  'conversations/:id/messages'
end
create(conversation_id, params) click to toggle source
# 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