class Facebooker::Attachment

Public Instance Methods

add_flash(swfsource, imgsource, width=nil, height=nil, expanded_width=nil, expanded_height=nil) click to toggle source
# File lib/facebooker/attachment.rb, line 37
def add_flash(swfsource, imgsource, width=nil, height=nil, expanded_width=nil, expanded_height=nil)
  params={:type=>"flash",:swfsrc=>swfsource,:imgsrc=>imgsource}
  params[:width] = width unless width.nil?
  params[:height] = height unless height.nil?
  params[:expanded_width] = expanded_width unless expanded_width.nil?
  params[:expanded_height] = expanded_height unless expanded_height.nil?
  add_media(params)
end
add_image(source,href) click to toggle source
# File lib/facebooker/attachment.rb, line 25
def add_image(source,href)
  add_media({:type=>"image",:src=>source,:href=>href})
end
add_media(hash) click to toggle source
# File lib/facebooker/attachment.rb, line 20
def add_media(hash)
  @storage[:media]||=[]
  @storage[:media] << hash
end
add_mp3(source,title=nil,artist=nil,album=nil) click to toggle source
# File lib/facebooker/attachment.rb, line 29
def add_mp3(source,title=nil,artist=nil,album=nil)
  params = {:src=>source,:type=>"mp3"}
  params[:title] =  title unless title.nil?
  params[:artist] =  artist unless artist.nil?
  params[:album] =  album unless album.nil?
  add_media(params)
end
add_property(key, value) click to toggle source
# File lib/facebooker/attachment.rb, line 47
def add_property(key, value)
  @storage[:properties] ||= {}
  @storage[:properties][key] = value
end
to_hash() click to toggle source
# File lib/facebooker/attachment.rb, line 54
def to_hash
  @storage
end

Public Class Methods

hash_populating_accessor(*names) click to toggle source
# File lib/facebooker/attachment.rb, line 7
def self.hash_populating_accessor(*names)
  names.each do |name|
    define_method(name) do
      @storage[name]
    end
    define_method("#{name}=") do |val|
      @storage[name]=val
    end
  end
end
new() click to toggle source
# File lib/facebooker/attachment.rb, line 3
def initialize
  @storage = {}
end