Skip to content

Commit 56bedb7

Browse files
committed
ADD: appchat API
1 parent b6d5412 commit 56bedb7

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ values = JSON.parse data
152152

153153
[Wework::Api::Methods::Message](https://github.com/mycolorway/wework/blob/master/lib/wework/api/methods/message.rb)
154154

155+
[Wework::Api::Methods::Appchat](https://github.com/mycolorway/wework/blob/master/lib/wework/api/methods/appchat.rb)
156+
155157
[Wework::Api::Methods::Media](https://github.com/mycolorway/wework/blob/master/lib/wework/api/methods/media.rb)
156158

157159
[Wework::Api::Methods::Menu](https://github.com/mycolorway/wework/blob/master/lib/wework/api/methods/menu.rb)

lib/wework/api/methods/appchat.rb

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,58 +5,54 @@ module Api
55
module Methods
66
module Appchat
77

8-
def create_group group_name, owner_id, group_user_ids, chat_id
8+
def appchat_create group_name, owner_id, group_user_ids, chat_id
99
post 'appchat/create',
1010
name: group_name,
1111
owner: owner_id,
1212
userlist: group_user_ids,
1313
chatid: chat_id
1414
end
1515

16-
# name: group_name
17-
# owner: owner_id
18-
# add_user_list: add_user_list
19-
# del_user_list: del_user_list
20-
def update_group chat_id, payload={}
16+
def appchat_update chat_id, payload={}
2117
payload.merge! chatid: chat_id
2218
post 'appchat/update', payload
2319
end
2420

25-
def get_group chat_id
21+
def appchat_get chat_id
2622
get 'appchat/get', { params: { chatid: chat_id } }
2723
end
2824

29-
def group_text_message_send chat_id, content
30-
message_send chat_id, {text: {content: content}, msgtype: 'text'}
25+
def text_appchat_send chat_id, content
26+
appchat_send chat_id, {text: {content: content}, msgtype: 'text'}
3127
end
3228

33-
def group_image_message_send chat_id, media_id
34-
message_send chat_id, {image: {media_id: media_id}, msgtype: 'image'}
29+
def image_appchat_send chat_id, media_id
30+
appchat_send chat_id, {image: {media_id: media_id}, msgtype: 'image'}
3531
end
3632

37-
def group_voice_message_send chat_id, media_id
38-
message_send chat_id, {voice: {media_id: media_id}, msgtype: 'voice'}
33+
def voice_appchat_send chat_id, media_id
34+
appchat_send chat_id, {voice: {media_id: media_id}, msgtype: 'voice'}
3935
end
4036

41-
def group_file_message_send chat_id, media_id
42-
message_send chat_id, {file: {media_id: media_id}, msgtype: 'file'}
37+
def file_appchat_send chat_id, media_id
38+
appchat_send chat_id, {file: {media_id: media_id}, msgtype: 'file'}
4339
end
4440

45-
def group_video_message_send chat_id, video={}
46-
message_send chat_id, {video: video, msgtype: 'video'}
41+
def video_appchat_send chat_id, video={}
42+
appchat_send chat_id, {video: video, msgtype: 'video'}
4743
end
4844

49-
def group_textcard_message_send chat_id, textcard={}
50-
message_send chat_id, {textcard: textcard, msgtype: 'textcard'}
45+
def textcard_appchat_send chat_id, textcard={}
46+
appchat_send chat_id, {textcard: textcard, msgtype: 'textcard'}
5147
end
5248

53-
def group_news_message_send chat_id, news=[]
54-
message_send chat_id, {news: {articles: news}, msgtype: 'news'}
49+
def news_appchat_send chat_id, news=[]
50+
appchat_send chat_id, {news: {articles: news}, msgtype: 'news'}
5551
end
5652

5753
private
5854

59-
def message_send chat_id, payload={}
55+
def appchat_send chat_id, payload={}
6056
payload.merge!(chatid: chat_id)
6157
post 'appchat/send', payload
6258
end

lib/wework/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Wework
2-
VERSION = '1.2.2'.freeze
2+
VERSION = '1.2.3'.freeze
33
end

0 commit comments

Comments
 (0)