Class: Viberroo::Input
- Inherits:
-
Object
- Object
- Viberroo::Input
- Defined in:
- lib/viberroo/input.rb
Overview
This class’ methods serve as declarative wrappers with predefined types for UI elements such as buttons and keyboards. Buttons can be combined with a keyboard or used in rich messages. Only basic parameters are specified in this documentation, to see all possibilities please consult official Viber API documentation.
Class Method Summary collapse
-
.keyboard(params) ⇒ Object
A keyboard that can be attached to any message.
-
.location_picker_button(params) ⇒ Object
Location picker button, gives ability to pick a location on the map.
-
.none_button(params = {}) ⇒ Object
A button that does nothing, for decoration purposes.
-
.reply_button(params) ⇒ Object
A reply button, when tapped sends it’s body as a message.
-
.share_phone_button(params) ⇒ Object
Share phone button.
-
.url_button(params) ⇒ Object
A URL button, when tapped opens specified URL.
Class Method Details
permalink .keyboard(params) ⇒ Object
A keyboard that can be attached to any message.
28 29 30 |
# File 'lib/viberroo/input.rb', line 28 def self.keyboard(params) { keyboard: { Type: 'keyboard' }.merge(params) } end |
permalink .location_picker_button(params) ⇒ Object
Not supported on desktop.
Location picker button, gives ability to pick a location on the map.
76 77 78 79 80 |
# File 'lib/viberroo/input.rb', line 76 def self.(params) { ActionType: 'location-picker', min_api_version: 3 }.merge(params) end |
permalink .none_button(params = {}) ⇒ Object
A button that does nothing, for decoration purposes.
106 107 108 |
# File 'lib/viberroo/input.rb', line 106 def self.(params = {}) { ActionType: 'none' }.merge(params) end |
permalink .reply_button(params) ⇒ Object
A reply button, when tapped sends it’s body as a message.
45 46 47 |
# File 'lib/viberroo/input.rb', line 45 def self.(params) { ActionType: 'reply' }.merge(params) end |
permalink .share_phone_button(params) ⇒ Object
Not supported on desktop.
Share phone button.
92 93 94 95 96 |
# File 'lib/viberroo/input.rb', line 92 def self.(params) { ActionType: 'share-phone', min_api_version: 3 }.merge(params) end |
permalink .url_button(params) ⇒ Object
A URL button, when tapped opens specified URL.
62 63 64 |
# File 'lib/viberroo/input.rb', line 62 def self.(params) { ActionType: 'open-url' }.merge(params) end |