Class: FantasticRobot::Model::Attachment::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/fantastic_robot/model/attachment/base.rb

Direct Known Subclasses

Audio, Contact, Document, Location, PhotoSize, Sticker, Video, Voice

Constant Summary

Constants inherited from Base

Base::FIELD_CONVERSIONS

Instance Method Summary collapse

Methods inherited from Base

#attributes, #initialize, #to_h

Constructor Details

This class inherits a constructor from FantasticRobot::Model::Base

Instance Method Details

#get_fileObject

Function to get the file attached (if there is any)



6
7
8
9
10
11
# File 'lib/fantastic_robot/model/attachment/base.rb', line 6

def get_file
  unless (self.file_id.blank?)
    request = FantasticRobot::Request::GetFile(file_id: self.file_id)
    response = FantasticRobot::Model::File.new(JSON.parse(request.api_call))
  end
end