11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/fastlane/plugin/work_wechat/actions/work_wechat_action.rb', line 11
def self.run(params)
UI.message("The work_wechat plugin is working!")
webhook = params[:webhook_URL]
puts "webhook = #{webhook}"
url = URI(webhook)
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true if url.scheme == 'https'
= { 'Content-Type' => 'application/json' }
request = Net::HTTP::Post.new(url, )
if params[:markdown_content]
request.body = markdown_http_body(params)
elsif params[:image_base64]
request.body = image_http_body(params)
elsif params[:news_title]
request.body = news_http_body(params)
elsif params[:text_content]
request.body = text_http_body(params)
end
puts http.request(request).body
end
|