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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 882ff1cc49a98751e6b5f2ea4d1801a1d661f0c8
4
- data.tar.gz: eff92cd9224145295760a9c3e204083e86d026fa
3
+ metadata.gz: d2c537c4b77350c83a6d27e3af7bf44ee8987331
4
+ data.tar.gz: d1f40cd5510c37b3b999dbb3d596bb587f90eced
5
5
  SHA512:
6
- metadata.gz: b4924a3d7bae2a3cf6090af4948f412172b2860b1d44e28034702066f310f9f5b15998153beae5cef9ff944d141b6a877ea5f046d07373bc3d2dc3aeae8db176
7
- data.tar.gz: f2eda6a8f04787578156d97853b52c940fe008fc93cdddbf4da9fdee2469c0b0f124f040f7fac5eb4e49ee43e61a0c43384f8694388f624454505693bc907117
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("#{config.url}:#{config.auth_port}/v1/tokens") do |req|
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(":#{config.execution_port}/v1/aliasexecution", payload)
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(":#{config.execution_port}/v1/actionalias", "")
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("#{config.url}#{path}") do |req|
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("#{config.url}#{path}") do |req|
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-stackstorm"
3
- spec.version = "0.5.0"
3
+ spec.version = "0.5.1"
4
4
  spec.authors = ["Jurnell Cockhren"]
5
5
  spec.email = ["jurnell@sophicware.com"]
6
6
  spec.description = "Stackstorm handler for lita 4+"
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.0
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+