popper 0.5.1 → 0.5.2

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: cd83601b23cd0def143bdd34d55881d2adaa625525d39ffc5caa6b907a76aa9e
4
- data.tar.gz: e402ed64d4f4fe1ecf58feec1f14c5e4cfa3dad83ae4441096895ae357af139c
3
+ metadata.gz: c139212160c9146981eb7b1916a8ffdfde137559e98d97769372177ce79d85b4
4
+ data.tar.gz: a8529c375cfc5c5636c7d68a4540a694692f8d524346746f84fca6298928f6e3
5
5
  SHA512:
6
- metadata.gz: 9d68d22f8326ea0333b122c6af7c186ef8f96c4eba11c07a40f1fb13b2d5f37767da8f046067c9c54070176842f1b3c5509b6af0fea5738f0e5eaa8de7f6e66e
7
- data.tar.gz: 75d3da4e96ca7fbfe9166d89faac3bf7db3f1bb7712edcbadb450dca248c7697375c1bd3b15b7cf825377d7b0fdfc41ca75fc43ce3926abb36bee773d9286905
6
+ metadata.gz: c55e98e69b188f7603c2d75da1833b37afad6becfce028f5bf215423b23cee059169dd4a0285566ebe5aa355732c39a9ebb08ccb11175aa4eb53c11286a64386
7
+ data.tar.gz: 07c95f847d754d05de0015daea9192c5958f17d2802deb3b34f8abedb8599244ffb5a5106eead73de0594cf732362c0452ab9039c63e57d534fcd7ef59995683
@@ -0,0 +1,25 @@
1
+ module Popper::Action
2
+ class Webhook < Base
3
+ def self.task(mail, params = {})
4
+ post!(@action_config.webhook_url, mail.subject, mail.utf_body)
5
+
6
+ params
7
+ end
8
+
9
+ def self.check_params
10
+ @action_config.respond_to?(:webhook_url)
11
+ end
12
+
13
+ def self.post!(url, subject, body)
14
+ request_body = { subject: subject, body: body }.to_json
15
+
16
+ Faraday.post(
17
+ url,
18
+ request_body,
19
+ "Content-Type" => "application/json"
20
+ )
21
+ end
22
+
23
+ next_action(ExecCmd)
24
+ end
25
+ end
data/lib/popper/action.rb CHANGED
@@ -4,4 +4,5 @@ module Popper::Action
4
4
  autoload :Ghe, "popper/action/ghe"
5
5
  autoload :Git, "popper/action/git"
6
6
  autoload :ExecCmd, "popper/action/exec_cmd"
7
+ autoload :Webhook, "popper/action/webhook"
7
8
  end
@@ -49,7 +49,7 @@ module Popper
49
49
  Popper.log.info "check mail:#{mail.date.to_s} #{mail.subject}"
50
50
  match_rules?(mail).each do |rule|
51
51
  Popper.log.info "do action:#{mail.subject}"
52
- Popper::Action::ExecCmd.run(config.action_by_rule(rule), mail) if config.action_by_rule(rule)
52
+ Popper::Action::Webhook.run(config.action_by_rule(rule), mail) if config.action_by_rule(rule)
53
53
  end
54
54
 
55
55
  m.uidl
@@ -1,3 +1,3 @@
1
1
  module Popper
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
data/popper.gemspec CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
24
24
  spec.add_dependency 'toml'
25
25
  spec.add_dependency 'mail'
26
26
  spec.add_dependency 'octokit'
27
+ spec.add_dependency 'faraday'
27
28
  spec.add_dependency "bundler"
28
29
  spec.add_development_dependency "rake", "~> 10.0"
29
30
  spec.add_development_dependency "rspec"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: popper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyama86
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-14 00:00:00.000000000 Z
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: faraday
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: bundler
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -147,6 +161,7 @@ files:
147
161
  - lib/popper/action/ghe.rb
148
162
  - lib/popper/action/git.rb
149
163
  - lib/popper/action/slack.rb
164
+ - lib/popper/action/webhook.rb
150
165
  - lib/popper/cli.rb
151
166
  - lib/popper/config.rb
152
167
  - lib/popper/init.rb
@@ -157,7 +172,7 @@ homepage: http://ten-snapon.com
157
172
  licenses:
158
173
  - MIT
159
174
  metadata: {}
160
- post_install_message:
175
+ post_install_message:
161
176
  rdoc_options: []
162
177
  require_paths:
163
178
  - lib
@@ -172,8 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
187
  - !ruby/object:Gem::Version
173
188
  version: '0'
174
189
  requirements: []
175
- rubygems_version: 3.0.1
176
- signing_key:
190
+ rubygems_version: 3.1.6
191
+ signing_key:
177
192
  specification_version: 4
178
193
  summary: email notification tool
179
194
  test_files: []