bobot 3.7.3 → 3.7.6

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
- SHA1:
3
- metadata.gz: 5eaced1ce6579453fb0e8341b7da0f887447a513
4
- data.tar.gz: 1e3a895d8f890a485d1c78a77e24371e710cf41c
2
+ SHA256:
3
+ metadata.gz: 1467d4fd44a082555e17397b3d1fc46df9aa74cba99dd6321306c673a02019a1
4
+ data.tar.gz: bc68ea22e8a24379c066f75664690ad9d192392e7ca541a329175743ba94c279
5
5
  SHA512:
6
- metadata.gz: a6a5ecc9fc240af3114bc8817c5f9eeae07a3f7197ae31a16cf2e84cce5db53e6453939d6f99e1ad82c65c152e1ad2fd665a5ea8603c67e5b89632670f0fd986
7
- data.tar.gz: c6b241d738a8dec4ca9b19c45834bd03ad9894004fbddf265609cd19f2ce3323c331bf35b50acefc2931f88328709290736e411b662a3a31df32c5fb8b03e774
6
+ metadata.gz: 647b500a1c999af3bda25c1df077b6f6556ed0a6b28202551eb73052c5facef1d718423194f1ddd17ee9f308f52b763505d74f520b867614d841214ad2221e91
7
+ data.tar.gz: ba78252574a28bb087bac879c424a7fb93959f5c1d70c5645073cc00bc9c8ba28c992fa908d6ff7597eef3b39eafc7fd277a5b29675388582d7757bead4575b4
@@ -12,6 +12,7 @@ module Bobot
12
12
  referral
13
13
  message_echo
14
14
  message_request
15
+ policy-enforcement
15
16
  ].freeze
16
17
 
17
18
  include Bobot::GraphFacebook
data/lib/bobot/event.rb CHANGED
@@ -7,6 +7,7 @@ require 'bobot/events/optin'
7
7
  require 'bobot/events/read'
8
8
  require 'bobot/events/account_linking'
9
9
  require 'bobot/events/referral'
10
+ require 'bobot/events/policy_enforcement'
10
11
 
11
12
  module Bobot
12
13
  module Event
@@ -19,6 +20,7 @@ module Bobot
19
20
  'account_linking' => AccountLinking,
20
21
  'referral' => Referral,
21
22
  'message_echo' => MessageEcho,
23
+ 'policy-enforcement' => PolicyEnforcement,
22
24
  }.freeze
23
25
 
24
26
  def self.parse(payload)
@@ -29,60 +29,60 @@ module Bobot
29
29
  Time.zone.at(@messaging['timestamp'] / 1000)
30
30
  end
31
31
 
32
- def sender_action(sender_action:)
33
- page.sender_action(sender_action: sender_action, to: sender["id"])
32
+ def sender_action(sender_action:, messaging_type: "RESPONSE")
33
+ page.sender_action(sender_action: sender_action, to: sender["id"], messaging_type: messaging_type)
34
34
  end
35
35
 
36
- def show_typing(state:)
37
- page.show_typing(state: state, to: sender["id"])
36
+ def show_typing(state:, messaging_type: "RESPONSE")
37
+ page.show_typing(state: state, to: sender["id"], messaging_type: messaging_type)
38
38
  end
39
39
 
40
- def mark_as_seen
41
- page.mark_as_seen(to: sender["id"])
40
+ def mark_as_seen(messaging_type: "RESPONSE")
41
+ page.mark_as_seen(to: sender["id"], messaging_type: messaging_type)
42
42
  end
43
43
 
44
- def reply(payload_message:)
45
- page.send(payload_message: payload_message, to: sender["id"])
44
+ def reply(payload_message:, messaging_type: "RESPONSE")
45
+ page.send(payload_message: payload_message, to: sender["id"], messaging_type: messaging_type)
46
46
  end
47
47
 
48
- def reply_with_text(text:)
49
- page.send_text(text: text, to: sender["id"])
48
+ def reply_with_text(text:, messaging_type: "RESPONSE")
49
+ page.send_text(text: text, to: sender["id"], messaging_type: messaging_type)
50
50
  end
51
51
 
