Sha256: fff82eeb3f893763342a5bf2a7ad198bfa4657ced5a12dbce45ddc7af2710294

Contents?: true

Size: 1.12 KB

Versions: 35

Compression:

Stored size: 1.12 KB

Contents

require 'databasedotcom/chatter/record'

module Databasedotcom
  module Chatter
    # A private message between two or more Users
    class Message < Record

      # Send a private message with the content _text_ to each user in the _recipients_ list.
      def self.send_message(client, recipients, text)
        url = "/services/data/v#{client.version}/chatter/users/me/messages"
        recipients = recipients.is_a?(Array) ? recipients : [recipients]
        response = client.http_post(url, nil, :text => text, :recipients => recipients.join(','))
        Message.new(client, response.body)
      end

      # Send a reply to the message identified by _in_reply_to_message_id_ with content _text_.
      def self.reply(client, in_reply_to_message_id, text)
        url = "/services/data/v#{client.version}/chatter/users/me/messages"
        response = client.http_post(url, nil, :text => text, :inReplyTo => in_reply_to_message_id)
        Message.new(client, response.body)
      end

      # Send a reply to this Message with content _text_.
      def reply(text)
        self.class.reply(self.client, self.id, text)
      end
    end
  end
end

Version data entries

35 entries across 35 versions & 5 rubygems

Version Path
databasedotcom-1.3.5 lib/databasedotcom/chatter/message.rb
databasedotcom-1.3.3 lib/databasedotcom/chatter/message.rb
glg-databasedotcom-1.3.2.1 lib/databasedotcom/chatter/message.rb
databasedotcom-1.3.2 lib/databasedotcom/chatter/message.rb
databasedotcom_emp-1.3.1 lib/databasedotcom/chatter/message.rb
databasedotcom_cloudfuji-1.3.1 lib/databasedotcom/chatter/message.rb
databasedotcom-1.3.1 lib/databasedotcom/chatter/message.rb
databasedotcom-ejholmes-1.3.5 lib/databasedotcom/chatter/message.rb
databasedotcom-ejholmes-1.3.4 lib/databasedotcom/chatter/message.rb
databasedotcom-ejholmes-1.3.3 lib/databasedotcom/chatter/message.rb
databasedotcom-ejholmes-1.3.2 lib/databasedotcom/chatter/message.rb
databasedotcom-1.3.0 lib/databasedotcom/chatter/message.rb
databasedotcom-1.2.7 lib/databasedotcom/chatter/message.rb
databasedotcom-1.2.6 lib/databasedotcom/chatter/message.rb
databasedotcom-1.2.5 lib/databasedotcom/chatter/message.rb
databasedotcom-1.2.4 lib/databasedotcom/chatter/message.rb
databasedotcom-1.2.3 lib/databasedotcom/chatter/message.rb
databasedotcom-1.2.2 lib/databasedotcom/chatter/message.rb
databasedotcom-1.2.1 lib/databasedotcom/chatter/message.rb
databasedotcom-1.2.0 lib/databasedotcom/chatter/message.rb