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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 477549a5e3cab73d97f3f868de4ef46469da1d1a
4
- data.tar.gz: f98c7bab34d326e5fbc300a353a8b81982438ca2
3
+ metadata.gz: 2b17a8f3cc4ff3bcd45c05655534fe4fb8301bbe
4
+ data.tar.gz: 321e09a334c942ae6e2bdb777761be14e77288a2
5
5
  SHA512:
6
- metadata.gz: 456568f2f5e841557d200c2bd7c988f5b046e7df3ab89c91e0847afbb6c201fdd9fa6123c8c372a6c5093912a1312a39681dd3cde18273b87f9d150a0719873c
7
- data.tar.gz: 3672df288eb41dff4b2bef5d4ad3683992f89ebbadccedaafbed21d3841b4b0e5d27454a43e2984643906e4595e3680d0d2425cd22086560302fd970c17ce7d8
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['suggestedResponses'] = suggested_responses
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
@@ -1,3 +1,3 @@
1
1
  module Bot
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
@@ -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
   (0.1ms) rollback transaction
2522
+ ActiveRecord::SchemaMigration Load (0.7ms) SELECT "schema_migrations".* FROM "schema_migrations"
2523
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar NOT NULL) 
2524
+  (0.1ms) select sqlite_version(*)
2525
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
2526
+  (0.1ms) SELECT version FROM "schema_migrations"
2527
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
2528
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
2529
+  (0.1ms) begin transaction
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
+  (0.1ms) rollback transaction
2538
+  (0.0ms) begin transaction
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
+  (0.1ms) rollback transaction
2551
+  (0.1ms) begin transaction
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
+  (0.1ms) rollback transaction
2560
+  (0.0ms) begin transaction
2561
+ -------------------
2562
+ BotTest: test_truth
2563
+ -------------------
2564
+  (0.0ms) 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.19
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-03-30 00:00:00.000000000 Z
11
+ date: 2016-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails