bot 0.0.43 → 0.0.44

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: adf1928c71e4656d5f707f961b19046f86943938
4
- data.tar.gz: 9f5cce89a6dfa56e5decf834e376fb4a1719087a
3
+ metadata.gz: 3919a9aaff7d3aaa526001db8ddb4e1ddfc0c1d0
4
+ data.tar.gz: c775963934e8edc02c5ec5448274c227487625d1
5
5
  SHA512:
6
- metadata.gz: 1eb4fb9d161fce264825176a4a2a830055fad3b75328977cf9cc3309e33b7624a8b655c2b296fd4eafe5e86145b13029f92ea5cb4630ddbe6093b79f844fb279
7
- data.tar.gz: 67a7c2bc42f97e161c3de22026fe34b9b0d805811c9f696a5cf229ad549e2b28e1e57cf7a39fd29c649b474a81badc9354bfe4e9de9d227a3c7ebe295e66d67a
6
+ metadata.gz: e5e8d88f31d55834bc37d9c3052bb93e13bea16a15d15fdf6fec65ab20a134fca9ad0236a1f348ed92c81c38b8bda570c14ef9ce018564f3093e5fd3c4dab925
7
+ data.tar.gz: 362202e750e9adc71881f0c92868138cbf1cc96a7ea0c7d2dd938f152cc9a3e89cf9931d83d9adab828786f24737326e5155013ec61bf173b564b145ed971d6c
@@ -2,6 +2,7 @@ require "bot/messages/base"
2
2
  require "bot/messages/text"
3
3
  require "bot/messages/photo"
4
4
  require "bot/messages/card"
5
+ require "bot/messages/video"
5
6
 
6
7
  module Bot
7
8
  module Message
@@ -18,6 +18,7 @@ module Bot
18
18
  self.message['picUrl'] = icon if icon
19
19
  self.message['attribution']['iconUrl'] = icon if icon
20
20
 
21
+ self.message['chatId'] = options['chatId'] if options['chatId']
21
22
  self.suggested_responses = suggested_responses
22
23
  end
23
24
  end
@@ -9,6 +9,7 @@ module Bot
9
9
  'typeTime' => 0,
10
10
  }.merge(options)
11
11
 
12
+ self.message['chatId'] = options['chatId'] if options['chatId']
12
13
  self.suggested_responses = suggested_responses
13
14
  end
14
15
  end
@@ -0,0 +1,20 @@
1
+ module Bot
2
+ module Message
3
+ class Video < Base
4
+ def initialize(to, photo_url, suggested_responses=false, options={})
5
+ self.message = {
6
+ 'type' => 'video',
7
+ 'to' => to,
8
+ 'videoUrl' => photo_url,
9
+ 'loop' => false,
10
+ 'muted' => false,
11
+ 'autoplay' => false,
12
+ 'noSave' => true,
13
+ }.merge(options)
14
+
15
+ self.message['chatId'] = options['chatId'] if options['chatId']
16
+ self.suggested_responses = suggested_responses
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Bot
2
- VERSION = "0.0.43"
2
+ VERSION = "0.0.44"
3
3
  end
@@ -12,6 +12,14 @@ module Bot
12
12
  "default_responder.rb",
13
13
  "app/bot/responders/default.rb"
14
14
  )
15
+ copy_file(
16
+ "reset_responder.rb",
17
+ "app/bot/responders/reset.rb"
18
+ )
19
+ copy_file(
20
+ "introduction_responder.rb",
21
+ "app/bot/responders/introduction.rb"
22
+ )
15
23
  copy_file(
16
24
  "application_handler.rb",
17
25
  "app/bot/application_handler.rb"
@@ -1,4 +1,7 @@
1
1
  class ApplicationHandler < Bot::Handler
2
+ use Responders::Introduction
3
+ use Responders::Reset
4
+
2
5
  use Responders::Default
3
6
 
4
7
  def user_for(message)
@@ -1,14 +1,13 @@
1
1
  module Responders
2
2
  class Default < ApplicationResponder
3
- respond_to "scan-data", "text", "link", "picture", "video", "sticker"
4
- #
5
- # def can_handle?
6
- # true
7
- # end
8
- #
9
- # def handle
10
- # text_response('Hello!')
11
- # end
12
- #
3
+ respond_to "scan-data", "text", "link", "picture", "video", "sticker", "start-chatting"
4
+
5
+ def can_handle?
6
+ true
7
+ end
8
+
9
+ def handle
10
+ text_response('Hello!')
11
+ end
13
12
  end
14
13
  end
@@ -0,0 +1,16 @@
1
+ module Responders
2
+ class Introduction < ApplicationResponder
3
+ respond_to "scan-data", "text", "link", "picture", "video", "sticker", "start-chatting"
4
+
5
+ def can_handle?
6
+ !user.introduced?
7
+ end
8
+
9
+ def handle
10
+ user.introduced = true
11
+ user.save!
12
+
13
+ reexecute_with(text_response('Hello!'))
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,12 @@
1
+ module Responders
2
+ class Reset < ApplicationResponder
3
+ def can_handle?
4
+ match_message("Reset!")
5
+ end
6
+
7
+ def handle
8
+ user.destroy
9
+ text_response('Resetting..')
10
+ end
11
+ end
12
+ end
@@ -3635,5 +3635,48 @@ Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms)
3635
3635
  Started POST "/bot/notify" for 127.0.0.1 at 2016-05-05 10:54:01 -0400
