lita-stackstorm 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/handlers/stackstorm.rb +21 -5
- data/lita-stackstorm.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2c537c4b77350c83a6d27e3af7bf44ee8987331
|
4
|
+
data.tar.gz: d1f40cd5510c37b3b999dbb3d596bb587f90eced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 261f357ea263c5c9b8fa24b3cdcaf252bc38a023525bd65f14faad11b4711ba99fd016b456c12f2afe9d147fed8ef9827d74d2b7149e3d4d98ed655b23c6db3b
|
7
|
+
data.tar.gz: ab71084dc66552b5e2948431322dbb88f6c1c82887cec4ff8f239e8781c33c60ba88b27f53117ab9ae94274e51796f08a298ee6d62b7b9e46079ebef425636ba
|
@@ -25,8 +25,24 @@ module Lita
|
|
25
25
|
|
26
26
|
route /^!(.*)$/, :call_alias, command: false, help: {}
|
27
27
|
|
28
|
+
def auth_builder
|
29
|
+
if config.auth_port == 443 and config.url.start_with?('https')
|
30
|
+
"#{config.url}/auth"
|
31
|
+
else
|
32
|
+
"#{config.url}:#{config.auth_port}/v1"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def url_builder
|
37
|
+
if config.execution_port == 443 and config.url.start_with?('https')
|
38
|
+
"#{config.url}/api"
|
39
|
+
else
|
40
|
+
"#{config.url}:#{config.execution_port}/v1"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
28
44
|
def authenticate
|
29
|
-
resp = http.post("#{
|
45
|
+
resp = http.post("#{auth_builder()}/tokens") do |req|
|
30
46
|
req.body = {}
|
31
47
|
req.headers['Authorization'] = http.set_authorization_header(:basic_auth, config.username, config.password)
|
32
48
|
end
|
@@ -52,7 +68,7 @@ module Lita
|
|
52
68
|
source_channel: 'chatops',
|
53
69
|
notification_channel: 'lita'
|
54
70
|
}
|
55
|
-
s = make_post_request("
|
71
|
+
s = make_post_request("/aliasexecution", payload)
|
56
72
|
j = JSON.parse(s.body)
|
57
73
|
msg.reply "Got it! Details available at #{config.url}/#/history/#{j['execution']['id']}/general"
|
58
74
|
elsif l.length > 0
|
@@ -70,7 +86,7 @@ module Lita
|
|
70
86
|
if expired
|
71
87
|
authenticate
|
72
88
|
end
|
73
|
-
s = make_request("
|
89
|
+
s = make_request("/actionalias", "")
|
74
90
|
if JSON.parse(s.body).empty?
|
75
91
|
msg.reply "No Action Aliases Registered"
|
76
92
|
else
|
@@ -102,7 +118,7 @@ module Lita
|
|
102
118
|
end
|
103
119
|
|
104
120
|
def make_request(path, body)
|
105
|
-
resp = http.get("#{
|
121
|
+
resp = http.get("#{url_builder()}#{path}") do |req|
|
106
122
|
req.body = {}
|
107
123
|
req.headers = headers
|
108
124
|
req.body = body.to_json
|
@@ -111,7 +127,7 @@ module Lita
|
|
111
127
|
end
|
112
128
|
|
113
129
|
def make_post_request(path, body)
|
114
|
-
resp = http.post("#{
|
130
|
+
resp = http.post("#{url_builder()}#{path}") do |req|
|
115
131
|
req.body = {}
|
116
132
|
req.headers = headers
|
117
133
|
req.body = body.to_json
|
data/lita-stackstorm.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-stackstorm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jurnell Cockhren
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project:
|
179
|
-
rubygems_version: 2.4.5
|
179
|
+
rubygems_version: 2.4.5.1
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: Stackstorm handler for lita 4+
|