@@ -66,6 +66,10 @@ def blob_endpoint
6666 end
6767 end
6868
69+ def liff_endpoint
70+ @liff_endpoint ||= API ::DEFAULT_LIFF_ENDPOINT
71+ end
72+
6973 # @return [Hash]
7074 def credentials
7175 {
@@ -163,15 +167,16 @@ def get_channel_access_token_key_ids_21(jwt)
163167 #
164168 # @param user_id [String] User Id
165169 # @param messages [Hash or Array] Message Objects
170+ # @param headers [Hash] HTTP Headers
166171 # @return [Net::HTTPResponse]
167- def push_message ( user_id , messages )
172+ def push_message ( user_id , messages , headers : { } )
168173 channel_token_required
169174
170175 messages = [ messages ] if messages . is_a? ( Hash )
171176
172177 endpoint_path = '/bot/message/push'
173178 payload = { to : user_id , messages : messages } . to_json
174- post ( endpoint , endpoint_path , payload , credentials )
179+ post ( endpoint , endpoint_path , payload , credentials . merge ( headers ) )
175180 end
176181
177182 # Reply messages to a user using replyToken.
@@ -208,30 +213,33 @@ def reply_message(token, messages)
208213 #
209214 # @param to [Array or String] Array of userIds
210215 # @param messages [Hash or Array] Message Objects
216+ # @param headers [Hash] HTTP Headers
211217 # @return [Net::HTTPResponse]
212- def multicast ( to , messages )
218+ def multicast ( to , messages , headers : { } )
213219 channel_token_required
214220
215221 to = [ to ] if to . is_a? ( String )
216222 messages = [ messages ] if messages . is_a? ( Hash )
217223
218224 endpoint_path = '/bot/message/multicast'
219225 payload = { to : to , messages : messages } . to_json
220- post ( endpoint , endpoint_path , payload , credentials )
226+ post ( endpoint , endpoint_path , payload , credentials . merge ( headers ) )
221227 end
222228
223229 # Send messages to all friends.
224230 #
225231 # @param messages [Hash or Array] Message Objects
232+ # @param headers [Hash] HTTP Headers
233+ #
226234 # @return [Net::HTTPResponse]
227- def broadcast ( messages )
235+ def broadcast ( messages , headers : { } )
228236 channel_token_required
229237
230238 messages = [ messages ] if messages . is_a? ( Hash )
231239
232240 endpoint_path = '/bot/message/broadcast'
233241 payload = { messages : messages } . to_json
234- post ( endpoint , endpoint_path , payload , credentials )
242+ post ( endpoint , endpoint_path , payload , credentials . merge ( headers ) )
235243 end
236244
237245 # Narrowcast messages to users
@@ -243,9 +251,10 @@ def broadcast(messages)
243251 # @param recipient [Hash]
244252 # @param filter [Hash]
245253 # @param limit [Hash]
254+ # @param headers [Hash] HTTP Headers
246255 #
247256 # @return [Net::HTTPResponse]
248- def narrowcast ( messages , recipient : nil , filter : nil , limit : nil )
257+ def narrowcast ( messages , recipient : nil , filter : nil , limit : nil , headers : { } )
249258 channel_token_required
250259
251260 messages = [ messages ] if messages . is_a? ( Hash )
@@ -257,7 +266,7 @@ def narrowcast(messages, recipient: nil, filter: nil, limit: nil)
257266 filter : filter ,
258267 limit : limit
259268 } . to_json
260- post ( endpoint , endpoint_path , payload , credentials )
269+ post ( endpoint , endpoint_path , payload , credentials . merge ( headers ) )
261270 end
262271
263272 def leave_group ( group_id )
@@ -352,6 +361,42 @@ def get_room_member_ids(room_id, continuation_token = nil)
352361 get ( endpoint , endpoint_path , credentials )
353362 end
354363
364+ # Gets the group ID, group name, and group icon URL of a group where the LINE Official Account is a member.
365+ #
366+ # @param group_id [String] Group's identifier
367+ #
368+ # @return [Net::HTTPResponse]
369+ def get_group_summary ( group_id )
370+ channel_token_required
371+
372+ endpoint_path = "/bot/group/#{ group_id } /summary"
373+ get ( endpoint , endpoint_path , credentials )
374+ end
375+
376+ # Gets the user IDs of the members of a group that the bot is in.
377+ #
378+ # @param group_id [String] Group's identifier
379+ #
380+ # @return [Net::HTTPResponse]
381+ def get_group_members_count ( group_id )
382+ channel_token_required
383+
384+ endpoint_path = "/bot/group/#{ group_id } /members/count"
385+ get ( endpoint , endpoint_path , credentials )
386+ end
387+
388+ # Gets the count of members in a room.
389+ #
390+ # @param room_id [String] Room's identifier
391+ #
392+ # @return [Net::HTTPResponse]
393+ def get_room_members_count ( room_id )
394+ channel_token_required
395+
396+ endpoint_path = "/bot/room/#{ room_id } /members/count"
397+ get ( endpoint , endpoint_path , credentials )
398+ end
399+
355400 # Get a list of all uploaded rich menus
356401 #
357402 # @return [Net::HTTPResponse]
@@ -647,6 +692,44 @@ def get_friend_demographics
647692 get ( endpoint , endpoint_path , credentials )
648693 end
649694
695+ # Gets a bot's basic information.
696+ #
697+ # @return [Net::HTTPResponse]
698+ def get_bot_info
699+ channel_token_required
700+
701+ endpoint_path = '/bot/info'
702+ get ( endpoint , endpoint_path , credentials )
703+ end
704+
705+ def get_liff_apps
706+ channel_token_required
707+
708+ endpoint_path = '/apps'
709+ get ( liff_endpoint , endpoint_path , credentials )
710+ end
711+
712+ def create_liff_app ( app )
713+ channel_token_required
714+
715+ endpoint_path = '/apps'
716+ post ( liff_endpoint , endpoint_path , app . to_json , credentials )
717+ end
718+
719+ def update_liff_app ( liff_id , app )
720+ channel_token_required
721+
722+ endpoint_path = "/apps/#{ liff_id } "
723+ put ( liff_endpoint , endpoint_path , app . to_json , credentials )
724+ end
725+
726+ def delete_liff_app ( liff_id )
727+ channel_token_required
728+
729+ endpoint_path = "/apps/#{ liff_id } "
730+ delete ( liff_endpoint , endpoint_path , credentials )
731+ end
732+
650733 # Fetch data, get content of specified URL.
651734 #
652735 # @param endpoint_base [String]
@@ -672,6 +755,19 @@ def post(endpoint_base, endpoint_path, payload = nil, headers = {})
672755 httpclient . post ( endpoint_base + endpoint_path , payload , headers )
673756 end
674757
758+ # Put data, get content of specified URL.
759+ #
760+ # @param endpoint_base [String]
761+ # @param endpoint_path [String]
762+ # @param payload [String or NilClass]
763+ # @param headers [Hash]
764+ #
765+ # @return [Net::HTTPResponse]
766+ def put ( endpoint_base , endpoint_path , payload = nil , headers = { } )
767+ headers = API ::DEFAULT_HEADERS . merge ( headers )
768+ httpclient . put ( endpoint_base + endpoint_path , payload , headers )
769+ end
770+
675771 # Delete content of specified URL.
676772 #
677773 # @param endpoint_base [String]
0 commit comments