messenger_client 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/messenger_client/list_template.rb +9 -1
- data/lib/messenger_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e2cc74d6b64fa5e941388c38790c1ffebf748e7
|
4
|
+
data.tar.gz: 17f320705bc86ab4a6ef52c567aa2d5f52b85c92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af3e5dd50fb1ff6b5e7999118e400466128b79d9086ab58af240bb906a928a6efa52b29a531ce81ff624d0292065828246487b005b517a24495f7418fef5c8d7
|
7
|
+
data.tar.gz: 7dccae854ac850cbb48503ca90d08c6102b1a58b0b3275b2f8055be1d534528a766a3372bf25b790e50cd2889627ef9b922e07b8aa4c56cf7a94485c864b2689
|
@@ -1,8 +1,11 @@
|
|
1
1
|
module MessengerClient
|
2
2
|
class ListTemplate < Template
|
3
|
-
|
3
|
+
TEMPLATE_STYLES = %w(plain)
|
4
|
+
|
5
|
+
def initialize(template_items, buttons = [], style = nil)
|
4
6
|
@template_items = template_items
|
5
7
|
@buttons = buttons
|
8
|
+
@style = style
|
6
9
|
end
|
7
10
|
|
8
11
|
def type
|
@@ -15,6 +18,11 @@ module MessengerClient
|
|
15
18
|
elements: @template_items.map(&:to_json),
|
16
19
|
}
|
17
20
|
|
21
|
+
if !@style.nil?
|
22
|
+
raise ArgumentError, "#{@style} is not a valid template style" unless TEMPLATE_STYLES.include?(@style)
|
23
|
+
data.merge!(top_element_style: @style)
|
24
|
+
end
|
25
|
+
|
18
26
|
data.merge!(buttons: @buttons.map(&:to_json)) if @buttons.any?
|
19
27
|
data
|
20
28
|
end
|