Module: Wework::Api::Methods::Appchat

Included in:
Agent
Defined in:
lib/wework/api/methods/appchat.rb

Instance Method Summary collapse

Instance Method Details

#create_group(group_name, owner_id, group_user_ids, chat_id) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/wework/api/methods/appchat.rb', line 8

def create_group group_name, owner_id, group_user_ids, chat_id
  post 'appchat/create',
    name: group_name,
    owner: owner_id,
    userlist: group_user_ids,
    chatid: chat_id
end

#get_group(chat_id) ⇒ Object



25
26
27
# File 'lib/wework/api/methods/appchat.rb', line 25

def get_group chat_id
  get 'appchat/get', { params: { chatid: chat_id } }
end

#group_file_message_send(chat_id, media_id) ⇒ Object



41
42
43
# File 'lib/wework/api/methods/appchat.rb', line 41

def group_file_message_send chat_id, media_id
  message_send chat_id, {file: {media_id: media_id}, msgtype: 'file'}
end

#group_image_message_send(chat_id, media_id) ⇒ Object



33
34
35
# File 'lib/wework/api/methods/appchat.rb', line 33

def group_image_message_send chat_id, media_id
  message_send chat_id, {image: {media_id: media_id}, msgtype: 'image'}
end

#group_news_message_send(chat_id, news = []) ⇒ Object



53
54
55
# File 'lib/wework/api/methods/appchat.rb', line 53

def group_news_message_send chat_id, news=[]
  message_send chat_id, {news: {articles: news}, msgtype: 'news'}
end

#group_text_message_send(chat_id, content) ⇒ Object



29
30
31
# File 'lib/wework/api/methods/appchat.rb', line 29

def group_text_message_send chat_id, content
  message_send chat_id, {text: {content: content}, msgtype: 'text'}
end

#group_textcard_message_send(chat_id, textcard = {}) ⇒ Object



49
50
51
# File 'lib/wework/api/methods/appchat.rb', line 49

def group_textcard_message_send chat_id, textcard={}
  message_send chat_id, {textcard: textcard, msgtype: 'textcard'}
end

#group_video_message_send(chat_id, video = {}) ⇒ Object



45
46
47
# File 'lib/wework/api/methods/appchat.rb', line 45

def group_video_message_send chat_id, video={}
  message_send chat_id, {video: video, msgtype: 'video'}
end

#group_voice_message_send(chat_id, media_id) ⇒ Object



37
38
39
# File 'lib/wework/api/methods/appchat.rb', line 37

def group_voice_message_send chat_id, media_id
  message_send chat_id, {voice: {media_id: media_id}, msgtype: 'voice'}
end

#update_group(chat_id, payload = {}) ⇒ Object

name: group_name owner: owner_id add_user_list: add_user_list del_user_list: del_user_list



20
21
22
23
# File 'lib/wework/api/methods/appchat.rb', line 20

def update_group chat_id, payload={}
  payload.merge! chatid: chat_id
  post 'appchat/update', payload
end