slack_trello 0.0.7 → 0.0.8
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 +4 -4
- data/lib/slack_trello.rb +3 -0
- data/lib/slack_trello/create_card_command.rb +74 -0
- data/lib/slack_trello/version.rb +1 -1
- data/lib/slack_trello/work_command.rb +6 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ded47581e0e2a50541505d6f91cef86dde6a6b38
|
4
|
+
data.tar.gz: d7ab0b0b7d9e8754dc6e7633020deb40e1f1283c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bb4bb89a4afe90bdabdc3cd8c6ee2f35f7cc145354c676ff7a672517af061f23ba535c16605650ef1e98eb76d4f846af225e49264f49aa4ca05559df78a723d
|
7
|
+
data.tar.gz: b6037d7656a917f0263ad753e2acd4d4581ad0432cf640ab0217db56a508c242f462e40131f08aeef8aba8478a2e04c323e09c61d9e276f427b0c5a5e9448146
|
data/lib/slack_trello.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pry'
|
2
|
+
|
1
3
|
require "active_support/core_ext/string"
|
2
4
|
require "slack-notifier"
|
3
5
|
|
@@ -8,6 +10,7 @@ require "slack_trello/response_parser"
|
|
8
10
|
require "slack_trello/create_trello_card"
|
9
11
|
require "slack_trello/speaker"
|
10
12
|
|
13
|
+
require "slack_trello/create_card_command"
|
11
14
|
require "slack_trello/work_command"
|
12
15
|
|
13
16
|
module SlackTrello
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module SlackTrello; class CreateCardCommand
|
2
|
+
|
3
|
+
include TextParser
|
4
|
+
|
5
|
+
attr_reader :parser, :webhook_url
|
6
|
+
|
7
|
+
def initialize(args, webhook_url)
|
8
|
+
@parser = ResponseParser.new(args)
|
9
|
+
@webhook_url = webhook_url
|
10
|
+
end
|
11
|
+
|
12
|
+
def run
|
13
|
+
return board_not_found_message unless trello_card_creator.trello_board
|
14
|
+
return list_not_found_message unless trello_card_creator.trello_list
|
15
|
+
|
16
|
+
trello_card
|
17
|
+
speaker.speak success_message
|
18
|
+
"You should see a notification with a link. If not, the card might not have been created."
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def speaker
|
24
|
+
args = {
|
25
|
+
webhook_url: webhook_url,
|
26
|
+
channel: parser.channel_name,
|
27
|
+
username: parser.user_name
|
28
|
+
}
|
29
|
+
Speaker.new(args)
|
30
|
+
end
|
31
|
+
|
32
|
+
def trello_card_creator
|
33
|
+
args = {
|
34
|
+
board_name: trello_board_name,
|
35
|
+
list_name: trello_list_name,
|
36
|
+
card_name: card_title
|
37
|
+
}
|
38
|
+
@trello_card_creator ||= CreateTrelloCard.new(args)
|
39
|
+
end
|
40
|
+
|
41
|
+
def trello_card
|
42
|
+
trello_card_creator.card
|
43
|
+
end
|
44
|
+
|
45
|
+
def trello_board_name
|
46
|
+
args[0]
|
47
|
+
end
|
48
|
+
|
49
|
+
def trello_list_name
|
50
|
+
args[1]
|
51
|
+
end
|
52
|
+
|
53
|
+
def board_not_found_message
|
54
|
+
"A Trello board named '#{trello_board_name}' must be created and the Trello user in the codebase must be added to the board for the work command to function for this Slack room."
|
55
|
+
end
|
56
|
+
|
57
|
+
def list_not_found_message
|
58
|
+
"A Trello list named #{trello_list_name} must be added to the '#{trello_board_name}' board for the work command to function."
|
59
|
+
end
|
60
|
+
|
61
|
+
def success_message
|
62
|
+
":trello: [#{parser.user_name}] has created a new trello card: <#{trello_card.short_url}|#{parser.text.strip}>"
|
63
|
+
end
|
64
|
+
|
65
|
+
def card_title
|
66
|
+
parser.text.strip
|
67
|
+
end
|
68
|
+
|
69
|
+
def text
|
70
|
+
parser.text
|
71
|
+
end
|
72
|
+
|
73
|
+
end; end
|
74
|
+
|
data/lib/slack_trello/version.rb
CHANGED
@@ -30,7 +30,7 @@ module SlackTrello; class WorkCommand
|
|
30
30
|
def trello_card_creator
|
31
31
|
args = {
|
32
32
|
board_name: trello_board_name,
|
33
|
-
list_name:
|
33
|
+
list_name: trello_list_name,
|
34
34
|
card_name: card_title
|
35
35
|
}
|
36
36
|
@trello_card_creator ||= CreateTrelloCard.new(args)
|
@@ -44,12 +44,16 @@ module SlackTrello; class WorkCommand
|
|
44
44
|
"#{parser.channel_name.titleize} Backlog"
|
45
45
|
end
|
46
46
|
|
47
|
+
def trello_list_name
|
48
|
+
'From Chat'
|
49
|
+
end
|
50
|
+
|
47
51
|
def board_not_found_message
|
48
52
|
"A Trello board named '#{trello_board_name}' must be created and the Trello user in the codebase must be added to the board for the work command to function for this Slack room."
|
49
53
|
end
|
50
54
|
|
51
55
|
def list_not_found_message
|
52
|
-
"A Trello list named
|
56
|
+
"A Trello list named #{trello_list_name} must be added to the '#{trello_board_name}' board for the work command to function."
|
53
57
|
end
|
54
58
|
|
55
59
|
def success_message
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack_trello
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Powers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- bin/console
|
113
113
|
- bin/setup
|
114
114
|
- lib/slack_trello.rb
|
115
|
+
- lib/slack_trello/create_card_command.rb
|
115
116
|
- lib/slack_trello/create_trello_card.rb
|
116
117
|
- lib/slack_trello/response_parser.rb
|
117
118
|
- lib/slack_trello/speaker.rb
|
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
140
|
version: '0'
|
140
141
|
requirements: []
|
141
142
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.
|
143
|
+
rubygems_version: 2.4.5
|
143
144
|
signing_key:
|
144
145
|
specification_version: 4
|
145
146
|
summary: Using Slack slash commands to make cards on Trello boards.
|