facebook-messenger 0.9.0 → 0.10.0

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: 63684aa5b0f6fa5f0cc2539f21bf569d660d506a
4
- data.tar.gz: a788b3312c44fde7f4150ceeeb3685c2766a37ae
3
+ metadata.gz: 9e83e069691e11fa45a0f1ecd5259979b8384df3
4
+ data.tar.gz: 0e5572b7f3721288e1a909689e58228bc1cbfd27
5
5
  SHA512:
6
- metadata.gz: c39580382e83ae750ea5ec37ef8fff253fb11cba05e5f5e9aa11f43205a7ba872e74fa5c27b77d8d4ec7d0e16de22ea34b79f1e4bb38c694f22f2d94dea531f0
7
- data.tar.gz: 3b597ced101202b833077912cd2ebb870b5f6384356ac097a339212495f811af7f0e3e6cd5432335f57666fc6e52a35329f0532965817dc06b4c55483b2344cd
6
+ metadata.gz: 46522d14a5293209b1161399e950b4d2858bd62ee7ce66724b08885ceb88c0b2bb2dff4aa9f6115dcb6afb68100f88549a1ca7a478a951735140cd32424ced96
7
+ data.tar.gz: 4d822bda06e656c2ea1241614ae866ee53334218f7bb9a2a232b69e68477a74b5377ad2c6b51f79759ac8c362fad2de53cd22c93a40ec8929d5742c5dd444c84
data/README.md CHANGED
@@ -76,6 +76,28 @@ Bot.deliver(
76
76
  )
77
77
  ```
78
78
 
79
+ ##### Messages with quick replies
80
+
81
+ The human may appreciate hints:
82
+
83
+ ```ruby
84
+ Bot.deliver(
85
+ recipient: {
86
+ id: '45123'
87
+ },
88
+ message: {
89
+ text: 'Human, who is your favorite bot?'
90
+ quick_replies: [
91
+ {
92
+ content_type: 'text',
93
+ title: 'You are!',
94
+ payload: 'HARMLESS'
95
+ }
96
+ ]
97
+ }
98
+ )
99
+ ```
100
+
79
101
  ##### Messages with buttons
80
102
 
81
103
  The human may require simple options to communicate:
@@ -118,6 +140,19 @@ end
118
140
 
119
141
  *See Facebook's [documentation][message-documentation] for all message options.*
120
142
 
143
+ ##### Typing indicator
144
+
145
+ Show the human you are preparing a message for them:
146
+
147
+ ```ruby
148
+ Bot.deliver(
149
+ recipient: {
150
+ id: '45123'
151
+ },
152
+ sender_action: 'typing_on'
153
+ )
154
+ ```
155
+
121
156
  #### Send to Facebook
122
157
 
123
158
  When the human clicks the [Send to Messenger button][send-to-messenger-plugin]
@@ -307,13 +342,13 @@ end
307
342
 
308
343
  Remember that Rails only eager loads everything in its production environment.
309
344
  In the development and test environments, it only requires files as you
310
- reference constants. You'll need to explicitly load `app/bots`, then:
345
+ reference constants. You'll need to explicitly load `app/bot`, then:
311
346
 
312
347
  ```ruby
313
348
  # config/initializers/bot.rb
314
349
  unless Rails.env.production?
315
- bot_files = Dir[Rails.root.join('app', 'bots', '**', '*.rb')]
316
- bots_reloader = ActiveSupport::FileUpdateChecker.new(bot_files) do
350
+ bot_files = Dir[Rails.root.join('app', 'bot', '**', '*.rb')]
351
+ bot_reloader = ActiveSupport::FileUpdateChecker.new(bot_files) do
317
352
  bot_files.each{ |file| require_dependency file }
318
353
  end
319
354
 
@@ -328,9 +363,9 @@ end
328
363
  And add below code into `config/application.rb` to ensure rails knows bot files.
329
364
 
330
365
  ```ruby
331
- # Auto-load bots and its subdirectories
332
- config.paths.add File.join('app', 'bots'), glob: File.join('**', '*.rb')
333
- config.autoload_paths += Dir[Rails.root.join('app', 'bots', '*')]
366
+ # Auto-load the bot and its subdirectories
367
+ config.paths.add File.join('app', 'bot'), glob: File.join('**', '*.rb')
368
+ config.autoload_paths += Dir[Rails.root.join('app', 'bot', '*')]
334
369
  ```
335
370
 
336
371
  To test your locally running bot, you can use [ngrok]. This will create a secure
@@ -37,8 +37,10 @@ module Facebook
37
37
  @messaging['message']['attachments']
38
38
  end
39
39
 
40
- def quick_replies
41
- @messaging['message']['quick_reply']
40
+ def quick_reply
41
+ return unless @messaging['message']['quick_reply']
42
+
43
+ @messaging['message']['quick_reply']['payload']
42
44
  end
43
45
  end
44
46
  end
@@ -1,5 +1,5 @@
1
1
  module Facebook
2
2
  module Messenger
3
- VERSION = '0.9.0'.freeze
3
+ VERSION = '0.10.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebook-messenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Gorset
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-17 00:00:00.000000000 Z
11
+ date: 2016-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty