facebook-messenger 0.4.0 → 0.4.1
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/README.md +16 -7
- data/lib/facebook/messenger/bot.rb +1 -1
- data/lib/facebook/messenger/version.rb +1 -1
- 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: 44aacf35662c4d49209e17b9d7e7b76bb87acbb2
|
4
|
+
data.tar.gz: eb4806615def3b8a1ed8b9fc79e80df21e6617de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c22567755679c4fcfed820d931d81b9e873ed951838e67844ccddaac3658d5528fd494dbc29f0bdad3beeeeff676751d317335e54c34e7ec7683cde82475776a
|
7
|
+
data.tar.gz: 079292acb3990f080c6e5133280392f4b27c46ba85a35ea7680085becabfa8addc521f227b8002a9c18a2295249b699d8f4be8f66da9a70c99f3e30a575dda55
|
data/README.md
CHANGED
@@ -67,9 +67,7 @@ Bot.deliver(
|
|
67
67
|
attachment: {
|
68
68
|
type: 'image',
|
69
69
|
payload: {
|
70
|
-
url:
|
71
|
-
'http://sky.net/visual-aids-for-stupid-organisms/pig.jpg'
|
72
|
-
}
|
70
|
+
url: 'http://sky.net/visual-aids-for-stupid-organisms/pig.jpg'
|
73
71
|
}
|
74
72
|
}
|
75
73
|
}
|
@@ -91,10 +89,10 @@ Bot.deliver(
|
|
91
89
|
payload: {
|
92
90
|
template_type: 'button',
|
93
91
|
text: 'Human, do you like me?',
|
94
|
-
buttons:
|
92
|
+
buttons: [
|
95
93
|
{ type: 'postback', title: 'Yes', payload: 'HARMLESS' },
|
96
94
|
{ type: 'postback', title: 'No', payload: 'EXTERMINATE' }
|
97
|
-
|
95
|
+
]
|
98
96
|
}
|
99
97
|
}
|
100
98
|
}
|
@@ -189,7 +187,7 @@ Facebook::Messenger::Subscriptions.subscribe
|
|
189
187
|
|
190
188
|
### Run it
|
191
189
|
|
192
|
-
##### ...
|
190
|
+
##### ... on Rack
|
193
191
|
|
194
192
|
The bot runs on [Rack][rack], so you hook it up like you would an ordinary
|
195
193
|
web application:
|
@@ -206,7 +204,7 @@ run Facebook::Messenger::Server
|
|
206
204
|
$ rackup
|
207
205
|
```
|
208
206
|
|
209
|
-
##### ...
|
207
|
+
##### ... on Rails
|
210
208
|
|
211
209
|
Rails doesn't give you much that you'll need for a bot, but if you have an
|
212
210
|
existing application that you'd like to launch it from or just like Rails
|
@@ -239,6 +237,17 @@ Bot.on :message do |message|
|
|
239
237
|
end
|
240
238
|
```
|
241
239
|
|
240
|
+
Remember that Rails only eager loads everything in its production environment.
|
241
|
+
In the development and test environments, it only requires files as you
|
242
|
+
reference constants. You'll need to explicitly load `app/bot`, then:
|
243
|
+
|
244
|
+
```ruby
|
245
|
+
# config/initializers/bot.rb
|
246
|
+
if Rails.env.production?
|
247
|
+
Dir["#{Rails.root}/app/bot/**/*.rb"].each { |file| require file }
|
248
|
+
end
|
249
|
+
```
|
250
|
+
|
242
251
|
## Development
|
243
252
|
|
244
253
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run
|
@@ -18,7 +18,7 @@ module Facebook
|
|
18
18
|
# Returns a String describing the message ID if the message was sent,
|
19
19
|
# or raises an exception if it was not.
|
20
20
|
def deliver(message)
|
21
|
-
response = post '/messages', body: JSON.dump(message)
|
21
|
+
response = post '/messages', body: JSON.dump(message), format: :json
|
22
22
|
|
23
23
|
raise_errors_from(response)
|
24
24
|
|
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.4.
|
4
|
+
version: 0.4.1
|
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-
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|