Class: MessageQuickly::Messaging::Element
- Defined in:
- lib/message_quickly/messaging/element.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#buttons ⇒ Object
Returns the value of attribute buttons.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#subtitle ⇒ Object
Returns the value of attribute subtitle.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #build_button(button_type) ⇒ Object
-
#initialize(params = {}) ⇒ Element
constructor
A new instance of Element.
- #to_hash ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Element
Returns a new instance of Element.
7 8 9 10 |
# File 'lib/message_quickly/messaging/element.rb', line 7 def initialize(params = {}) self. ||= [] super(params) end |
Instance Attribute Details
#buttons ⇒ Object
Returns the value of attribute buttons.
5 6 7 |
# File 'lib/message_quickly/messaging/element.rb', line 5 def @buttons end |
#image_url ⇒ Object
Returns the value of attribute image_url.
5 6 7 |
# File 'lib/message_quickly/messaging/element.rb', line 5 def image_url @image_url end |
#subtitle ⇒ Object
Returns the value of attribute subtitle.
5 6 7 |
# File 'lib/message_quickly/messaging/element.rb', line 5 def subtitle @subtitle end |
#title ⇒ Object
Returns the value of attribute title.
5 6 7 |
# File 'lib/message_quickly/messaging/element.rb', line 5 def title @title end |
Instance Method Details
#build_button(button_type) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/message_quickly/messaging/element.rb', line 12 def () case when :web_url = WebUrlButton.new when :postback = PostbackButton.new when :account_link = AccountLinkButton.new end << .tap { || yield } end |
#to_hash ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/message_quickly/messaging/element.rb', line 24 def to_hash { title: title, image_url: image_url, subtitle: subtitle, buttons: .collect { || .to_hash } } end |