facebook-messenger 1.3.0 → 1.4.0
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 +21 -3
- data/lib/facebook/messenger/bot.rb +1 -0
- data/lib/facebook/messenger/incoming.rb +3 -1
- data/lib/facebook/messenger/incoming/game_play.rb +39 -0
- data/lib/facebook/messenger/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee1571f2dd5f4579a76e761c4145f643bec11dea790dd05b6afd1495f615003b
|
4
|
+
data.tar.gz: e8e92206d1fb3158f203a42790efcd4b8097c14d4d27d4a6cfe9ca8caa1418e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 224306905134c4d0fbc5b58f513e3ae84d670154573817e88bd5d3e66d16acd530bcadfe22abe2075583616f95e962f8e3d1f0fb46e82d9476fbd44142796797
|
7
|
+
data.tar.gz: a506fca934e229704672e0be3a1eaacac90a4dbc59799fe5122432ce75b5d0ae22cc56885301c5b2d40cea8363cfcdb9f940c5f70f3f026531d8d41efbcea8ec
|
data/README.md
CHANGED
@@ -4,9 +4,10 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
[](https://rubygems.org/gems/facebook-messenger)
|
7
|
-
[](https://rubygems.org/gems/facebook-messenger)
|
8
|
+
[](https://travis-ci.org/jgorset/facebook-messenger)
|
9
|
+
[](https://codeclimate.com/github/jgorset/facebook-messenger)
|
10
|
+
[](https://coveralls.io/github/jgorset/facebook-messenger?branch=master)
|
10
11
|
[](http://inch-ci.org/github/jgorset/facebook-messenger)
|
11
12
|
|
12
13
|
## Installation
|
@@ -199,6 +200,23 @@ Bot.on :message_request do |message_request|
|
|
199
200
|
end
|
200
201
|
```
|
201
202
|
|
203
|
+
##### Record instant game progress
|
204
|
+
|
205
|
+
You can keep track of instant game progress:
|
206
|
+
|
207
|
+
```ruby
|
208
|
+
Bot.on :game_play do |game_play|
|
209
|
+
game_play.sender # => { 'id' => '1008372609250235' }
|
210
|
+
game_play.recipient # => { 'id' => '2015573629214912' }
|
211
|
+
game_play.sent_at # => 2016-04-22 21:30:36 +0200
|
212
|
+
game_play.game # => "<GAME-APP-ID>"
|
213
|
+
game_play.player # => "<PLAYER-ID>"
|
214
|
+
game_play.context # => { 'context_type' => "<CONTEXT-TYPE:SOLO|THREAD>", 'context_id' => "<CONTEXT-ID>" }
|
215
|
+
game_play.score # => 100
|
216
|
+
game_play.payload # => "<PAYLOAD>"
|
217
|
+
end
|
218
|
+
```
|
219
|
+
|
202
220
|
#### Send to Facebook
|
203
221
|
|
204
222
|
When the human clicks the [Send to Messenger button][send-to-messenger-plugin]
|
@@ -11,6 +11,7 @@ require 'facebook/messenger/incoming/referral'
|
|
11
11
|
require 'facebook/messenger/incoming/payment'
|
12
12
|
require 'facebook/messenger/incoming/policy_enforcement'
|
13
13
|
require 'facebook/messenger/incoming/pass_thread_control'
|
14
|
+
require 'facebook/messenger/incoming/game_play'
|
14
15
|
|
15
16
|
module Facebook
|
16
17
|
module Messenger
|
@@ -33,7 +34,8 @@ module Facebook
|
|
33
34
|
'message_request' => MessageRequest,
|
34
35
|
'payment' => Payment,
|
35
36
|
'policy_enforcement' => PolicyEnforcement,
|
36
|
-
'pass_thread_control' => PassThreadControl
|
37
|
+
'pass_thread_control' => PassThreadControl,
|
38
|
+
'game_play' => GamePlay
|
37
39
|
}.freeze
|
38
40
|
|
39
41
|
# Parse the given payload and create new object of class related
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Facebook
|
2
|
+
module Messenger
|
3
|
+
module Incoming
|
4
|
+
# The GamePlay class represents an incoming Facebook Messenger
|
5
|
+
# game_play events.
|
6
|
+
# @see https://developers.facebook.com/docs/messenger-platform/reference/webhook-events/messaging_game_plays
|
7
|
+
class GamePlay
|
8
|
+
include Facebook::Messenger::Incoming::Common
|
9
|
+
|
10
|
+
def game_play
|
11
|
+
@messaging['game_play']
|
12
|
+
end
|
13
|
+
|
14
|
+
def payload
|
15
|
+
game_play['payload']
|
16
|
+
end
|
17
|
+
|
18
|
+
def score
|
19
|
+
game_play['score']
|
20
|
+
end
|
21
|
+
|
22
|
+
def game
|
23
|
+
game_play['game_id']
|
24
|
+
end
|
25
|
+
|
26
|
+
def player
|
27
|
+
game_play['player_id']
|
28
|
+
end
|
29
|
+
|
30
|
+
def context
|
31
|
+
{
|
32
|
+
context_id: game_play['context_id'],
|
33
|
+
context_type: game_play['context_type']
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
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: 1.
|
4
|
+
version: 1.4.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: 2019-04-
|
11
|
+
date: 2019-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -183,6 +183,7 @@ files:
|
|
183
183
|
- lib/facebook/messenger/incoming/account_linking.rb
|
184
184
|
- lib/facebook/messenger/incoming/common.rb
|
185
185
|
- lib/facebook/messenger/incoming/delivery.rb
|
186
|
+
- lib/facebook/messenger/incoming/game_play.rb
|
186
187
|
- lib/facebook/messenger/incoming/message.rb
|
187
188
|
- lib/facebook/messenger/incoming/message_echo.rb
|
188
189
|
- lib/facebook/messenger/incoming/message_request.rb
|