bot 0.0.19 → 0.0.20
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/responder.rb +20 -2
- data/lib/bot/version.rb +1 -1
- data/test/dummy/log/test.log +43 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2b17a8f3cc4ff3bcd45c05655534fe4fb8301bbe
|
|
4
|
+
data.tar.gz: 321e09a334c942ae6e2bdb777761be14e77288a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6498653737b7b220f9c520838f1b92f7e10d30ea5bb1ee581db4274b865977f16351003105bd1ce284808f77f06a322cf7889b3a509f59301ffe8d21adfda25
|
|
7
|
+
data.tar.gz: c3a4c9290cd091c419ebd9bb0347590556eb048e05d6f292a8796b1f849ec6e2997794a60648e01bf8f39f2c11b8594c4e511a82be69da3583932f1904555f20
|
data/lib/bot/responder.rb
CHANGED
|
@@ -40,11 +40,15 @@ module Bot
|
|
|
40
40
|
'type' => 'text',
|
|
41
41
|
'to' => message['from'],
|
|
42
42
|
'body' => message_text,
|
|
43
|
-
'typeTime' => 0
|
|
43
|
+
'typeTime' => 0,
|
|
44
|
+
'chatId' => message['chatId']
|
|
44
45
|
}
|
|
45
46
|
case suggested_responses
|
|
46
47
|
when Array
|
|
47
|
-
text_response['
|
|
48
|
+
text_response['keyboards'] = [{
|
|
49
|
+
'type' => 'suggested',
|
|
50
|
+
'responses' => build_suggested_responses(suggested_responses)
|
|
51
|
+
}]
|
|
48
52
|
when Hash
|
|
49
53
|
text_response.merge!(suggested_responses)
|
|
50
54
|
end
|
|
@@ -97,5 +101,19 @@ module Bot
|
|
|
97
101
|
def scan_data
|
|
98
102
|
JSON.parse(message['data'])
|
|
99
103
|
end
|
|
104
|
+
|
|
105
|
+
def build_suggested_responses(suggested_responses)
|
|
106
|
+
suggested_responses.map do |response|
|
|
107
|
+
case response
|
|
108
|
+
when String
|
|
109
|
+
{
|
|
110
|
+
'type' => 'text',
|
|
111
|
+
'body' => response
|
|
112
|
+
}
|
|
113
|
+
when Hash
|
|
114
|
+
response
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
end
|
|
100
118
|
end
|
|
101
119
|
end
|
data/lib/bot/version.rb
CHANGED
data/test/dummy/log/test.log
CHANGED
|
@@ -2519,3 +2519,46 @@ Processing by Bot::BotController#notify as HTML
|
|
|
2519
2519
|
Parameters: {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"scan-data", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
|
|
2520
2520
|
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
2521
2521
|
[1m[35m (0.1ms)[0m rollback transaction
|
|
2522
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.7ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
|
2523
|
+
[1m[36m (0.9ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
|
2524
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
|
2525
|
+
[1m[36m (0.9ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
|
2526
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
|
2527
|
+
[1m[36m (0.8ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
|
2528
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
|
2529
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
2530
|
+
-----------------------------------------
|
|
2531
|
+
NavigationTest: test_notify_special_types
|
|
2532
|
+
-----------------------------------------
|
|
2533
|
+
Started POST "/bot/notify" for 127.0.0.1 at 2016-04-06 15:50:27 -0400
|
|
2534
|
+
Processing by Bot::BotController#notify as HTML
|
|
2535
|
+
Parameters: {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"scan-data", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
|
|
2536
|
+
Completed 200 OK in 0ms (Views: 0.2ms | ActiveRecord: 0.0ms)
|
|
2537
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
2538
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
2539
|
+
---------------------------
|
|
2540
|
+
NavigationTest: test_notify
|
|
2541
|
+
---------------------------
|
|
2542
|
+
Started POST "/bot/notify" for 127.0.0.1 at 2016-04-06 15:50:27 -0400
|
|
2543
|
+
Processing by Bot::BotController#notify as HTML
|
|
2544
|
+
Parameters: {"bot"=>ApplicationHandler}
|
|
2545
|
+
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
2546
|
+
Started POST "/bot/notify" for 127.0.0.1 at 2016-04-06 15:50:27 -0400
|
|
2547
|
+
Processing by Bot::BotController#notify as HTML
|
|
2548
|
+
Parameters: {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"text", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
|
|
2549
|
+
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
2550
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
2551
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
|
2552
|
+
---------------------------------------
|
|
2553
|
+
NavigationTest: test_notify_multi_types
|
|
2554
|
+
---------------------------------------
|
|
2555
|
+
Started POST "/bot/notify" for 127.0.0.1 at 2016-04-06 15:50:27 -0400
|
|
2556
|
+
Processing by Bot::BotController#notify as HTML
|
|
2557
|
+
Parameters: {"messages"=>[{"body"=>"multi", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"scan-data", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
|
|
2558
|
+
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
2559
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
|
2560
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
|
2561
|
+
-------------------
|
|
2562
|
+
BotTest: test_truth
|
|
2563
|
+
-------------------
|
|
2564
|
+
[1m[35m (0.0ms)[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.20
|
|
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-
|
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|