messenger_client 0.2.1 → 0.2.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/messenger_client/list_template.rb +6 -8
- 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: '048b7dac7bdc602bf58b5e0c747a6272a6d0d340'
|
4
|
+
data.tar.gz: fcec367428c48d874372df550f73203e78b78113
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dcb39d188d2c7dfcd77a2374899aff6361dbc353bc10f42e41bc588cfacf8311691dc3ee2ddf23ae5eea725bbd5ff8aa1197816fca9d53cba4a0610e7357bf7
|
7
|
+
data.tar.gz: 38f2f9cfa2a7520c8079d6d9233dccd9a0d771f35a8318db86afd0215d131bde607ae90bec9c0df891b539ae2f8b3cca92fc496744cbab3ef8e3ad78174fdc3b
|
@@ -1,11 +1,11 @@
|
|
1
1
|
module MessengerClient
|
2
2
|
class ListTemplate < Template
|
3
|
-
TEMPLATE_STYLES = %w(
|
3
|
+
TEMPLATE_STYLES = %w(LARGE COMPACT)
|
4
4
|
|
5
|
-
def initialize(template_items, buttons = [], style =
|
5
|
+
def initialize(template_items, buttons = [], style = "LARGE")
|
6
6
|
@template_items = template_items
|
7
|
-
@buttons
|
8
|
-
@style
|
7
|
+
@buttons = buttons
|
8
|
+
@style = style.upcase
|
9
9
|
end
|
10
10
|
|
11
11
|
def type
|
@@ -18,10 +18,8 @@ module MessengerClient
|
|
18
18
|
elements: @template_items.map(&:to_json),
|
19
19
|
}
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
data.merge!(top_element_style: @style)
|
24
|
-
end
|
21
|
+
raise ArgumentError, "#{@style} is not a valid template style. Your choices are #{TEMPLATE_STYLES.join(', ')}" unless TEMPLATE_STYLES.include?(@style)
|
22
|
+
data.merge!(top_element_style: @style)
|
25
23
|
|
26
24
|
data.merge!(buttons: @buttons.map(&:to_json)) if @buttons.any?
|
27
25
|
data
|