Sha256: 40549ac0a2a31e7cff92f673730ffccecc04be528d20039f75798cc0ca4a936e

Contents?: true

Size: 909 Bytes

Versions: 7

Compression:

Stored size: 909 Bytes

Contents

require 'intercom/service/base_service'
require 'intercom/api_operations/find_all'
require 'intercom/api_operations/find'
require 'intercom/api_operations/load'
require 'intercom/api_operations/save'

module Intercom
  module Service
    class Conversation < BaseService
      include ApiOperations::FindAll
      include ApiOperations::Find
      include ApiOperations::Load
      include ApiOperations::Save

      def collection_class
        Intercom::Conversation
      end

      def mark_read(id)
        @client.put("/conversations/#{id}", read: true)
      end

      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
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
intercom-3.0.6 lib/intercom/service/conversation.rb
intercom-3.0.5 lib/intercom/service/conversation.rb
intercom-3.0.4 lib/intercom/service/conversation.rb
intercom-3.0.3 lib/intercom/service/conversation.rb
intercom-3.0.2 lib/intercom/service/conversation.rb
intercom-3.0.0 lib/intercom/service/conversation.rb
intercom-3.0.0b1 lib/intercom/service/conversation.rb