52
- def reply_with_youtube_video(url:)
53
- page.send_youtube_video(url: url, to: sender["id"])
52
+ def reply_with_youtube_video(url:, messaging_type: "RESPONSE")
53
+ page.send_youtube_video(url: url, to: sender["id"], messaging_type: messaging_type)
54
54
  end
55
55
 
56
- def reply_with_attachment(url:, type:)
57
- page.send_attachment(url: url, type: type, to: sender["id"])
56
+ def reply_with_attachment(url:, type:, messaging_type: "RESPONSE")
57
+ page.send_attachment(url: url, type: type, to: sender["id"], messaging_type: messaging_type)
58
58
  end
59
59
 
60
- def reply_with_image(url:)
61
- page.send_image(url: url, to: sender["id"])
60
+ def reply_with_image(url:, messaging_type: "RESPONSE")
61
+ page.send_image(url: url, to: sender["id"], messaging_type: messaging_type)
62
62
  end
63
63
 
64
- def reply_with_audio(url:)
65
- page.send_audio(url: url, to: sender["id"])
64
+ def reply_with_audio(url:, messaging_type: "RESPONSE")
65
+ page.send_audio(url: url, to: sender["id"], messaging_type: messaging_type)
66
66
  end
67
67
 
68
- def reply_with_video(url:)
69
- page.send_video(url: url, to: sender["id"])
68
+ def reply_with_video(url:, messaging_type: "RESPONSE")
69
+ page.send_video(url: url, to: sender["id"], messaging_type: messaging_type)
70
70
  end
71
71
 
72
- def reply_with_file(url:)
73
- page.send_file(url: url, to: sender["id"])
72
+ def reply_with_file(url:, messaging_type: "RESPONSE")
73
+ page.send_file(url: url, to: sender["id"], messaging_type: messaging_type)
74
74
  end
75
75
 
76
- def reply_with_quick_replies(text:, quick_replies:)
77
- page.send_quick_replies(text: text, quick_replies: quick_replies, to: sender["id"])
76
+ def reply_with_quick_replies(text:, quick_replies:, messaging_type: "RESPONSE")
77
+ page.send_quick_replies(text: text, quick_replies: quick_replies, to: sender["id"], messaging_type: messaging_type)
78
78
  end
79
79
 
80
- def reply_with_buttons(text:, buttons:)
81
- page.send_buttons(text: text, buttons: buttons, to: sender["id"])
80
+ def reply_with_buttons(text:, buttons:, messaging_type: "RESPONSE")
81
+ page.send_buttons(text: text, buttons: buttons, to: sender["id"], messaging_type: messaging_type)
82
82
  end
83
83
 
84
- def reply_with_generic(elements:, image_aspect_ratio: 'square')
85
- page.send_generic(elements: elements, image_aspect_ratio: image_aspect_ratio, to: sender["id"])
84
+ def reply_with_generic(elements:, image_aspect_ratio: 'square', messaging_type: "RESPONSE")
85
+ page.send_generic(elements: elements, image_aspect_ratio: image_aspect_ratio, to: sender["id"], messaging_type: messaging_type)
86
86
  end
87
87
  alias_method :reply_with_carousel, :reply_with_generic
88
88
 
@@ -0,0 +1,15 @@
1
+ module Bobot
2
+ module Event
3
+ class PolicyEnforcement
4
+ include Bobot::Event::Common
5
+
6
+ def action
7
+ @messaging['policy-enforcement']['action']
8
+ end
9
+
10
+ def reason
11
+ @messaging['policy-enforcement']['reason']
12
+ end
13
+ end
14
+ end
15
+ end
data/lib/bobot/page.rb CHANGED
@@ -36,9 +36,12 @@ module Bobot
36
36
 
37
37
  def deliver(payload_template:, to:)
38
38
  raise Bobot::FieldFormat.new('payload_template is required') unless payload_template.present?
