bot 0.0.20 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bot/adapters/base.rb +1 -1
- data/lib/bot/responder.rb +3 -1
- data/lib/bot/version.rb +1 -1
- data/lib/generators/bot/install/install_generator.rb +4 -0
- data/lib/generators/bot/install/templates/application_handler.rb +1 -1
- data/lib/generators/bot/install/templates/default_responder.rb +13 -0
- data/lib/tasks/bot_builder_tasks.rake +33 -4
- data/test/dummy/log/test.log +43 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a9a1b48aa5afbacfcf34d04cdba5cd9472b3dfd
|
4
|
+
data.tar.gz: 3b9e84f1a57e851760a608c68bd282d4c1434472
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a0facc9f48ec114c1431cfa83d10cb7dfa7c063e63617f69b3c5b1495e0a3d16b571f4cc3a399145ecf17cd13570465e85839fb94ee73d4b3a72e225d20ee77
|
7
|
+
data.tar.gz: ffbbccac03ce03f0be9ff2c682b54667aadc3192e82543d00c0c299c54a5c5128d6d5e0e1e44e61e06d8d8bcd4fffdf80e16e6ab99720db0335f9036c9ff280d
|
data/lib/bot/adapters/base.rb
CHANGED
data/lib/bot/responder.rb
CHANGED
@@ -41,8 +41,10 @@ module Bot
|
|
41
41
|
'to' => message['from'],
|
42
42
|
'body' => message_text,
|
43
43
|
'typeTime' => 0,
|
44
|
-
'chatId' => message['chatId']
|
45
44
|
}
|
45
|
+
|
46
|
+
text_response['chatId'] = message['chatId'] if message['chatId']
|
47
|
+
|
46
48
|
case suggested_responses
|
47
49
|
when Array
|
48
50
|
text_response['keyboards'] = [{
|
data/lib/bot/version.rb
CHANGED
@@ -1,4 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require 'net/http'
|
2
|
+
|
3
|
+
namespace :bot do
|
4
|
+
namespace :kik do
|
5
|
+
|
6
|
+
desc "Update a bot config"
|
7
|
+
task :configure => :environment do
|
8
|
+
uri = URI.parse("https://api.kik.com/v1/config")
|
9
|
+
|
10
|
+
request = Net::HTTP::Post.new(uri.request_uri, initheader = { "Content-Type" => "application/json" })
|
11
|
+
request.basic_auth Bot.configuration.adapter.config[:bot_user], Bot.configuration.adapter.config[:bot_token]
|
12
|
+
request.body = {
|
13
|
+
webhook: "#{ENV['CALLBACK_URL']}",
|
14
|
+
features: {
|
15
|
+
manuallySendReadReceipts: false,
|
16
|
+
receiveReadReceipts: false,
|
17
|
+
receiveDeliveryReceipts: false,
|
18
|
+
receiveIsTyping: false
|
19
|
+
}
|
20
|
+
}.to_json
|
21
|
+
|
22
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
23
|
+
http.use_ssl = (uri.scheme == "https")
|
24
|
+
response = http.request(request)
|
25
|
+
|
26
|
+
if response.code == "200"
|
27
|
+
puts "Configured okay!"
|
28
|
+
else
|
29
|
+
puts "Error: #{response.body}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/test/dummy/log/test.log
CHANGED
@@ -2562,3 +2562,46 @@ Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
|
2562
2562
|
BotTest: test_truth
|
2563
2563
|
-------------------
|
2564
2564
|
[1m[35m (0.0ms)[0m rollback transaction
|
2565
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
2566
|
+
[1m[36m (1.0ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
2567
|
+
[1m[35m (0.1ms)[0m select sqlite_version(*)
|
2568
|
+
[1m[36m (0.8ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
2569
|
+
[1m[35m (0.1ms)[0m SELECT version FROM "schema_migrations"
|
2570
|
+
[1m[36m (0.7ms)[0m [1mINSERT INTO "schema_migrations" (version) VALUES ('0')[0m
|
2571
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.1ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
2572
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
2573
|
+
-------------------
|
2574
|
+
BotTest: test_truth
|
2575
|
+
-------------------
|
2576
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
2577
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
2578
|
+
-----------------------------------------
|
2579
|
+
NavigationTest: test_notify_special_types
|
2580
|
+
-----------------------------------------
|
2581
|
+
Started POST "/bot/notify" for 127.0.0.1 at 2016-04-07 14:29:37 -0400
|
2582
|
+
Processing by Bot::BotController#notify as HTML
|
2583
|
+
Parameters: {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"scan-data", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
|
2584
|
+
Completed 200 OK in 1ms (Views: 0.3ms | ActiveRecord: 0.0ms)
|
2585
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
2586
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
2587
|
+
---------------------------------------
|
2588
|
+
NavigationTest: test_notify_multi_types
|
2589
|
+
---------------------------------------
|
2590
|
+
Started POST "/bot/notify" for 127.0.0.1 at 2016-04-07 14:29:37 -0400
|
2591
|
+
Processing by Bot::BotController#notify as HTML
|
2592
|
+
Parameters: {"messages"=>[{"body"=>"multi", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"scan-data", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
|
2593
|
+
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
2594
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
2595
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
2596
|
+
---------------------------
|
2597
|
+
NavigationTest: test_notify
|
2598
|
+
---------------------------
|
2599
|
+
Started POST "/bot/notify" for 127.0.0.1 at 2016-04-07 14:29:37 -0400
|
2600
|
+
Processing by Bot::BotController#notify as HTML
|
2601
|
+
Parameters: {"bot"=>ApplicationHandler}
|
2602
|
+
Completed 200 OK in 0ms (Views: 0.1ms | ActiveRecord: 0.0ms)
|
2603
|
+
Started POST "/bot/notify" for 127.0.0.1 at 2016-04-07 14:29:37 -0400
|
2604
|
+
Processing by Bot::BotController#notify as HTML
|
2605
|
+
Parameters: {"messages"=>[{"body"=>"Hello", "readReceiptRequested"=>"true", "from"=>"bnmrrs", "timestamp"=>"1452785908454", "type"=>"text", "id"=>"2af0d873-d157-4627-b863-8be11b0dfd86"}], "bot"=>ApplicationHandler}
|
2606
|
+
Completed 200 OK in 0ms (Views: 0.0ms | ActiveRecord: 0.0ms)
|
2607
|
+
[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.22
|
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-04-
|
11
|
+
date: 2016-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rest-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.8.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.8.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- lib/generators/bot/install/install_generator.rb
|
109
109
|
- lib/generators/bot/install/templates/application_handler.rb
|
110
110
|
- lib/generators/bot/install/templates/application_responder.rb
|
111
|
+
- lib/generators/bot/install/templates/default_responder.rb
|
111
112
|
- lib/generators/bot/install/templates/initializer.rb
|
112
113
|
- lib/generators/bot/responder/responder_generator.rb
|
113
114
|
- lib/generators/rspec/install_generator.rb
|