Module: Firefly::Share

Defined in:
lib/firefly/share.rb

Instance Method Summary collapse

Instance Method Details

#facebook(url) ⇒ Object



25
26
27
# File 'lib/firefly/share.rb', line 25

def facebook(url)
  "http://www.facebook.com/share.php?u=#{URI.escape(url)}"
end

#hyves(url, title = nil, body = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/firefly/share.rb', line 13

def hyves(url, title = nil, body = nil)
  if title.nil? || title == ""
    title = config[:hyves_title]
  end

  if body.nil? || body == ""
   body = config[:hyves_body].gsub('%short_url%', url)
  end

  "http://www.hyves.nl/profielbeheer/#{config[:hyves_path]}/?name=#{URI.escape(title.strip)}&text=#{URI.escape(body.strip)}&#{config[:hyves_args]}"
end

#twitter(url, message = nil) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/firefly/share.rb', line 3

def twitter(url, message = nil)
  status = if message.nil? || message == ""
    config[:twitter].gsub('%short_url%', url)
  else
    max_length = 140-1-url.size
    [message.strip.slice(0...max_length), url].join(' ')
  end
  "http://twitter.com/home?status=#{URI.escape(status)}" 
end