slack_trello 0.0.7 → 0.0.8

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: 71f6b09f2ca0702e6b5da1b5cdc4c57f821693ae
4
- data.tar.gz: 0c331cbdd03ed9d05837514c982b00123a920e70
3
+ metadata.gz: ded47581e0e2a50541505d6f91cef86dde6a6b38
4
+ data.tar.gz: d7ab0b0b7d9e8754dc6e7633020deb40e1f1283c
5
5
  SHA512:
6
- metadata.gz: 389e36e9f3842479d1ce2a5c151924257467906da8de6bc683101b356e0e7292372f304d1b1477baded707206c2366e3820ef7c397ebe401d42e6c35fa89c735
7
- data.tar.gz: fd009a0330451f30bbe952a60ab4ac5798f00dce0ca560161aaae49d8191542d3f1c167755817ee92d56408f5d2f8c0cc70cc541e5dcf1f9f7a7f36c1abc5ddb
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
+
@@ -1,3 +1,3 @@
1
1
  module SlackTrello
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -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: "From Chat",
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 'From Chat' must be added to the '#{trello_board_name}' board for the work command to function."
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.7
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-19 00:00:00.000000000 Z
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.2.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.