module Easemob::Messages
Public Instance Methods
audio_to(target, target_type: :users, url:, filename:, length:, secret: nil, from: nil, ext: nil)
click to toggle source
# File lib/easemob/messages.rb, line 24 def audio_to(target, target_type: :users, url:, filename:, length:, secret: nil, from: nil, ext: nil) jd = { target_type: target_type, target: [*target], msg: { type: :audio, url: url, filename: filename, length: length } } jd[:msg][:secret] = secret unless secret.nil? jd[:from] = from unless from.nil? jd[:ext] = ext unless ext.nil? ChatMessage.new request :post, 'messages', json: jd end
command_to(target, target_type: :users, action:, from: nil, ext: nil)
click to toggle source
# File lib/easemob/messages.rb, line 46 def command_to(target, target_type: :users, action:, from: nil, ext: nil) jd = { target_type: target_type, target: [*target], msg: { type: :cmd, action: action } } jd[:from] = from unless from.nil? jd[:ext] = ext unless ext.nil? ChatMessage.new request :post, 'messages', json: jd end
image_to(target, target_type: :users, url:, filename:, secret: nil, from: nil, image_size: nil, ext: nil)
click to toggle source
# File lib/easemob/messages.rb, line 13 def image_to(target, target_type: :users, url:, filename:, secret: nil, from: nil, image_size: nil, ext: nil) jd = { target_type: target_type, target: [*target], msg: { type: :img, filename: filename, url: url } } jd[:msg][:secret] = secret unless secret.nil? jd[:from] = from unless from.nil? jd[:size] = image_size unless image_size.nil? jd[:ext] = ext unless ext.nil? ChatMessage.new request :post, 'messages', json: jd end
message_to(target, target_type: :users, text:, from: nil, ext: nil)
click to toggle source
# File lib/easemob/messages.rb, line 4 def message_to(target, target_type: :users, text:, from: nil, ext: nil) jd = { target_type: target_type, target: [*target], msg: { type: :txt, msg: text } } jd[:from] = from unless from.nil? jd[:ext] = ext unless ext.nil? ChatMessage.new request :post, 'messages', json: jd end
video_to(target, target_type: :users, url:, filename:, length:, file_length:, thumb:, secret: nil, thumb_secret: nil, from: nil, ext: nil)
click to toggle source
# File lib/easemob/messages.rb, line 34 def video_to(target, target_type: :users, url:, filename:, length:, file_length:, thumb:, secret: nil, thumb_secret: nil, from: nil, ext: nil) jd = { target_type: target_type, target: [*target], msg: { type: :video, filename: filename, thumb: thumb, length: length, file_length: file_length, url: url } } jd[:msg][:secret] = secret unless secret.nil? jd[:msg][:thumb_secret] = thumb_secret unless thumb_secret.nil? jd[:from] = from unless from.nil? jd[:ext] = ext unless ext.nil? ChatMessage.new request :post, 'messages', json: jd end