39
+ raise Bobot::FieldFormat.new('payload_template[:messaging_type] is required') unless payload_template.key?(:messaging_type)
40
+ raise Bobot::FieldFormat.new('payload_template[:messaging_type] is invalid, only "RESPONSE, UPDATE, MESSAGE_TAG" are permitted.', payload_template[:messaging_type]) unless %w[RESPONSE UPDATE MESSAGE_TAG].include?(payload_template[:messaging_type])
39
41
  Bobot::Commander.deliver(
40
42
  body: {
41
43
  recipient: { id: to },
44
+ messaging_type: "RESPONSE",
42
45
  }.merge(payload_template),
43
46
  query: {
44
47
  access_token: page_access_token,
@@ -46,23 +49,23 @@ module Bobot
46
49
  )
47
50
  end
48
51
 
49
- def sender_action(sender_action:, to: nil)
50
- deliver(payload_template: { sender_action: sender_action }, to: to)
52
+ def sender_action(sender_action:, to: nil, messaging_type: "RESPONSE")
53
+ deliver(payload_template: { sender_action: sender_action, messaging_type: messaging_type }, to: to)
51
54
  end
52
55
 
53
- def show_typing(state:, to: nil)
54
- sender_action(sender_action: (state ? 'typing_on' : 'typing_off'), to: to)
56
+ def show_typing(state:, to: nil, messaging_type: "RESPONSE")
57
+ sender_action(sender_action: (state ? 'typing_on' : 'typing_off'), messaging_type: messaging_type, to: to)
55
58
  end
56
59
 
57
- def mark_as_seen(to: nil)
58
- sender_action(sender_action: 'mark_seen', to: to)
60
+ def mark_as_seen(to: nil, messaging_type: "RESPONSE")
61
+ sender_action(sender_action: 'mark_seen', messaging_type: messaging_type, to: to)
59
62
  end
60
63
 
61
- def send(payload_message:, to: nil)
62
- deliver(payload_template: { message: payload_message }, to: to)
64
+ def send(payload_message:, to: nil, messaging_type: "RESPONSE")
65
+ deliver(payload_template: { message: payload_message, messaging_type: messaging_type }, to: to)
63
66
  end
64
67
 
65
- def send_text(text:, to: nil)
68
+ def send_text(text:, to: nil, messaging_type: "RESPONSE")
66
69
  raise Bobot::FieldFormat.new('text is required') unless text.present?
67
70
  raise Bobot::FieldFormat.new('text size is limited to 640.', "#{text} (#{text.size} chars)") if text.size > 640
68
71
  send(
@@ -70,10 +73,11 @@ module Bobot
70
73
  text: text,
71
74
  },
72
75
  to: to,
76
+ messaging_type: messaging_type,
73
77
  )
74
78
  end
75
79
 
76
- def send_attachment(url:, type:, to: nil)
80
+ def send_attachment(url:, type:, to: nil, messaging_type: "RESPONSE")
77
81
  raise Bobot::FieldFormat.new('url is required') unless url.present?
78
82
  raise Bobot::FieldFormat.new('type is required') unless type.present?
79
83
  raise Bobot::FieldFormat.new('type is invalid, only "image, audio, video, file" are permitted.', type) unless %w[image audio video file].include?(type)
@@ -87,10 +91,11 @@ module Bobot
87
91
  },
88
92
  },
89
93
  to: to,
94
+ messaging_type: messaging_type,
90
95
  )
91
96
  end
92
97
 
93
- def send_youtube_video(url:, to: nil)
98
+ def send_youtube_video(url:, to: nil, messaging_type: "RESPONSE")
94
99
  raise Bobot::FieldFormat.new('url is required') unless url.present?
95
100
  raise Bobot::FieldFormat.new('url is not valid', url) unless url =~ %r{^(?:https?:\/\/)?(?:www\.)?youtu(?:\.be|be\.com)\/(?:watch\?v=)?([\w-]{10,})}
96
101
  send(
@@ -106,26 +111,27 @@ module Bobot
106
111
  },
107
112
  },
108
113
  to: to,
114
+ messaging_type: messaging_type,
109
115
  )
110
116
  end
111
117
 
112
- def send_image(url:, to: nil)
113
- send_attachment(url: url, type: 'image', to: to)
118
+ def send_image(url:, to: nil, messaging_type: "RESPONSE")
119
+ send_attachment(url: url, type: 'image', to: to, messaging_type: messaging_type)
114
120
  end
115
121
 
116
- def send_audio(url:, to: nil)
117
- send_attachment(url: url, type: 'audio', to: to)
122
+ def send_audio(url:, to: nil, messaging_type: "RESPONSE")
123
+ send_attachment(url: url, type: 'audio', to: to, messaging_type: messaging_type)
118
124
  end
