fastlane-plugin-pgyer_jvtd 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ea9f768aad9b4d17b12bfc4f3ad08a3819861effcb604295146089fbed4d6db
4
- data.tar.gz: afd9130c220a215cb1d253ab1d4944b488296c4bd33d7d9fc6ad9409db248300
3
+ metadata.gz: 6e391277612610b620b9aa65c369dd8b8c63e31485657ba6f143cb79286ec1c5
4
+ data.tar.gz: 17de902acee5e255f646a32d4c45922d227aca083a880bf087615074c98534e4
5
5
  SHA512:
6
- metadata.gz: ce6b46345d559987c48e4f4c3eb7470b152ab98348666aa313e76108b30459b956dab726aefd782bbd86b59d125e402cc4df34f5f579921e499b2a9fbb542fba
7
- data.tar.gz: c0e95012a15c349a876c461259dcfc10ba7db9e0c67d4ac3b7cd1a58a6b6a2cbdc03cc022f2afd1c85269df6de10d8a28d9601ab89768203383dcd7b41596af0
6
+ metadata.gz: db02089e67674cb4ce5b7227c3721ed2777397ab6c82910f8fddc875daabaed53215c1363d1459ed1e6cb854fa851899e54c3b60e45e89c000c2c38f5aab1eff
7
+ data.tar.gz: 88ad77f3f572181ecfba2ba13a63ea6b88b2a9326bc543fbbb165773a8b8403260c1ae03b5ebce88fe4180a58f4d60d98d6761422a5cbdbe00147c64e484eece
@@ -103,46 +103,60 @@ module Fastlane
103
103
  appUrl = "https://www.pgyer.com/#{info['data']['appShortcutUrl']}"
104
104
 
105
105
  unless access_token.nil?
106
- # 将应用信息发送到钉钉
107
- uri = URI.parse("https://oapi.dingtalk.com/robot/send?access_token=#{access_token}")
108
- https = Net::HTTP.new(uri.host, uri.port)
109
- https.use_ssl = true
110
- req = Net::HTTP::Post.new(uri.request_uri)
111
- req.body = {
112
- "msgtype"=> "link",
113
- "link"=> {
114
- "text"=> "#{appName}#{appType} App发布",
115
- "title"=> "请下载最新版本#{appVersion}(#{appBuildVersion})",
116
- "picUrl"=> appIcon,
117
- "messageUrl"=> appUrl}
118
- }.to_json
119
- req.content_type = 'application/json'
120
- resp = https.request(req)
121
- json = JSON.parse(resp.body)
106
+ uri = URI.parse("https://oapi.dingtalk.com/robot/send?access_token=#{access_token}")
122
107
 
123
- if json["errcode"] != 0
124
- UI.error('ding talk error message: ' + json["errmsg"])
125
- end
108
+ dingtalk_client = Faraday.new(nil, conn_options) do |c|
109
+ c.request :multipart
110
+ c.request :url_encoded
111
+ c.response :json, content_type: /\bjson$/
112
+ c.adapter :net_http
113
+ end
114
+
115
+ params = {
116
+ "msgtype"=> "link",
117
+ "link"=> {
118
+ "text"=> "#{appName}#{appType} App发布",
119
+ "title"=> "请下载最新版本#{appVersion}(#{appBuildVersion})",
120
+ "picUrl"=> appIcon,
121
+ "messageUrl"=> appUrl
122
+ }
123
+ }
124
+
125
+
126
+ response = dingtalk_client.post uri, params
127
+ info = response.body
128
+
129
+ if info['errcode'] != 0
130
+ UI.error('ding talk error message: ' + info["errmsg"])
131
+ end
126
132
 
127
- req1 = Net::HTTP::Post.new(uri.request_uri)
128
- req1.body = {
129
- "msgtype"=> "text",
130
- "text"=> {
131
- "content"=> "#{appName}#{appType} App最新版本已发布"
132
- },
133
- "at"=> {
134
- "atMobiles"=> [],
135
- "isAtAll"=> ia_at_all == "1"
136
- }
137
- }.to_json
138
- req1.content_type = 'application/json'
139
- resp1 = https.request(req1)
140
- json1 = JSON.parse(resp1.body)
141
-
142
- if json1["errcode"] != 0
143
- UI.error('ding talk error message: ' + json1["errmsg"])
144
- end
145
- UI.success("Successfully send qr code to ding talk!")
133
+ dingtalk2_client = Faraday.new(nil, conn_options) do |c|
134
+ c.request :multipart
135
+ c.request :url_encoded
136
+ c.response :json, content_type: /\bjson$/
137
+ c.adapter :net_http
138
+ end
139
+
140
+ params = {
141
+ "msgtype" => "text",
142
+ "text" => {
143
+ "content" => "#{appName}#{appType} App最新版本已发布"
144
+ },
145
+ "at"=> {
146
+ "atMobiles" => [],
147
+ "isAtAll" => ia_at_all == "1"
148
+ }
149
+ }
150
+
151
+
152
+ response = dingtalk2_client.post uri, params
153
+ info = response.body
154
+
155
+ if info['errcode'] != 0
156
+ UI.error('ding talk error message: ' + info["errmsg"])
157
+ end
158
+
159
+ UI.success("Successfully send qr code to ding talk!")
146
160
  else
147
161
  end
148
162
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module PgyerJvtd
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-pgyer_jvtd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - 陈磊的MacBook Pro