class Intercom::Service::Conversation

Public Instance Methods

assign(reply_data) click to toggle source
# File lib/intercom/service/conversation.rb, line 54
def assign(reply_data)
  assignee_id = reply_data.fetch(:assignee_id) { raise 'assignee_id is required' }
  reply reply_data.merge(message_type: 'assignment', assignee_id: assignee_id, type: 'admin')
end
close(reply_data) click to toggle source
# File lib/intercom/service/conversation.rb, line 45
def close(reply_data)
  reply reply_data.merge(message_type: 'close', type: 'admin')
end
collection_class() click to toggle source
# File lib/intercom/service/conversation.rb, line 20
def collection_class
  Intercom::Conversation
end
mark_read(id) click to toggle source
# File lib/intercom/service/conversation.rb, line 24
def mark_read(id)
  @client.put("/conversations/#{id}", read: true)
end
open(reply_data) click to toggle source
# File lib/intercom/service/conversation.rb, line 41
def open(reply_data)
  reply reply_data.merge(message_type: 'open', type: 'admin')
end
reply(reply_data) click to toggle source
# File lib/intercom/service/conversation.rb, line 28
def reply(reply_data)
  id = reply_data.delete(:id)
  collection_name = Utils.resource_class_to_collection_name(collection_class)
  response = @client.post("/#{collection_name}/#{id}/reply", reply_data.merge(conversation_id: id))
  collection_class.new.from_response(response)
end
reply_to_last(reply_data) click to toggle source
# File lib/intercom/service/conversation.rb, line 35
def reply_to_last(reply_data)
  collection_name = Utils.resource_class_to_collection_name(collection_class)
  response = @client.post("/#{collection_name}/last/reply", reply_data)
  collection_class.new.from_response(response)
end
run_assignment_rules(id) click to toggle source
# File lib/intercom/service/conversation.rb, line 59
def run_assignment_rules(id)
  collection_name = Utils.resource_class_to_collection_name(collection_class)
  response = @client.post("/#{collection_name}/#{id}/run_assignment_rules", {})
  collection_class.new.from_response(response)
end
snooze(reply_data) click to toggle source
# File lib/intercom/service/conversation.rb, line 49
def snooze(reply_data)
  reply_data.fetch(:snoozed_until) { raise 'snoozed_until field is required' }
  reply reply_data.merge(message_type: 'snoozed', type: 'admin')
end