119
125
 
120
- def send_video(url:, to: nil)
121
- send_attachment(url: url, type: 'video', to: to)
126
+ def send_video(url:, to: nil, messaging_type: "RESPONSE")
127
+ send_attachment(url: url, type: 'video', to: to, messaging_type: messaging_type)
122
128
  end
123
129
 
124
- def send_file(url:, to: nil)
125
- send_attachment(url: url, type: 'file', to: to)
130
+ def send_file(url:, to: nil, messaging_type: "RESPONSE")
131
+ send_attachment(url: url, type: 'file', to: to, messaging_type: messaging_type)
126
132
  end
127
133
 
128
- def send_quick_replies(text:, quick_replies:, to: nil)
134
+ def send_quick_replies(text:, quick_replies:, to: nil, messaging_type: "RESPONSE")
129
135
  raise Bobot::FieldFormat.new('text is required') unless text.present?
130
136
  raise Bobot::FieldFormat.new('text size is limited to 640.', "#{text} (#{text.size} chars)") if text.size > 640
131
137
  raise Bobot::FieldFormat.new('quick_replies are required') unless quick_replies.present?
@@ -136,10 +142,11 @@ module Bobot
136
142
  quick_replies: quick_replies,
137
143
  },
138
144
  to: to,
145
+ messaging_type: messaging_type,
139
146
  )
140
147
  end
141
148
 
142
- def send_buttons(text:, buttons:, to: nil)
149
+ def send_buttons(text:, buttons:, to: nil, messaging_type: "RESPONSE")
143
150
  raise Bobot::FieldFormat.new('text is required') unless text.present?
144
151
  raise Bobot::FieldFormat.new('text size is limited to 640.', "#{text} (#{text.size} chars)") if text.size > 640
145
152
  raise Bobot::FieldFormat.new('buttons are required') unless buttons.present?
@@ -156,10 +163,11 @@ module Bobot
156
163
  },
157
164
  },
158
165
  to: to,
166
+ messaging_type: messaging_type,
159
167
  )
160
168
  end
161
169
 
162
- def send_generic(elements:, image_aspect_ratio: 'square', to: nil)
170
+ def send_generic(elements:, image_aspect_ratio: 'square', to: nil, messaging_type: "RESPONSE")
163
171
  raise Bobot::FieldFormat.new('elements are required') if elements.nil?
164
172
  raise Bobot::FieldFormat.new('elements are limited to 10.', "#{elements.size} elements") if elements.size > 10
165
173
  raise Bobot::FieldFormat.new('image_aspect_ratio is required') if image_aspect_ratio.nil?
@@ -176,6 +184,7 @@ module Bobot
176
184
  },
177
185
  },
178
186
  to: to,
187
+ messaging_type: messaging_type,
179
188
  )
180
189
  end
181
190
  alias_method :send_carousel, :send_generic
data/lib/bobot/version.rb CHANGED
@@ -2,7 +2,7 @@ module Bobot
2
2
  class Version
3
3
  MAJOR = 3
4
4
  MINOR = 7
5
- PATCH = 3
5
+ PATCH = 6
6
6
  PRE = nil
7
7
 
8
8
  class << self
@@ -1,5 +1,4 @@
1
1
  require 'rails_helper'
2
- require 'helpers/graph_api_helpers'
3
2
 
4
3
  RSpec.describe Bobot::Event::AccountLinking do
5
4
  let :payload do
@@ -18,7 +17,7 @@ RSpec.describe Bobot::Event::AccountLinking do
18
17
  }
19
18
  end
20
19
 
21
- subject { Bobot::Event::AccountLinking.new(payload) }
20
+ subject { described_class.new(payload) }
22
21
 
23
22
  describe '.messaging' do
24
23
  it 'returns the original payload' do
@@ -76,14 +76,20 @@ RSpec.describe Bobot::Dummy do
76
76
  describe '.show_typing' do
77
77
  it 'sends a typing on indicator to the sender' do
