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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f470ceb2bf9c2cfa56c2d4c4b003ffd883ceb5cc
4
- data.tar.gz: 803cffcf8fcc220102f9fa146f9993255ebf2325
3
+ metadata.gz: 0e2cc74d6b64fa5e941388c38790c1ffebf748e7
4
+ data.tar.gz: 17f320705bc86ab4a6ef52c567aa2d5f52b85c92
5
5
  SHA512:
6
- metadata.gz: e80175a4e0bcba16e38853971d8627c0ee568a8a6f548f74777bdd7dd0907517776b6d04d3a1ceea2d9a55076143b90d0363049d27db641336e838210e3c2d87
7
- data.tar.gz: e0eeae58462d084f5cb5229279596b9c8b7700f9b5a26282c932521a6658087a5cfe5f04b59fd60d67a55801a5e8d0ae19a9062b26de2a45f89192fbee919d24
6
+ metadata.gz: af3e5dd50fb1ff6b5e7999118e400466128b79d9086ab58af240bb906a928a6efa52b29a531ce81ff624d0292065828246487b005b517a24495f7418fef5c8d7
7
+ data.tar.gz: 7dccae854ac850cbb48503ca90d08c6102b1a58b0b3275b2f8055be1d534528a766a3372bf25b790e50cd2889627ef9b922e07b8aa4c56cf7a94485c864b2689
@@ -1,8 +1,11 @@
1
1
  module MessengerClient
2
2
  class ListTemplate < Template
3
- def initialize(template_items, buttons = [])
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
@@ -1,3 +1,3 @@
1
1
  module MessengerClient
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: messenger_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Cruz