3636
3636
  Processing by Bot::BotController#notify as HTML
3637
3637
  Parameters: {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"text", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
3638
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
3639
+  (0.1ms) rollback transaction
3640
+ ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".* FROM "schema_migrations"
3641
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
3642
+  (0.4ms) select sqlite_version(*)
3643
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3644
+  (0.1ms) SELECT version FROM "schema_migrations"
3645
+  (0.6ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
3646
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
3647
+  (0.1ms) begin transaction
3648
+ -------------------
3649
+ BotTest: test_truth
3650
+ -------------------
3651
+  (0.0ms) rollback transaction
3652
+  (0.0ms) begin transaction
3653
+ -----------------------------------------
3654
+ NavigationTest: test_notify_special_types
3655
+ -----------------------------------------
3656
+ Started POST "/bot/notify" for 127.0.0.1 at 2016-05-13 15:50:34 -0400
3657
+ Processing by Bot::BotController#notify as HTML
3658
+ Parameters: {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"scan-data", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
3659
+ Completed 500 Internal Server Error in 3ms (ActiveRecord: 0.0ms)
3660
+  (0.1ms) rollback transaction
3661
+  (0.1ms) begin transaction
3662
+ ---------------------------
3663
+ NavigationTest: test_notify
3664
+ ---------------------------
3665
+ Started POST "/bot/notify" for 127.0.0.1 at 2016-05-13 15:50:34 -0400
3666
+ Processing by Bot::BotController#notify as HTML
3667
+ Parameters: {"bot"=>ApplicationHandler}
3668
+ Completed 200 OK in 1ms (Views: 0.6ms | ActiveRecord: 0.0ms)
3669
+ Started POST "/bot/notify" for 127.0.0.1 at 2016-05-13 15:50:34 -0400
3670
+ Processing by Bot::BotController#notify as HTML
3671
+ Parameters: {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"text", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
3672
+ Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
3673
+  (0.1ms) rollback transaction
3674
+  (0.0ms) begin transaction
3675
+ ---------------------------------------
3676
+ NavigationTest: test_notify_multi_types
3677
+ ---------------------------------------
3678
+ Started POST "/bot/notify" for 127.0.0.1 at 2016-05-13 15:50:34 -0400
3679
+ Processing by Bot::BotController#notify as HTML
3680
+ Parameters: {"messages"=>[{"body"=>"multi", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"scan-data", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
3638
3681
  Completed 500 Internal Server Error in 1ms (ActiveRecord: 0.0ms)
3639
3682
   (0.1ms) rollback transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.43
4
+ version: 0.0.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Morris
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-05 00:00:00.000000000 Z
11
+ date: 2016-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -118,6 +118,7 @@ files:
118
118
  - lib/bot/messages/card.rb
119
119
  - lib/bot/messages/photo.rb
120
120
  - lib/bot/messages/text.rb
121
+ - lib/bot/messages/video.rb
121
122
  - lib/bot/responder.rb
122
123
  - lib/bot/responder_chain.rb
123
124
  - lib/bot/route_extensions.rb
@@ -132,6 +133,8 @@ files:
132
133
  - lib/generators/bot/install/templates/bot_helper.rb
133
134
  - lib/generators/bot/install/templates/default_responder.rb
134
135
  - lib/generators/bot/install/templates/initializer.rb
136
+ - lib/generators/bot/install/templates/introduction_responder.rb
137
+ - lib/generators/bot/install/templates/reset_responder.rb
135
138
  - lib/generators/bot/responder/responder_generator.rb
136
139
  - lib/generators/rspec/install_generator.rb
137
140
  - lib/generators/rspec/responder_generator.rb