78
78
  expect(subject.page).to receive(:deliver).with(
79
- payload_template: { sender_action: 'typing_on' },
79
+ payload_template: {
80
+ sender_action: 'typing_on',
81
+ messaging_type: 'MESSAGE',
82
+ },
80
83
  to: payload['recipient']['id'],
81
84
  )
82
85
  subject.show_typing(state: true)
83
86
  end
84
87
  it 'sends a typing on indicator to the sender' do
85
88
  expect(subject.page).to receive(:deliver).with(
86
- payload_template: { sender_action: 'typing_off' },
89
+ payload_template: {
90
+ sender_action: 'typing_off',
91
+ messaging_type: 'MESSAGE',
92
+ },
87
93
  to: payload['recipient']['id'],
88
94
  )
89
95
  subject.show_typing(state: false)
@@ -93,7 +99,10 @@ RSpec.describe Bobot::Dummy do
93
99
  describe '.mark_as_seen' do
94
100
  it 'sends a typing off indicator to the sender' do
95
101
  expect(subject.page).to receive(:deliver).with(
96
- payload_template: { sender_action: 'mark_seen' },
102
+ payload_template: {
103
+ sender_action: 'mark_seen',
104
+ messaging_type: 'MESSAGE',
105
+ },
97
106
  to: payload['recipient']['id'],
98
107
  )
99
108
  subject.mark_as_seen
@@ -103,7 +112,12 @@ RSpec.describe Bobot::Dummy do
103
112
  describe '.reply_with_text' do
104
113
  it 'replies to the sender' do
105
114
  expect(subject.page).to receive(:deliver).with(
106
- payload_template: { message: { text: 'Hello, human' } },
115
+ payload_template: {
116
+ message: {
117
+ text: 'Hello, human'
118
+ },
119
+ messaging_type: 'MESSAGE',
120
+ },
107
121
  to: payload['recipient']['id'],
108
122
  )
109
123
  subject.reply_with_text(text: 'Hello, human')
@@ -125,6 +139,7 @@ RSpec.describe Bobot::Dummy do
125
139
  },
126
140
  },
127
141
  },
142
+ messaging_type: 'MESSAGE',
128
143
  },
129
144
  to: payload['recipient']['id'],
130
145
  )
@@ -145,6 +160,7 @@ RSpec.describe Bobot::Dummy do
145
160
  },
146
161
  },
147
162
  },
163
+ messaging_type: 'MESSAGE',
148
164
  },
149
165
  to: payload['recipient']['id'],
150
166
  )
@@ -164,6 +180,7 @@ RSpec.describe Bobot::Dummy do
164
180
  },
165
181
  },
166
182
  },
183
+ messaging_type: 'MESSAGE',
167
184
  },
168
185
  to: payload['recipient']['id'],
169
186
  )
@@ -183,6 +200,7 @@ RSpec.describe Bobot::Dummy do
183
200
  },
184
201
  },
185
202
  },
203
+ messaging_type: 'MESSAGE',
186
204
  },
187
205
  to: payload['recipient']['id'],
188
206
  )
@@ -202,6 +220,7 @@ RSpec.describe Bobot::Dummy do
202
220
  },
203
221
  },
204
222
  },
223
+ messaging_type: 'MESSAGE',
205
224
  },
206
225
  to: payload['recipient']['id'],
207
226
  )
@@ -229,6 +248,7 @@ RSpec.describe Bobot::Dummy do
229
248
  }
230
249
  ]
231
250
  },
251
+ messaging_type: 'MESSAGE',
232
252
  },
233
253
  to: payload['recipient']['id'],
234
254
  )
@@ -261,6 +281,7 @@ RSpec.describe Bobot::Dummy do
261
281
  }
262
282
  ]
263
283
  },
284
+ messaging_type: 'MESSAGE',
264
285
  },
265
286
  to: payload['recipient']['id'],
266
287
  )
@@ -290,6 +311,7 @@ RSpec.describe Bobot::Dummy do
290
311
  }
291
312
  }
292
313
  },
314
+ messaging_type: 'MESSAGE',
293
315
  },
294
316
  to: payload['recipient']['id'],
295
317
  )
@@ -20,7 +20,7 @@ RSpec.describe Bobot::Event::Delivery do
20
20
  }
21
21
  end
22
22
 
23
- subject { Bobot::Event::Delivery.new(payload) }
23
+ subject { described_class.new(payload) }
24
24
 
