ruboty-lambda 0.3.0 → 0.4.0

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: 26047e1664fc9710deefe4ee95588bd01f69016c
4
- data.tar.gz: acaf9269d8e503ae49b50486fd4919ad3690f962
3
+ metadata.gz: b66b3dd172b2172a442a7a9bab2c1599255cf0ce
4
+ data.tar.gz: c48c6b58648e9065a552e2c3307408e5e6ef90cd
5
5
  SHA512:
6
- metadata.gz: 103fc20943a9b24508c124c1a12d08f857c17c9ca50b31e9b23a6a097c165cea97c176bb5c25ab356c53c99b0b03b95ad24e202dd4d7067a3ce69afef816896c
7
- data.tar.gz: ce8855da2c522c198e96dd6c6219e6c4828787dd7a3d4f9335828362fc1d866bfd7085ba8d6cedf74a4bfa46665f6c28ee8470e9cef388f795babee0f675a6f2
6
+ metadata.gz: 078ee45e88b957a28a90742fde96faade378b0c66025aaaa15120bd292ced65c0a35552fa933a78c7411be5e46412619c66f77a8a73e439bd01a1fd0ede6fdf6
7
+ data.tar.gz: 427e18e539610cd2a895bd4ad017927b4f5fe77f11a23f066b635a0517a89e3a480cc5911de5ad63e37027564bd4f4809460627472816859e0650dbab5ad25df
@@ -30,8 +30,8 @@ module Ruboty::Handlers
30
30
  })
31
31
 
32
32
  result = Base64.decode64(resp.log_result)
33
- log = []
34
- attachments = []
33
+ logs = []
34
+ fields = []
35
35
 
36
36
  result.each_line do |line|
37
37
  case true
@@ -39,24 +39,30 @@ module Ruboty::Handlers
39
39
  next
40
40
  when line.start_with?('REPORT')
41
41
  line[7..-1].strip.split("\t").map {|f| f.split(':', 2).map(&:strip) }.each do |f|
42
- attachments << {
42
+ fields << {
43
43
  title: f[0],
44
- text: f[1],
44
+ value: f[1],
45
45
  short: true
46
46
  }
47
47
  end
48
48
  else
49
- field = line.split("\t")
50
- log << "#{field[0]} #{field[2]}"
49
+ field = line.strip.split("\t")
50
+ logs << "#{field[0]} #{field[2]}"
51
51
  end
52
52
  end
53
53
 
54
54
  payload = resp.payload.read
55
- attachments << {
56
- title: "payload",
57
- text: payload
55
+ fields << {
56
+ title: "Payload",
57
+ value: payload
58
58
  }
59
- message.reply(log.join("\n"), code: true, attachments: attachments)
59
+
60
+ success = resp.status_code >= 200 && resp.status_code <= 299
61
+
62
+ message.reply(logs.join("\n"), code: true, attachments: [{
63
+ color: success ? 'good' : 'danger',
64
+ fields: fields
65
+ }])
60
66
  end
61
67
 
62
68
  private
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Lambda
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-lambda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Kusano
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-21 00:00:00.000000000 Z
11
+ date: 2016-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler