bot 0.0.43 → 0.0.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/bot/message.rb +1 -0
- data/lib/bot/messages/card.rb +1 -0
- data/lib/bot/messages/photo.rb +1 -0
- data/lib/bot/messages/video.rb +20 -0
- data/lib/bot/version.rb +1 -1
- data/lib/generators/bot/install/install_generator.rb +8 -0
- data/lib/generators/bot/install/templates/application_handler.rb +3 -0
- data/lib/generators/bot/install/templates/default_responder.rb +9 -10
- data/lib/generators/bot/install/templates/introduction_responder.rb +16 -0
- data/lib/generators/bot/install/templates/reset_responder.rb +12 -0
- data/test/dummy/log/test.log +43 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3919a9aaff7d3aaa526001db8ddb4e1ddfc0c1d0
|
4
|
+
data.tar.gz: c775963934e8edc02c5ec5448274c227487625d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e8d88f31d55834bc37d9c3052bb93e13bea16a15d15fdf6fec65ab20a134fca9ad0236a1f348ed92c81c38b8bda570c14ef9ce018564f3093e5fd3c4dab925
|
7
|
+
data.tar.gz: 362202e750e9adc71881f0c92868138cbf1cc96a7ea0c7d2dd938f152cc9a3e89cf9931d83d9adab828786f24737326e5155013ec61bf173b564b145ed971d6c
|
data/lib/bot/message.rb
CHANGED
data/lib/bot/messages/card.rb
CHANGED
data/lib/bot/messages/photo.rb
CHANGED
@@ -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
|
data/lib/bot/version.rb
CHANGED
@@ -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,14 +1,13 @@
|
|
1
1
|
module Responders
|
2
2
|
class Default < ApplicationResponder
|
3
|
-
respond_to "scan-data", "text", "link", "picture", "video", "sticker"
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
data/test/dummy/log/test.log
CHANGED
@@ -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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3640
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.6ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
3641
|
+
[1m[36m (1.1ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
3642
|
+
[1m[35m (0.4ms)[0m select sqlite_version(*)
|
3643
|
+
[1m[36m (0.9ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
3644
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
3645
|
+
[1m[36m (0.6ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
3646
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
3647
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
3648
|
+
-------------------
|
3649
|
+
BotTest: test_truth
|
3650
|
+
-------------------
|
3651
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
3652
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3661
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
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
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
3674
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
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
|
[1m[35m (0.1ms)[0m 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.
|
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-
|
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
|