class Rongcloud::Service::Message

Attributes

from_user_id[RW]
object_name[RW]
push_content[RW]
push_data[RW]
to_user_id[RW]

Public Instance Methods

history(date_str) click to toggle source

消息历史记录

# File lib/rongcloud/service/message.rb, line 37
def history(date_str)
  post = {uri: Rongcloud::Service::API_URI[:MSG_HISTORY],
          params: optional_params({date: date_str})
  }
  Rongcloud::Service.req_post(post)
end
private_publish(rc_msg) click to toggle source

发送单聊消息

# File lib/rongcloud/service/message.rb, line 11
def private_publish(rc_msg)
  post = {uri: Rongcloud::Service::API_URI[:MSG_PRV_PUBLISH],
          params: optional_params({fromUserId: self.from_user_id, toUserId: self.to_user_id,
                                   objectName: self.object_name,
                                   pushData: self.push_data,
                                   pushContent: self.push_content,
                                   content: rc_msg.json_content})
  }
  res = Rongcloud::Service.req_post(post)
  res[:code]==200
end
system_public(rc_msg) click to toggle source

发送系统消息

# File lib/rongcloud/service/message.rb, line 24
def system_public(rc_msg)
  post = {uri: Rongcloud::Service::API_URI[:MSG_SYSTEM_PUBLISH],
          params: optional_params({fromUserId: self.from_user_id, toUserId: self.to_user_id,
                                   objectName: self.object_name,
                                   pushData: self.push_data,
                                   pushContent: self.push_content,
                                   content: rc_msg.json_content})
  }
  res = Rongcloud::Service.req_post(post)
  res[:code]==200
end