module Databasedotcom::Chatter::PhotoMethods

Defines methods for entities that can have photos i.e. Users, Groups.

Public Class Methods

included(base) click to toggle source
# File lib/databasedotcom/chatter/photo_methods.rb, line 5
def self.included(base)
  base.extend ClassMethods
end

Public Instance Methods

delete_photo() click to toggle source

Deletes the photo for this resource.

# File lib/databasedotcom/chatter/photo_methods.rb, line 49
def delete_photo
  self.class.delete_photo(self.client, self.id)
  photo
end
photo() click to toggle source

Returns a Hash with urls for the small and large versions of the photo for this resource.

User.find(@client, "me").photo  #=>  {"smallPhotoUrl"=>"/small/photo/url", "largePhotoUrl"=>"/large/photo/url"}
# File lib/databasedotcom/chatter/photo_methods.rb, line 36
def photo
  self.raw_hash["photo"]
end
upload_photo(io, file_type) click to toggle source

Uploads a photo for this resource.

me = User.find(@client)
me.upload_photo(File.open("SomePicture.png"), "image/png")
# File lib/databasedotcom/chatter/photo_methods.rb, line 44
def upload_photo(io, file_type)
  self.class.upload_photo(self.client, self.id, io, file_type)
end