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

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

Instance Method Summary collapse

Instance Method Details

#appchat_create(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 appchat_create 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

#appchat_get(chat_id) ⇒ Object



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

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

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



16
17
18
19
# File 'lib/wework/api/methods/appchat.rb', line 16

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

#file_appchat_send(chat_id, media_id) ⇒ Object



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

def file_appchat_send chat_id, media_id
  appchat_send chat_id, {file: {media_id: media_id}, msgtype: 'file'}
end

#image_appchat_send(chat_id, media_id) ⇒ Object



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

def image_appchat_send chat_id, media_id
  appchat_send chat_id, {image: {media_id: media_id}, msgtype: 'image'}
end

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



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

def news_appchat_send chat_id, news=[]
  appchat_send chat_id, {news: {articles: news}, msgtype: 'news'}
end

#text_appchat_send(chat_id, content) ⇒ Object



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

def text_appchat_send chat_id, content
  appchat_send chat_id, {text: {content: content}, msgtype: 'text'}
end

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



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

def textcard_appchat_send chat_id, textcard={}
  appchat_send chat_id, {textcard: textcard, msgtype: 'textcard'}
end

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



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

def video_appchat_send chat_id, video={}
  appchat_send chat_id, {video: video, msgtype: 'video'}
end

#voice_appchat_send(chat_id, media_id) ⇒ Object



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

def voice_appchat_send chat_id, media_id
  appchat_send chat_id, {voice: {media_id: media_id}, msgtype: 'voice'}
end