slackify 0.4.0 → 0.4.1

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: e3b94c8d8ee9aadee9d6c12cfa3e84ebd938e3b34908315e6add11a60d4ddca8
4
- data.tar.gz: 5d04503efbf517d256d55bdb49977ef0e13b79d01615b34c7dd6df44c3fd6806
3
+ metadata.gz: e9cdd391524228878a211afd455c9397efeb625535a3e604e9f58b7d8d086a1a
4
+ data.tar.gz: 180fe23f192a5b93c0dc8619a5c5a65d5007d3653da5b79adcaa122529fed146
5
5
  SHA512:
6
- metadata.gz: a5cc3b8a43401712f68b2b818f7d5f8c3339a8c0cee57aed7bb2907d2553d8066ca7f8c27cd63744468b2b4c659d71719b2bf9ecba816f0947fcf00c8c7d95e0
7
- data.tar.gz: d5c1bc32e1ec8c054d059418e7137b83420b0117835ba629b21f325943c8dafed174215922ea11c4d430ebdaa078340b3e327f62a7c370c98689e7bbe700205a
6
+ metadata.gz: 43df97f56923ad9ef388054ac1768acb799ff5d4709742ac048c4cb88b09cd423a7285d5072a916f2432df6dadce2464deb776130cfca46fbf7903ad825b47eb
7
+ data.tar.gz: 7bc76fbea055984979165fa5a2d1d4ceddd0bcf75517513e4f7e9019300c71f8fdc849b44cbdf7b23d6a95114d83916817f18ea0738866d3b2bab613a57256ab
@@ -26,8 +26,7 @@ module SlackTokenVerify
26
26
  end
27
27
 
28
28
  signature = "v0:#{timestamp}:#{request_body}"
29
- calculated_hmac = "v0=" +
30
- OpenSSL::HMAC.hexdigest("sha256", Slackify.configuration.slack_secret_token, signature)
29
+ calculated_hmac = "v0=#{OpenSSL::HMAC.hexdigest('sha256', Slackify.configuration.slack_secret_token, signature)}"
31
30
 
32
31
  return if ActiveSupport::SecurityUtils.secure_compare(calculated_hmac, hmac_header)
33
32
 
@@ -36,7 +36,7 @@ module Slackify
36
36
  # Set the token that we will use to connect to slack
37
37
  def slack_bot_token=(token)
38
38
  @slack_bot_token = token
39
- @slack_client = Slack::Web::Client.new(token: token).freeze
39
+ @slack_client = Slack::Web::Client.new(token: token)
40
40
  end
41
41
 
42
42
  # Set a handler for a specific message subtype
@@ -32,6 +32,7 @@ module Slackify
32
32
  # Any class inheriting from Slackify::Handler::Base will be added to
33
33
  # the list of supported handlers
34
34
  def inherited(subclass)
35
+ super
35
36
  @@supported_handlers.push(subclass.to_s)
36
37
  end
37
38
 
@@ -9,6 +9,7 @@ module Slackify
9
9
  # Any class inheriting from Slackify::Parameter will be added to
10
10
  # the list of supported parameters
11
11
  def inherited(subclass)
12
+ super
12
13
  @@supported_parameters.push(subclass.to_s)
13
14
  end
14
15
 
@@ -3,6 +3,12 @@
3
3
  module Slackify
4
4
  # In charge of routing a message to its proper handler
5
5
  class Router
6
+ MATCHING_QUOTES = {
7
+ "'": "'",
8
+ '"': '"',
9
+ '“': "”",
10
+ }.freeze
11
+
6
12
  class << self
7
13
  # List all available commands
8
14
  def all_commands
@@ -57,16 +63,14 @@ module Slackify
57
63
  current_key = current_key[0..-2].strip
58
64
 
59
65
  # grab value accounting for any quotes
60
- terminating_string = case s.peek(1)
61
- when "'"
62
- s.skip(/'/)
63
- /'/
64
- when '"'
65
- s.skip(/"/)
66
- /"/
66
+ next_char = s.getch
67
+ terminating_string = if (end_quote = MATCHING_QUOTES[next_char.to_sym])
68
+ /#{end_quote}/
67
69
  else
70
+ s.unscan
68
71
  / /
69
72
  end
73
+
70
74
  processed_args[current_key.to_sym] = if s.exist?(terminating_string)
71
75
  # grab everything before the next instance of the terminating character
72
76
  s.scan_until(terminating_string)[0..-2]
data/lib/slackify.rb CHANGED
@@ -10,6 +10,7 @@ require 'slackify/router'
10
10
  module Slackify
11
11
  class << self
12
12
  attr_writer :configuration
13
+
13
14
  def configuration
14
15
  @configuration ||= Configuration.new
15
16
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slackify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Leger
8
8
  - Michel Chatmajian
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
  date: 2019-12-11 00:00:00.000000000 Z
@@ -139,7 +139,7 @@ licenses:
139
139
  metadata:
140
140
  source_code_uri: https://github.com/jusleg/slackify
141
141
  changelog_uri: https://github.com/jusleg/slackify/blob/master/CHANGELOG.md
142
- post_install_message:
142
+ post_install_message:
143
143
  rdoc_options: []
144
144
  require_paths:
145
145
  - lib
@@ -154,8 +154,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.0.3
158
- signing_key:
157
+ rubygems_version: 3.3.3
158
+ signing_key:
159
159
  specification_version: 4
160
160
  summary: Slackbot framework for Rails using the Events API
161
161
  test_files: []