class FantasticRobot::Request::SendDocument

This object represents a sendDocument request

Constants

MAX_FILE_SIZE

Attributes

chat_id[RW]
document[RW]
reply_markup[RW]
reply_to_message_id[RW]

Public Class Methods

new(attributes = {}) click to toggle source
Calls superclass method FantasticRobot::Request::Base::new
# File lib/fantastic_robot/request/send_document.rb, line 15
def initialize(attributes = {})
  super(attributes)
  @method = :sendDocument
end

Private Instance Methods

file_length() click to toggle source

Function to check that the file size isn’t excesive.

# File lib/fantastic_robot/request/send_document.rb, line 23
def file_length
  if self.document.is_a?(File) && self.document.size > MAX_FILE_SIZE
    self.errors.add :document, "It's length is excesive. #{MAX_FILE_SIZE} is the limit."
    return false
  end

  return true
end