Module: TelegramBotApi::Requests::Base::InstanceMethods

Defined in:
lib/telegram_bot_api/requests/base.rb

Instance Method Summary collapse

Instance Method Details

#endpoint_urlObject

For convenience



31
32
33
# File 'lib/telegram_bot_api/requests/base.rb', line 31

def endpoint_url
  self.class.endpoint_url
end

#errorsObject



23
24
25
26
27
# File 'lib/telegram_bot_api/requests/base.rb', line 23

def errors
  self.class.mandatory_arguments.select do |argument|
    self.public_send(argument).nil?
  end
end

#to_jsonObject



13
14
15
16
17
# File 'lib/telegram_bot_api/requests/base.rb', line 13

def to_json
  self.class.all_arguments.inject({}) do |memo, argument|
    memo.merge!({ argument => self.public_send(argument) })
  end
end

#valid?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/telegram_bot_api/requests/base.rb', line 19

def valid?
  errors.empty?
end

#verbObject



35
36
37
# File 'lib/telegram_bot_api/requests/base.rb', line 35

def verb
  self.class.verb
end