ZReviewTender 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc1e614d966b0f41f5b5032eb6f223479688d87b93ae38ad31ac88a3e913cb2d
4
- data.tar.gz: f29b845cffc50b86d69d38353385dda2e1aecde20ad947ea19f469bcff951772
3
+ metadata.gz: efd264d3712595b3055699ded3b674352f0ec587ae69905af583397e64712661
4
+ data.tar.gz: 257ed3ced4b87bd043f879b16e21d55e0be1447e18be139725a080b9df25cf86
5
5
  SHA512:
6
- metadata.gz: fed9e078491c756e1461ae4c5592f3ff0b07b3037b12dea35488e5ea63f241321ae81b404acd49156cf8240edffa177ebc5bc89ce681cf75b6e3d14a4d27cd9a
7
- data.tar.gz: 8819c1f9a5dab412bf6e676eeea9c493b4d2f4e8442d9b7fe99777973955d6c178f7cfc33c7991d56b9574566d926bcac95169f80faa08d4c9c51a7d0bfddd6d
6
+ metadata.gz: b187b442517d24c7f4e4e509240907670bab76b15473c1744db5d82c3001e7a9cdde628d474b12f989d10ed062b74794b33d33a8ae9308430e6482f9d0ad20e7
7
+ data.tar.gz: a276fa52b6f373c9a1d10ed47eb30d76f174e03930da2839f3e43e55798bd5bd922d0cb879d03f0e962f6f24b9bccca2d468216a69940db1e690ba5a68e429ca
@@ -56,7 +56,7 @@ class SlackProcessor < Processor
56
56
  end
57
57
 
58
58
  result = request(payload)
59
- if result["ok"] != true
59
+ if !result
60
60
  Helper.logError(result)
61
61
  end
62
62
  end
@@ -87,14 +87,18 @@ class SlackProcessor < Processor
87
87
 
88
88
  private
89
89
  def request(payload)
90
+
91
+ isInCommingWebHook = false
90
92
  if !botToken.nil? && botToken != ""
91
93
  uri = URI("https://slack.com/api/chat.postMessage")
92
94
  payload.channel = targetChannel
93
95
  headers = {'Content-Type': 'application/json; charset=utf-8', 'Authorization': "Bearer #{botToken}"}
96
+ isInCommingWebHook = false
94
97
  else
95
98
  uri = URI(inCommingWebHookURL)
96
99
  payload.channel = nil
97
100
  headers = {'Content-Type': 'application/json; charset=utf-8'}
101
+ isInCommingWebHook = true
98
102
  end
99
103
 
100
104
  http = Net::HTTP.new(uri.host, uri.port)
@@ -102,7 +106,14 @@ class SlackProcessor < Processor
102
106
  req = Net::HTTP::Post.new(uri.request_uri, headers)
103
107
  req.body = payload.to_json
104
108
  res = http.request(req)
105
- JSON.parse(res.body)
109
+
110
+ if isInCommingWebHook
111
+ return res.body == "ok"
112
+ else
113
+ result = JSON.parse(res.body)
114
+ return result["ok"] == true
115
+ end
116
+
106
117
  end
107
118
 
108
119
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ZReviewTender
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ZhgChgLi