Module: RongCloud::Services::Message
- Included in:
- RongCloud::Service
- Defined in:
- lib/rong_cloud/services/message.rb,
lib/rong_cloud/services/message/message_channel.rb
Overview
Defined Under Namespace
Classes: MessageChannel
Instance Method Summary collapse
- #send_broadcast_message(from_user_id, object_name, content, options = {}) ⇒ Object
- #send_chatroom_broadcast_message(from_user_id, object_name, content, options = {}) ⇒ Object
- #send_chatroom_message(from_user_id, to_chatroom_id, object_name, content, options = {}) ⇒ Object
- #send_discussion_message(from_user_id, to_discussion_id, object_name, content, options = {}) ⇒ Object
- #send_group_message(from_user_id, to_group_id, object_name, content, options = {}) ⇒ Object
-
#send_message(from_user_id, target_id, channel_name, object_name, content, *args) ⇒ Object
General method to send messages.
- #send_private_message(from_user_id, to_user_id, object_name, content, options = {}) ⇒ Object
- #send_private_template_message(from_user_id, to_user_id, object_name, content, values, options = {}) ⇒ Object
- #send_system_message(from_user_id, to_user_id, object_name, content, options = {}) ⇒ Object
- #send_system_template_message(from_user_id, to_user_id, object_name, content, values, options = {}) ⇒ Object
Instance Method Details
#send_broadcast_message(from_user_id, object_name, content, options = {}) ⇒ Object
81 82 83 |
# File 'lib/rong_cloud/services/message.rb', line 81 def (from_user_id, object_name, content, = {}) (from_user_id, nil, :broadcast, object_name, content, ) end |
#send_chatroom_broadcast_message(from_user_id, object_name, content, options = {}) ⇒ Object
77 78 79 |
# File 'lib/rong_cloud/services/message.rb', line 77 def (from_user_id, object_name, content, = {}) (from_user_id, nil, :chatroom_broadcast, object_name, content, ) end |
#send_chatroom_message(from_user_id, to_chatroom_id, object_name, content, options = {}) ⇒ Object
73 74 75 |
# File 'lib/rong_cloud/services/message.rb', line 73 def (from_user_id, to_chatroom_id, object_name, content, = {}) (from_user_id, to_chatroom_id, :chatroom, object_name, content, ) end |
#send_discussion_message(from_user_id, to_discussion_id, object_name, content, options = {}) ⇒ Object
69 70 71 |
# File 'lib/rong_cloud/services/message.rb', line 69 def (from_user_id, to_discussion_id, object_name, content, = {}) (from_user_id, to_discussion_id, :discussion, object_name, content, ) end |
#send_group_message(from_user_id, to_group_id, object_name, content, options = {}) ⇒ Object
65 66 67 |
# File 'lib/rong_cloud/services/message.rb', line 65 def (from_user_id, to_group_id, object_name, content, = {}) (from_user_id, to_group_id, :group, object_name, content, ) end |
#send_message(from_user_id, target_id, channel_name, object_name, content, *args) ⇒ Object
General method to send messages
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rong_cloud/services/message.rb', line 28 def (from_user_id, target_id, channel_name, object_name, content, *args) = args. values = args.first content_type = values.nil? ? :form_data : :json = MessageChannel.new(channel_name) params = { fromUserId: from_user_id, objectName: object_name, content: content.to_json } if .target_param_name params.merge!(.target_param_name => target_id) end if values if [:pushContent].nil? raise RongCloud::MissingOptionError, "pushContent is required for template messages" end params.merge!(values: values) end params.merge!() request(.api_path, params, content_type) end |
#send_private_message(from_user_id, to_user_id, object_name, content, options = {}) ⇒ Object
49 50 51 |
# File 'lib/rong_cloud/services/message.rb', line 49 def (from_user_id, to_user_id, object_name, content, = {}) (from_user_id, to_user_id, :private, object_name, content, ) end |
#send_private_template_message(from_user_id, to_user_id, object_name, content, values, options = {}) ⇒ Object
53 54 55 |
# File 'lib/rong_cloud/services/message.rb', line 53 def (from_user_id, to_user_id, object_name, content, values, = {}) (from_user_id, to_user_id, :private_template, object_name, content, values, ) end |
#send_system_message(from_user_id, to_user_id, object_name, content, options = {}) ⇒ Object
57 58 59 |
# File 'lib/rong_cloud/services/message.rb', line 57 def (from_user_id, to_user_id, object_name, content, = {}) (from_user_id, to_user_id, :system, object_name, content, ) end |
#send_system_template_message(from_user_id, to_user_id, object_name, content, values, options = {}) ⇒ Object
61 62 63 |
# File 'lib/rong_cloud/services/message.rb', line 61 def (from_user_id, to_user_id, object_name, content, values, = {}) (from_user_id, to_user_id, :system_template, object_name, content, values, ) end |