25
25
  describe '.messaging' do
26
26
  it 'returns the original payload' do
@@ -124,7 +124,7 @@ RSpec.describe Bobot::Event::MessageEcho do
124
124
  }
125
125
  end
126
126
 
127
- subject { Bobot::Event::MessageEcho.new(payload) }
127
+ subject { described_class.new(payload) }
128
128
 
129
129
  describe '.messaging' do
130
130
  it 'returns the original payload' do
@@ -124,7 +124,7 @@ RSpec.describe Bobot::Event::Message do
124
124
  }
125
125
  end
126
126
 
127
- subject { Bobot::Event::Message.new(payload) }
127
+ subject { described_class.new(payload) }
128
128
 
129
129
  describe '.messaging' do
130
130
  it 'returns the original payload' do
@@ -254,7 +254,7 @@ RSpec.describe Bobot::Event::Message do
254
254
  expect(subject.app_id).to eq(payload['message']['app_id'])
255
255
  end
256
256
  end
257
-
257
+
258
258
  describe '.nlp' do
259
259
  it 'returns the nlp from which the message was sent' do
260
260
  expect(subject.nlp).to eq(payload['message']['nlp'])
@@ -16,7 +16,7 @@ RSpec.describe Bobot::Event::Optin do
16
16
  }
17
17
  end
18
18
 
19
- subject { Bobot::Event::Optin.new(payload) }
19
+ subject { described_class.new(payload) }
20
20
 
21
21
  describe '.messaging' do
22
22
  it 'returns the original payload' do
@@ -0,0 +1,36 @@
1
+ require 'rails_helper'
2
+
3
+ RSpec.describe Bobot::Event::PolicyEnforcement do
4
+ let :payload do
5
+ {
6
+ 'sender' => {
7
+ 'id' => '3'
8
+ },
9
+ 'recipient' => {
10
+ 'id' => '3'
11
+ },
12
+ 'timestamp' => 145_776_419_762_7,
13
+ 'policy-enforcement' => {
14
+ 'action' => 'block',
15
+ 'reason' => <<-REASON
16
+ The bot violated our Platform Policies
17
+ (https://developers.facebook.com/policy/#messengerplatform).
18
+ Common violations include sending out excessive spammy
19
+ messages or being non-functional.
20
+ REASON
21
+ }
22
+ }
23
+ end
24
+
25
+ let(:policy_enforcement) { payload['policy-enforcement'] }
26
+
27
+ subject { described_class.new(payload) }
28
+
29
+ describe '.action' do
30
+ specify { expect(subject.action).to eq(policy_enforcement['action']) }
31
+ end
32
+
33
+ describe '.reason' do
34
+ specify { expect(subject.reason).to eq(policy_enforcement['reason']) }
35
+ end
36
+ end
@@ -21,7 +21,7 @@ RSpec.describe Bobot::Event::Postback do
21
21
  }
22
22
  end
23
23
 
24
- subject { Bobot::Event::Postback.new(payload) }
24
+ subject { described_class.new(payload) }
25
25
 
26
26
  describe '.messaging' do
27
27
  it 'returns the original payload' do
@@ -17,7 +17,7 @@ RSpec.describe Bobot::Event::Read do
17
17
  }
18
18
  end
19
19
 
20
- subject { Bobot::Event::Read.new(payload) }
20
+ subject { described_class.new(payload) }
21
21
 
22
22
  describe '.messaging' do
23
23
  it 'returns the original payload' do
@@ -18,7 +18,7 @@ RSpec.describe Bobot::Event::Referral do
18
18
  }
19
19
  end
20
20
 
21
- subject { Bobot::Event::Referral.new(payload) }
21
+ subject { described_class.new(payload) }
22
22
 
23
23
  describe '.messaging' do
24
24
  it 'returns the original payload' do
@@ -99,3 +99,91 @@ ETHON: Libcurl initialized
99
99
  [GET] << {"first_name"=>"Foo", "last_name"=>"Bar"}
100
100
  [GET] >> https://graph.facebook.com/v2.11/7482355400
101
101
  [GET] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
