slack_trello 0.0.10 → 0.0.11

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: 3791db0c34afbc514cb91852c97ebffd43dd5aaf
4
- data.tar.gz: 991042e5ae0522f640e8f969ebfa633aab60c65f
3
+ metadata.gz: 2bc22dc727048c0d87b14bfceacd21cd5b3bb7a0
4
+ data.tar.gz: 28a273bd9d1226aa02ead0aabb6694c4f0b68c41
5
5
  SHA512:
6
- metadata.gz: f5728525d85df6dc1c85a22f4b80f8061ce2c9881a3df6f02c4e056cf24c51991d209b13a5b34b3e194f6695150f9220da823583fa19556550173750e5286352
7
- data.tar.gz: 24fc6547e947010c940a5a3454c59194bef9997be43360603cba84073f6359e96dee1384b885f5fc9c021b61a53be9c15b3c3f7db03ad10a7d0d02f92604cc7d
6
+ metadata.gz: e280ed1fb28ff11fd72af69d9b33b4d52b3c70d0a059f7fe09727cd85b70c506a392a8a65dd39eda63084d5e5b04438951785d122352057828306a131c4ae902
7
+ data.tar.gz: e09e4ae85645c4f65b688c438fb82ea5c28feb0178d67b480decc110066d6b618c3bbe26f79a601e7974b8823866d699a8fb89402d64b960cc56f815e38c6932
@@ -62,11 +62,11 @@ For example, Some Board Name => some_board_name
62
62
  end
63
63
 
64
64
  def board_not_found_message
65
- "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."
65
+ "A Trello board named '#{trello_board_name}' must be created and the Trello user in the codebase must be added to the board for this command to function for this Slack room."
66
66
  end
67
67
 
68
68
  def list_not_found_message
69
- "A Trello list named #{trello_list_name} must be added to the '#{trello_board_name}' board for the work command to function."
69
+ "A Trello list named #{trello_list_name} must be added to the '#{trello_board_name}' board for this command to function."
70
70
  end
71
71
 
72
72
  def success_message
@@ -0,0 +1,92 @@
1
+ module SlackTrello; class RetroCommand
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 help_message unless valid_text_format?
14
+ return help_message unless num_args == 1
15
+ return board_not_found_message unless trello_card_creator.trello_board
16
+ return list_not_found_message unless trello_card_creator.trello_list
17
+
18
+ trello_card
19
+ speaker.speak success_message
20
+ "You should see a notification with a link. If not, the card might not have been created."
21
+ end
22
+
23
+ private
24
+
25
+ def help_message
26
+ %{:cry: Invalid format
27
+ Your message: #{text}
28
+ Example: /card (trello_list) card title
29
+ Available list names: #{list_names.join(", ")}
30
+ If the Trello list has spaces, replace them with underscores
31
+ For example, Some List Name => some_list_name
32
+ }
33
+ end
34
+
35
+ def speaker
36
+ args = {
37
+ webhook_url: webhook_url,
38
+ channel: parser.channel_name,
39
+ username: parser.user_name
40
+ }
41
+ Speaker.new(args)
42
+ end
43
+
44
+ def trello_card_creator
45
+ args = {
46
+ board_name: trello_board_name,
47
+ list_name: trello_list_name,
48
+ card_name: card_title
49
+ }
50
+ @trello_card_creator ||= CreateTrelloCard.new(args)
51
+ end
52
+
53
+ def trello_card
54
+ trello_card_creator.card
55
+ end
56
+
57
+ def trello_board_name
58
+ "#{parser.channel_name.titleize} Retro"
59
+ end
60
+
61
+ def trello_list_name
62
+ args[0]
63
+ end
64
+
65
+ def board_not_found_message
66
+ "A Trello board named '#{trello_board_name}' must be created and the Trello user in the codebase must be added to the board for this command to function for this Slack room."
67
+ end
68
+
69
+ def list_not_found_message
70
+ "A Trello list named #{trello_list_name} must be added to the '#{trello_board_name}' board for this command to function."
71
+ end
72
+
73
+ def success_message
74
+ ":trello: [#{parser.user_name}] has created a new trello card: <#{trello_card.short_url}|#{parser.text.strip}>"
75
+ end
76
+
77
+ def card_title
78
+ "#{text_message} -- #{parser.user_name}"
79
+ end
80
+
81
+ def text
82
+ parser.text
83
+ end
84
+
85
+ def list_names
86
+ trello_card_creator.trello_board.lists.map do |list|
87
+ list.name.parameterize.underscore
88
+ end
89
+ end
90
+
91
+ end; end
92
+
@@ -1,3 +1,3 @@
1
1
  module SlackTrello
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
data/lib/slack_trello.rb CHANGED
@@ -12,6 +12,7 @@ require "slack_trello/speaker"
12
12
 
13
13
  require "slack_trello/create_card_command"
14
14
  require "slack_trello/work_command"
15
+ require "slack_trello/retro_command"
15
16
 
16
17
  module SlackTrello
17
18
  end
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.10
4
+ version: 0.0.11
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-31 00:00:00.000000000 Z
11
+ date: 2015-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -115,6 +115,7 @@ files:
115
115
  - lib/slack_trello/create_card_command.rb
116
116
  - lib/slack_trello/create_trello_card.rb
117
117
  - lib/slack_trello/response_parser.rb
118
+ - lib/slack_trello/retro_command.rb
118
119
  - lib/slack_trello/speaker.rb
119
120
  - lib/slack_trello/text_parser.rb
120
121
  - lib/slack_trello/version.rb