Skip to content

Commit 3dec5fa

Browse files
committed
add post method code
1 parent ab4d85d commit 3dec5fa

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/line/bot/client.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,25 @@ def get(endpoint_path)
371371
request.get
372372
end
373373

374+
# Post data, get content of specified URL.
375+
#
376+
# @param endpoint_path [String]
377+
#
378+
# @return [Net::HTTPResponse]
379+
def post(endpoint_path, payload=nil)
380+
raise Line::Bot::API::InvalidCredentialsError, 'Invalidates credentials' unless credentials?
381+
382+
request = Request.new do |config|
383+
config.httpclient = httpclient
384+
config.endpoint = endpoint
385+
config.endpoint_path = endpoint_path
386+
config.credentials = credentials
387+
config.payload = payload if payload
388+
end
389+
390+
request.post
391+
end
392+
374393
# Delete content of specified URL.
375394
#
376395
# @param endpoint_path [String]

0 commit comments

Comments
 (0)