Class: Telegem::Markup::ReplyBuilder

Inherits:
Object
  • Object
show all
Includes:
ReplyButtons
Defined in:
lib/markup/keyboard.rb

Instance Method Summary collapse

Methods included from ReplyButtons

#request_contact, #request_location, #request_poll, #text, #web_app

Constructor Details

#initializeReplyBuilder

Returns a new instance of ReplyBuilder.



47
48
49
50
51
52
53
54
# File 'lib/markup/keyboard.rb', line 47

def initialize
  @rows = []
  @options = {
    resize_keyboard: true,
    one_time_keyboard: false,
    selective: false
  }
end

Instance Method Details

#buildObject



75
76
77
# File 'lib/markup/keyboard.rb', line 75

def build
    ReplyKeyboard.new(@rows, @options)
end

#one_time(value = true) ⇒ Object



63
64
65
66
# File 'lib/markup/keyboard.rb', line 63

def one_time(value = true)
  @options[:one_time_keyboard] = value
  self
end

#placeholder(text) ⇒ Object



71
72
73
74
# File 'lib/markup/keyboard.rb', line 71

def placeholder(text)
  @options[:input_field_placeholder] = text
  self
end

#resize(value = true) ⇒ Object



59
60
61
62
# File 'lib/markup/keyboard.rb', line 59

def resize(value = true)
  @options[:resize_keyboard] = value
  self
end

#row(*buttons) ⇒ Object



55
56
57
58
# File 'lib/markup/keyboard.rb', line 55

def row(*buttons)
  @rows << buttons
  self
end

#selective(value = true) ⇒ Object



67
68
69
70
# File 'lib/markup/keyboard.rb', line 67

def selective(value = true)
  @options[:selective] = value
  self
end