102
+ [ActiveJob] Enqueued Bobot::CommanderJob (Job ID: 8d717947-ae22-41aa-b1f3-68ba4bc5bf1b) to Test(default) with arguments: {"sender"=>{"id"=>"2"}, "recipient"=>{"id"=>"3"}, "timestamp"=>1457764197627, "message"=>{"mid"=>"mid.1457764197618:41d102a3e1ae206a38", "seq"=>73, "text"=>"Hello, bot!"}}
103
+ ETHON: Libcurl initialized
104
+ [GET] >> https://graph.facebook.com/v2.11/2516608100
105
+ [GET] << {"first_name"=>"Foo", "last_name"=>"Bar"}
106
+ [GET] >> https://graph.facebook.com/v2.11/1123011700
107
+ [GET] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
108
+ [DELETE] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
109
+ [DELETE] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
110
+ [DELETE] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
111
+ [DELETE] << {"success"=>true}
112
+ [POST] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
113
+ [POST] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
114
+ [POST] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
115
+ [POST] << {"success"=>true}
116
+ [DELETE] >> https://graph.facebook.com/v2.11/me/messenger_profile
117
+ [DELETE] << {"result"=>"Successfully deleted Get Started button"}
118
+ [DELETE] >> https://graph.facebook.com/v2.11/me/messenger_profile
119
+ [DELETE] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
120
+ [POST] >> https://graph.facebook.com/v2.11/me/messenger_profile
121
+ [POST] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
122
+ [POST] >> https://graph.facebook.com/v2.11/me/messenger_profile
123
+ [POST] << {"result"=>"Successfully added Get Started button"}
124
+ ETHON: Libcurl initialized
125
+ [DELETE] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
126
+ [DELETE] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
127
+ [DELETE] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
128
+ [DELETE] << {"success"=>true}
129
+ [POST] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
130
+ [POST] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
131
+ [POST] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
132
+ [POST] << {"success"=>true}
133
+ [POST] >> https://graph.facebook.com/v2.11/me/messenger_profile
134
+ [POST] << {"result"=>"Successfully added Get Started button"}
135
+ [POST] >> https://graph.facebook.com/v2.11/me/messenger_profile
136
+ [POST] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
137
+ [DELETE] >> https://graph.facebook.com/v2.11/me/messenger_profile
138
+ [DELETE] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
139
+ [DELETE] >> https://graph.facebook.com/v2.11/me/messenger_profile
140
+ [DELETE] << {"result"=>"Successfully deleted Get Started button"}
141
+ [ActiveJob] Enqueued Bobot::CommanderJob (Job ID: 1d6279b4-102f-46f5-b836-eaa62a721e57) to Test(default) with arguments: {"sender"=>{"id"=>"2"}, "recipient"=>{"id"=>"3"}, "timestamp"=>1457764197627, "message"=>{"mid"=>"mid.1457764197618:41d102a3e1ae206a38", "seq"=>73, "text"=>"Hello, bot!"}}
142
+ [GET] >> https://graph.facebook.com/v2.11/5957069600
143
+ [GET] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
144
+ [GET] >> https://graph.facebook.com/v2.11/3352036800
145
+ [GET] << {"first_name"=>"Foo", "last_name"=>"Bar"}
146
+ ETHON: Libcurl initialized
147
+ [GET] >> https://graph.facebook.com/v2.11/8712021200
148
+ [GET] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
149
+ [GET] >> https://graph.facebook.com/v2.11/9630806100
150
+ [GET] << {"first_name"=>"Foo", "last_name"=>"Bar"}
151
+ [DELETE] >> https://graph.facebook.com/v2.11/me/messenger_profile
152
+ [DELETE] << {"result"=>"Successfully deleted Get Started button"}
153
+ [DELETE] >> https://graph.facebook.com/v2.11/me/messenger_profile
154
+ [DELETE] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
155
+ [POST] >> https://graph.facebook.com/v2.11/me/messenger_profile
156
+ [POST] << {"result"=>"Successfully added Get Started button"}
157
+ [POST] >> https://graph.facebook.com/v2.11/me/messenger_profile
158
+ [POST] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
159
+ [ActiveJob] Enqueued Bobot::CommanderJob (Job ID: 1fab15b0-8dd7-48a9-84c7-fc821d90eed3) to Test(default) with arguments: {"sender"=>{"id"=>"2"}, "recipient"=>{"id"=>"3"}, "timestamp"=>1457764197627, "message"=>{"mid"=>"mid.1457764197618:41d102a3e1ae206a38", "seq"=>73, "text"=>"Hello, bot!"}}
160
+ [POST] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
161
+ [POST] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
162
+ [POST] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
163
+ [POST] << {"success"=>true}
164
+ [DELETE] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
165
+ [DELETE] << {"success"=>true}
166
+ [DELETE] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
167
+ [DELETE] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
168
+ [ActiveJob] Enqueued Bobot::CommanderJob (Job ID: 66c81489-6728-4eb6-bdb2-0a601a6890c7) to Test(default) with arguments: {"sender"=>{"id"=>"2"}, "recipient"=>{"id"=>"3"}, "timestamp"=>1457764197627, "message"=>{"mid"=>"mid.1457764197618:41d102a3e1ae206a38", "seq"=>73, "text"=>"Hello, bot!"}}
169
+ ETHON: Libcurl initialized
170
+ [DELETE] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
171
+ [DELETE] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
172
+ [DELETE] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
173
+ [DELETE] << {"success"=>true}
174
+ [POST] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
175
+ [POST] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
176
+ [POST] >> https://graph.facebook.com/v2.11/page-id/subscribed_apps
177
+ [POST] << {"success"=>true}
178
+ [GET] >> https://graph.facebook.com/v2.11/9205496700
179
+ [GET] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
180
+ [GET] >> https://graph.facebook.com/v2.11/7701273000
181
+ [GET] << {"first_name"=>"Foo", "last_name"=>"Bar"}
182
+ [POST] >> https://graph.facebook.com/v2.11/me/messenger_profile
183
+ [POST] << {"result"=>"Successfully added Get Started button"}
184
+ [POST] >> https://graph.facebook.com/v2.11/me/messenger_profile
185
+ [POST] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
186
+ [DELETE] >> https://graph.facebook.com/v2.11/me/messenger_profile
187
+ [DELETE] << {"error"=>{"message"=>"Invalid OAuth access token.", "type"=>"OAuthException", "code"=>190, "fbtrace_id"=>"Hlssg2aiVlN"}}
188
+ [DELETE] >> https://graph.facebook.com/v2.11/me/messenger_profile
189
+ [DELETE] << {"result"=>"Successfully deleted Get Started button"}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bobot
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.3
4
+ version: 3.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Navid EMAD
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-27 00:00:00.000000000 Z
11
+ date: 2018-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -91,6 +91,7 @@ files:
91
91
  - lib/bobot/events/message_echo.rb
92
92
  - lib/bobot/events/message_request.rb
93
93
  - lib/bobot/events/optin.rb
94
+ - lib/bobot/events/policy_enforcement.rb
94
95
  - lib/bobot/events/postback.rb
95
96
  - lib/bobot/events/read.rb
96
97
  - lib/bobot/events/referral.rb
@@ -116,6 +117,7 @@ files:
116
117
  - spec/bobot/event/message_echo_spec.rb
117
118
  - spec/bobot/event/message_spec.rb
118
119
  - spec/bobot/event/optin_spec.rb
120
+ - spec/bobot/event/policy_enforcement_spec.rb
119
121
  - spec/bobot/event/postback_spec.rb
120
122
  - spec/bobot/event/read_spec.rb
121
123
  - spec/bobot/event/referral_spec.rb
@@ -197,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
199
  version: '0'
198
200
  requirements: []
199
201
  rubyforge_project:
200
- rubygems_version: 2.6.13
202
+ rubygems_version: 2.7.6
201
203
  signing_key:
202
204
  specification_version: 4
203
205
  summary: Facebook Messenger Bot
@@ -209,6 +211,7 @@ test_files:
209
211
  - spec/bobot/event/message_echo_spec.rb
210
212
  - spec/bobot/event/message_spec.rb
211
213
  - spec/bobot/event/optin_spec.rb
214
+ - spec/bobot/event/policy_enforcement_spec.rb
212
215
  - spec/bobot/event/postback_spec.rb
213
216
  - spec/bobot/event/read_spec.rb
214
217
  - spec/bobot/event/referral_spec.rb