bobot 3.6.3 → 3.7.2
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/lib/bobot/buttons.rb +31 -31
- data/lib/bobot/configuration.rb +1 -1
- data/lib/bobot/events/common.rb +9 -0
- data/lib/bobot/events/message.rb +1 -1
- data/lib/bobot/exceptions.rb +2 -8
- data/lib/bobot/page.rb +34 -34
- data/lib/bobot/version.rb +2 -2
- data/spec/bobot/event/common_spec.rb +10 -0
- 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: 6c99e1858ab5920d04639c1ac7231851463efd12
|
4
|
+
data.tar.gz: 6b11a790f7161b698050b77b2bbeb89f3e6a5c7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 427c44cb577011eab720a2fcd4672a187bffbde09041dbc4e6dfd2f9a5dbd662330a97deaed0020b13f64f07b0bd80fa731434cbfc0cc2efe75a5a98f267eeb0
|
7
|
+
data.tar.gz: f01481c7cd962c33c1cf9973b2c33ff91f5af93f42406480dd81e3ed6ba7c261abcaf4c47a406045136ca3b9fb42dddd96f57d6dd5b9ca09ac4a77cf22b2eb29
|
data/lib/bobot/buttons.rb
CHANGED
@@ -12,11 +12,11 @@ module Bobot
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.postback(title:, payload:)
|
15
|
-
raise Bobot::FieldFormat.new('title is required
|
16
|
-
raise Bobot::FieldFormat.new('title
|
17
|
-
raise Bobot::FieldFormat.new('payload is required
|
15
|
+
raise Bobot::FieldFormat.new('title is required') unless title.present?
|
16
|
+
raise Bobot::FieldFormat.new('title size is limited to 20', "#{title} (#{title.size} chars)") if title.size > 20
|
17
|
+
raise Bobot::FieldFormat.new('payload is required') unless payload.present?
|
18
18
|
payload = Bobot::Buttons.encode_payload(payload: payload)
|
19
|
-
raise Bobot::FieldFormat.new('payload
|
19
|
+
raise Bobot::FieldFormat.new('payload size is limited to 1000', "#{payload.size} chars") if payload.size > 1000
|
20
20
|
{
|
21
21
|
type: 'postback',
|
22
22
|
title: title,
|
@@ -25,10 +25,10 @@ module Bobot
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.generic_element(title:, subtitle: nil, image_url: nil, default_action_url: nil, buttons: nil)
|
28
|
-
raise Bobot::FieldFormat.new('title is required
|
29
|
-
raise Bobot::FieldFormat.new('title
|
30
|
-
raise Bobot::FieldFormat.new('subtitle
|
31
|
-
raise Bobot::FieldFormat.new('buttons are limited to 3.
|
28
|
+
raise Bobot::FieldFormat.new('title is required') unless title.present?
|
29
|
+
raise Bobot::FieldFormat.new('title size is limited to 80', "#{title} (#{title.size} chars)") if title.size > 80
|
30
|
+
raise Bobot::FieldFormat.new('subtitle size is limited to 80', "#{subtitle} (#{subtitle.size} chars)") if subtitle.present? && subtitle.size > 80
|
31
|
+
raise Bobot::FieldFormat.new('buttons are limited to 3', buttons.size) if buttons.present? && buttons.size > 3
|
32
32
|
{
|
33
33
|
title: title,
|
34
34
|
}.tap do |properties|
|
@@ -51,11 +51,11 @@ module Bobot
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def self.quick_reply_text(title:, payload:, image_url: nil)
|
54
|
-
raise Bobot::FieldFormat.new('title is required
|
55
|
-
raise Bobot::FieldFormat.new('title
|
56
|
-
raise Bobot::FieldFormat.new('payload is required
|
54
|
+
raise Bobot::FieldFormat.new('title is required') unless title.present?
|
55
|
+
raise Bobot::FieldFormat.new('title size is limited to 20', "#{title} (#{title.size} chars)") if title.size > 20
|
56
|
+
raise Bobot::FieldFormat.new('payload is required') unless payload.present?
|
57
57
|
payload = Bobot::Buttons.encode_payload(payload: payload)
|
58
|
-
raise Bobot::FieldFormat.new('payload
|
58
|
+
raise Bobot::FieldFormat.new('payload size is limited to 1000', "#{payload.size} chars") if payload.size > 1000
|
59
59
|
{
|
60
60
|
content_type: 'text',
|
61
61
|
title: title,
|
@@ -72,12 +72,12 @@ module Bobot
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def self.share_custom(title:, subtitle:, image_url:, web_url:, button_title:, image_aspect_ratio: "square")
|
75
|
-
raise Bobot::FieldFormat.new('title is required
|
76
|
-
raise Bobot::FieldFormat.new('title
|
77
|
-
raise Bobot::FieldFormat.new('subtitle is required
|
78
|
-
raise Bobot::FieldFormat.new('subtitle
|
79
|
-
raise Bobot::FieldFormat.new('button_title is required
|
80
|
-
raise Bobot::FieldFormat.new('button_title
|
75
|
+
raise Bobot::FieldFormat.new('title is required') unless title.present?
|
76
|
+
raise Bobot::FieldFormat.new('title size is limited to 80', "#{title} (#{title.size} chars)") if title.size > 80
|
77
|
+
raise Bobot::FieldFormat.new('subtitle is required') unless subtitle.present?
|
78
|
+
raise Bobot::FieldFormat.new('subtitle size is limited to 80', "#{subtitle} (#{subtitle.size} chars)") if subtitle.size > 80
|
79
|
+
raise Bobot::FieldFormat.new('button_title is required') unless button_title.present?
|
80
|
+
raise Bobot::FieldFormat.new('button_title size is limited to 20', "#{button_title} (#{button_title.size} chars)") if button_title.size > 20
|
81
81
|
{
|
82
82
|
type: 'element_share',
|
83
83
|
share_contents: {
|
@@ -111,12 +111,12 @@ module Bobot
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def self.default_action_url(url:, options: {})
|
114
|
-
raise Bobot::FieldFormat.new('url is required
|
114
|
+
raise Bobot::FieldFormat.new('url is required') unless url.present?
|
115
115
|
if options.key?(:messenger_extensions) && options[:messenger_extensions] && !url.include?('https')
|
116
|
-
raise Bobot::FieldFormat.new('must use url HTTPS protocol if messenger_extensions is true.')
|
116
|
+
raise Bobot::FieldFormat.new('must use url HTTPS protocol if messenger_extensions is true.', url)
|
117
117
|
end
|
118
118
|
if options.key?(:webview_height_ratio) && !%w[compact tall full].include?(options[:webview_height_ratio])
|
119
|
-
raise Bobot::FieldFormat.new('invalid webview_height_ratio, only "compact, tall, full" are permitted.')
|
119
|
+
raise Bobot::FieldFormat.new('invalid webview_height_ratio, only "compact, tall, full" are permitted.', options[:webview_height_ratio])
|
120
120
|
end
|
121
121
|
{
|
122
122
|
type: 'web_url',
|
@@ -130,14 +130,14 @@ module Bobot
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def self.url(title:, url:, options: {})
|
133
|
-
raise Bobot::FieldFormat.new('title is required
|
134
|
-
raise Bobot::FieldFormat.new('title
|
135
|
-
raise Bobot::FieldFormat.new('url is required
|
133
|
+
raise Bobot::FieldFormat.new('title is required') unless title.present?
|
134
|
+
raise Bobot::FieldFormat.new('title size is limited to 20', "#{title} (#{title.size} chars)") if title.size > 20
|
135
|
+
raise Bobot::FieldFormat.new('url is required') unless url.present?
|
136
136
|
if options.key?(:messenger_extensions) && options[:messenger_extensions] && !url.include?('https')
|
137
|
-
raise Bobot::FieldFormat.new('must use url HTTPS protocol if messenger_extensions is true.')
|
137
|
+
raise Bobot::FieldFormat.new('must use url HTTPS protocol if messenger_extensions is true.', url)
|
138
138
|
end
|
139
139
|
if options.key?(:webview_height_ratio) && !%w[compact tall full].include?(options[:webview_height_ratio])
|
140
|
-
raise Bobot::FieldFormat.new('invalid webview_height_ratio, only "compact, tall, full" are permitted.')
|
140
|
+
raise Bobot::FieldFormat.new('invalid webview_height_ratio, only "compact, tall, full" are permitted.', options[:webview_height_ratio])
|
141
141
|
end
|
142
142
|
{
|
143
143
|
type: 'web_url',
|
@@ -153,11 +153,11 @@ module Bobot
|
|
153
153
|
|
154
154
|
REGEX_PHONE_NUMBER = /\A(?:\+)(?:\d{1,3}\s*-?)?\(?(?:\d{3})?\)?[- ]?\d{3}[- ]?\d{4}\z/
|
155
155
|
def self.call(title:, payload:)
|
156
|
-
raise Bobot::FieldFormat.new('title is required
|
157
|
-
raise Bobot::FieldFormat.new('title
|
158
|
-
raise Bobot::FieldFormat.new('payload is required
|
159
|
-
raise Bobot::FieldFormat.new('payload has to be only a string') unless payload.is_a?(String)
|
160
|
-
raise Bobot::FieldFormat.new('payload has to start with a "+" and be a valid phone number') unless REGEX_PHONE_NUMBER =~ payload
|
156
|
+
raise Bobot::FieldFormat.new('title is required') unless title.present?
|
157
|
+
raise Bobot::FieldFormat.new('title size is limited to 20', "#{title} (#{title.size} chars)") if title.size > 20
|
158
|
+
raise Bobot::FieldFormat.new('payload is required') unless payload.present?
|
159
|
+
raise Bobot::FieldFormat.new('payload has to be only a string', payload.class.to_s) unless payload.is_a?(String)
|
160
|
+
raise Bobot::FieldFormat.new('payload has to start with a "+" and be a valid phone number', payload) unless REGEX_PHONE_NUMBER =~ payload
|
161
161
|
{
|
162
162
|
type: 'phone_number',
|
163
163
|
title: title,
|
data/lib/bobot/configuration.rb
CHANGED
data/lib/bobot/events/common.rb
CHANGED
@@ -16,6 +16,15 @@ module Bobot
|
|
16
16
|
@messaging['recipient']
|
17
17
|
end
|
18
18
|
|
19
|
+
# If the user responds to your message, the appropriate event
|
20
|
+
# (messages, messaging_postbacks, etc.) will be sent to your webhook,
|
21
|
+
# with a prior_message object appended. The prior_message object
|
22
|
+
# includes the source of the message the user is responding to, as well
|
23
|
+
# as the user_ref used for the original message send.
|
24
|
+
def prior_message
|
25
|
+
@messaging['prior_message']
|
26
|
+
end
|
27
|
+
|
19
28
|
def sent_at
|
20
29
|
Time.zone.at(@messaging['timestamp'] / 1000)
|
21
30
|
end
|
data/lib/bobot/events/message.rb
CHANGED
data/lib/bobot/exceptions.rb
CHANGED
@@ -2,15 +2,9 @@ module Bobot
|
|
2
2
|
# Base Facebook Messenger exception.
|
3
3
|
class Error < ::StandardError; end
|
4
4
|
|
5
|
-
class InvalidParameter < ::ArgumentError
|
6
|
-
def initialize(name, description = "")
|
7
|
-
super("invalid value of parameter #{name}#{description.present? ? ": '#{description}'" : ''}")
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
5
|
class FieldFormat < ::ArgumentError
|
12
|
-
def initialize(description)
|
13
|
-
super("
|
6
|
+
def initialize(description, value = nil)
|
7
|
+
super("#{description}#{value.present? ? " : #{value}'" : ''}")
|
14
8
|
end
|
15
9
|
end
|
16
10
|
|
data/lib/bobot/page.rb
CHANGED
@@ -35,7 +35,7 @@ module Bobot
|
|
35
35
|
#####################################
|
36
36
|
|
37
37
|
def deliver(payload_template:, to:)
|
38
|
-
raise Bobot::FieldFormat.new('payload_template is required
|
38
|
+
raise Bobot::FieldFormat.new('payload_template is required') unless payload_template.present?
|
39
39
|
Bobot::Commander.deliver(
|
40
40
|
body: {
|
41
41
|
recipient: { id: to },
|
@@ -63,8 +63,8 @@ module Bobot
|
|
63
63
|
end
|
64
64
|
|
65
65
|
def send_text(text:, to: nil)
|
66
|
-
raise Bobot::FieldFormat.new('text is required
|
67
|
-
raise Bobot::FieldFormat.new('text
|
66
|
+
raise Bobot::FieldFormat.new('text is required') unless text.present?
|
67
|
+
raise Bobot::FieldFormat.new('text size is limited to 640.', "#{text} (#{text.size} chars)") if text.size > 640
|
68
68
|
send(
|
69
69
|
payload_message: {
|
70
70
|
text: text,
|
@@ -74,9 +74,9 @@ module Bobot
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def send_attachment(url:, type:, to: nil)
|
77
|
-
raise Bobot::FieldFormat.new('url is required
|
78
|
-
raise Bobot::FieldFormat.new('type is required
|
79
|
-
raise Bobot::FieldFormat.new('type is invalid, only "image, audio, video, file" are permitted.') unless %w[image audio video file].include?(type)
|
77
|
+
raise Bobot::FieldFormat.new('url is required') unless url.present?
|
78
|
+
raise Bobot::FieldFormat.new('type is required') unless type.present?
|
79
|
+
raise Bobot::FieldFormat.new('type is invalid, only "image, audio, video, file" are permitted.', type) unless %w[image audio video file].include?(type)
|
80
80
|
send(
|
81
81
|
payload_message: {
|
82
82
|
attachment: {
|
@@ -107,10 +107,10 @@ module Bobot
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def send_quick_replies(text:, quick_replies:, to: nil)
|
110
|
-
raise Bobot::FieldFormat.new('text is required
|
111
|
-
raise Bobot::FieldFormat.new('text
|
112
|
-
raise Bobot::FieldFormat.new('quick_replies are required
|
113
|
-
raise Bobot::FieldFormat.new('quick_replies are limited to 11.') if quick_replies.size > 11
|
110
|
+
raise Bobot::FieldFormat.new('text is required') unless text.present?
|
111
|
+
raise Bobot::FieldFormat.new('text size is limited to 640.', "#{text} (#{text.size} chars)") if text.size > 640
|
112
|
+
raise Bobot::FieldFormat.new('quick_replies are required') unless quick_replies.present?
|
113
|
+
raise Bobot::FieldFormat.new('quick_replies are limited to 11.', "#{quick_replies.size} quick replies") if quick_replies.size > 11
|
114
114
|
send(
|
115
115
|
payload_message: {
|
116
116
|
text: text,
|
@@ -121,10 +121,10 @@ module Bobot
|
|
121
121
|
end
|
122
122
|
|
123
123
|
def send_buttons(text:, buttons:, to: nil)
|
124
|
-
raise Bobot::FieldFormat.new('text is required
|
125
|
-
raise Bobot::FieldFormat.new('text
|
126
|
-
raise Bobot::FieldFormat.new('buttons are required
|
127
|
-
raise Bobot::FieldFormat.new('buttons are limited to 3.
|
124
|
+
raise Bobot::FieldFormat.new('text is required') unless text.present?
|
125
|
+
raise Bobot::FieldFormat.new('text size is limited to 640.', "#{text} (#{text.size} chars)") if text.size > 640
|
126
|
+
raise Bobot::FieldFormat.new('buttons are required') unless buttons.present?
|
127
|
+
raise Bobot::FieldFormat.new('buttons are limited to 3', "#{buttons.size} buttons") if buttons.size > 3
|
128
128
|
send(
|
129
129
|
payload_message: {
|
130
130
|
attachment: {
|
@@ -141,10 +141,10 @@ module Bobot
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def send_generic(elements:, image_aspect_ratio: 'square', to: nil)
|
144
|
-
raise Bobot::FieldFormat.new('elements are required
|
145
|
-
raise Bobot::FieldFormat.new('elements are limited to 10.') if elements.size > 10
|
146
|
-
raise Bobot::FieldFormat.new('image_aspect_ratio is required
|
147
|
-
raise Bobot::FieldFormat.new('image_aspect_ratio is invalid, only "square, horizontal" are permitted.') unless %w[square horizontal].include?(image_aspect_ratio)
|
144
|
+
raise Bobot::FieldFormat.new('elements are required') if elements.nil?
|
145
|
+
raise Bobot::FieldFormat.new('elements are limited to 10.', "#{elements.size} elements") if elements.size > 10
|
146
|
+
raise Bobot::FieldFormat.new('image_aspect_ratio is required') if image_aspect_ratio.nil?
|
147
|
+
raise Bobot::FieldFormat.new('image_aspect_ratio is invalid, only "square, horizontal" are permitted.', image_aspect_ratio) unless %w[square horizontal].include?(image_aspect_ratio)
|
148
148
|
send(
|
149
149
|
payload_message: {
|
150
150
|
attachment: {
|
@@ -176,8 +176,8 @@ module Bobot
|
|
176
176
|
|
177
177
|
## == Subcribe your bot to your page ==
|
178
178
|
def subscribe_to_facebook_page!
|
179
|
-
raise Bobot::
|
180
|
-
raise Bobot::
|
179
|
+
raise Bobot::FieldFormat.new("page_id is required") unless page_id.present?
|
180
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
181
181
|
Bobot::Subscription.set(
|
182
182
|
query: {
|
183
183
|
page_id: page_id,
|
@@ -188,8 +188,8 @@ module Bobot
|
|
188
188
|
|
189
189
|
## == Unsubcribe your bot from your page ==
|
190
190
|
def unsubscribe_to_facebook_page!
|
191
|
-
raise Bobot::
|
192
|
-
raise Bobot::
|
191
|
+
raise Bobot::FieldFormat.new("page_id is required") unless page_id.present?
|
192
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
193
193
|
Bobot::Subscription.unset(
|
194
194
|
query: {
|
195
195
|
page_id: page_id,
|
@@ -200,7 +200,7 @@ module Bobot
|
|
200
200
|
|
201
201
|
## == Set bot description (only displayed on first time). ==
|
202
202
|
def set_greeting_text!
|
203
|
-
raise Bobot::
|
203
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
204
204
|
greeting_texts = []
|
205
205
|
if language.nil?
|
206
206
|
# Default text
|
@@ -222,7 +222,7 @@ module Bobot
|
|
222
222
|
if greeting_texts.present?
|
223
223
|
greeting_texts.each do |greeting_text|
|
224
224
|
if greeting_text[:text].present? && greeting_text[:text].size > 160
|
225
|
-
raise Bobot::FieldFormat.new('greeting text for locale #{greeting_text[:locale]} is limited to 160.', greeting_text[:text])
|
225
|
+
raise Bobot::FieldFormat.new('greeting text for locale #{greeting_text[:locale]} is limited to 160.', "#{greeting_text[:text]} (#{greeting_text[:text].size} chars)")
|
226
226
|
end
|
227
227
|
end
|
228
228
|
Bobot::Profile.set(
|
@@ -233,7 +233,7 @@ module Bobot
|
|
233
233
|
end
|
234
234
|
|
235
235
|
def unset_greeting_text!
|
236
|
-
raise Bobot::
|
236
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
237
237
|
Bobot::Profile.unset(
|
238
238
|
body: { fields: %w[greeting] },
|
239
239
|
query: { access_token: page_access_token },
|
@@ -244,8 +244,8 @@ module Bobot
|
|
244
244
|
## == Some features like Messenger Extensions and Checkbox Plugin require ==
|
245
245
|
## == a page to specify a domain whitelist. ==
|
246
246
|
def set_whitelist_domains!
|
247
|
-
raise Bobot::
|
248
|
-
raise Bobot::
|
247
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
248
|
+
raise Bobot::FieldFormat.new("Bobot.config.domains is required") unless Bobot.config.domains.present?
|
249
249
|
Bobot::Profile.set(
|
250
250
|
body: { whitelisted_domains: Bobot.config.domains },
|
251
251
|
query: { access_token: page_access_token },
|
@@ -253,7 +253,7 @@ module Bobot
|
|
253
253
|
end
|
254
254
|
|
255
255
|
def unset_whitelist_domains!
|
256
|
-
raise Bobot::
|
256
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
257
257
|
Bobot::Profile.unset(
|
258
258
|
body: { fields: ["whitelisted_domains"] },
|
259
259
|
query: { access_token: page_access_token },
|
@@ -264,8 +264,8 @@ module Bobot
|
|
264
264
|
## == the Get Started button. Before doing it you should check to select the ==
|
265
265
|
## == messaging_postbacks field when setting up your webhook. ==
|
266
266
|
def set_get_started_button!
|
267
|
-
raise Bobot::
|
268
|
-
raise Bobot::
|
267
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
268
|
+
raise Bobot::FieldFormat.new("get_started_payload is required") unless get_started_payload.present?
|
269
269
|
Bobot::Profile.set(
|
270
270
|
body: { get_started: { payload: get_started_payload } },
|
271
271
|
query: { access_token: page_access_token },
|
@@ -273,7 +273,7 @@ module Bobot
|
|
273
273
|
end
|
274
274
|
|
275
275
|
def unset_get_started_button!
|
276
|
-
raise Bobot::
|
276
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
277
277
|
Bobot::Profile.unset(
|
278
278
|
body: { fields: %w[persistent_menu get_started] },
|
279
279
|
query: { access_token: page_access_token },
|
@@ -284,7 +284,7 @@ module Bobot
|
|
284
284
|
## == If you want to have a persistent menu, you have to set get_started ==
|
285
285
|
## == button before. ==
|
286
286
|
def set_persistent_menu!
|
287
|
-
raise Bobot::
|
287
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
288
288
|
persistent_menus = []
|
289
289
|
# Default text
|
290
290
|
if language.nil?
|
@@ -322,7 +322,7 @@ module Bobot
|
|
322
322
|
if persistent_menus.present?
|
323
323
|
persistent_menus.each do |persistent_menu|
|
324
324
|
if persistent_menu[:title].present? && persistent_menu[:title].size > 30
|
325
|
-
raise Bobot::FieldFormat.new('persistent menu text for locale #{persistent_menu[:locale]} is limited to 30.', persistent_menu[:title])
|
325
|
+
raise Bobot::FieldFormat.new('persistent menu text for locale #{persistent_menu[:locale]} is limited to 30.', "#{persistent_menu[:title]} (#{persistent_menu[:title].size} chars)")
|
326
326
|
end
|
327
327
|
end
|
328
328
|
Bobot::Profile.set(
|
@@ -333,7 +333,7 @@ module Bobot
|
|
333
333
|
end
|
334
334
|
|
335
335
|
def unset_persistent_menu!
|
336
|
-
raise Bobot::
|
336
|
+
raise Bobot::FieldFormat.new("access_token is required") unless page_access_token.present?
|
337
337
|
Bobot::Profile.unset(
|
338
338
|
body: { fields: ["persistent_menu"] },
|
339
339
|
query: { access_token: page_access_token },
|
data/lib/bobot/version.rb
CHANGED
@@ -30,6 +30,10 @@ RSpec.describe Bobot::Dummy do
|
|
30
30
|
'url' => 'https://www.example.com/1.jpg'
|
31
31
|
}
|
32
32
|
}]
|
33
|
+
},
|
34
|
+
'prior_message' => {
|
35
|
+
'source' => 'checkbox_plugin',
|
36
|
+
'identifier' => '903dac41-0976-467f-805e-ed58dc23a783'
|
33
37
|
}
|
34
38
|
}
|
35
39
|
end
|
@@ -57,6 +61,12 @@ RSpec.describe Bobot::Dummy do
|
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
64
|
+
describe '.prior_message' do
|
65
|
+
it 'returns the message' do
|
66
|
+
expect(subject.prior_message).to eq(payload['prior_message'])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
60
70
|
describe '.sent_at' do
|
61
71
|
it 'returns when the message was sent' do
|
62
72
|
expect(subject.sent_at).to eq(Time.zone.at(payload['timestamp'] / 1000))
|
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.
|
4
|
+
version: 3.7.2
|
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-
|
11
|
+
date: 2018-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|