telegram_meetup_bot 0.2.1 → 0.3.0

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: 1299c19a498275ebe14bb9bdc69359b36ddeaae5
4
- data.tar.gz: 9aac64f1b7d5c76040a8b4be614b1db14b8ac463
3
+ metadata.gz: b1917d0bb400237f866bdf6ab5e38fb0d1fef5f6
4
+ data.tar.gz: 06e94518ea4a661a319cbb2ced8f8a27852d3877
5
5
  SHA512:
6
- metadata.gz: 14d283ff2f1cc8b5c6dce9276474aaab013a9097118e0d9892538ee57cea02b62403afebeca53ec21d5485d3dc755e1ce554da270d2bbadbc6d5a64aa590f1a0
7
- data.tar.gz: 2dc72e421994776052e4bd410b1f34b3e308444070f1c0a27a64d54f60735f5cd1a7974d7958755c642b5b682fd44728a1f9327dccdf2f847ab6da5d2179d151
6
+ metadata.gz: 3ccc76e87fc962af3abb2ba136baa88abca63d1594d93dddbe5fe4fb5c76ec7ae06b678698bf1558acda5482d2fd6ee41aa0d2b11997009bed762fb2d329ed38
7
+ data.tar.gz: 9fbda4e6c9f545c00bb3222998434972c1a380360212e605823e226520c37df10a02c11eb772ae6129ea8b3fe08ea3456e5fdca441fdeb43fe6896ed71722a0f
@@ -9,5 +9,3 @@ require 'telegram_meetup_bot/commands/list_command'
9
9
  require 'telegram_meetup_bot/commands/user_command'
10
10
 
11
11
  COMMANDS = %w(date list cancel help cal user)
12
- BLACK_LIST = %w(me)
13
- DEFAULT_COMMAND = 'help'
@@ -14,8 +14,6 @@ module TelegramMeetupBot
14
14
  def command
15
15
  @command ||= if COMMANDS.include?(message.command)
16
16
  message.command
17
- else
18
- DEFAULT_COMMAND
19
17
  end
20
18
  end
21
19
 
@@ -3,7 +3,7 @@ module TelegramMeetupBot
3
3
  class Factory
4
4
  class << self
5
5
  def build(message)
6
- return if BLACK_LIST.include?(message.command)
6
+ return unless COMMANDS.include?(message.command)
7
7
 
8
8
  if no_username?(message)
9
9
  TelegramMeetupBot::Commands::NilUsername.new(message)
@@ -15,14 +15,10 @@ module TelegramMeetupBot
15
15
  private
16
16
 
17
17
  def klass(command)
18
- command = whitelisted_command(command).capitalize
18
+ command = command.capitalize
19
19
  Object.const_get "TelegramMeetupBot::Commands::#{command}Command"
20
20
  end
21
21
 
22
- def whitelisted_command(command)
23
- COMMANDS.include?(command) ? command : DEFAULT_COMMAND
24
- end
25
-
26
22
  def no_username?(message)
27
23
  message.author.username.nil?
28
24
  end
@@ -1,3 +1,3 @@
1
1
  module TelegramMeetupBot
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -27,8 +27,8 @@ RSpec.describe TelegramMeetupBot::Commands::Factory do
27
27
  context 'not available command' do
28
28
  let(:command) { '/qwerty' }
29
29
 
30
- it 'uses default command' do
31
- expect(subject.class).to eq(TelegramMeetupBot::Commands::HelpCommand)
30
+ it 'ignore command' do
31
+ expect(subject).to eq(nil)
32
32
  end
33
33
  end
34
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telegram_meetup_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timur Yanberdin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-01 00:00:00.000000000 Z
11
+ date: 2017-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler