Module: Unbutton
- Defined in:
- lib/unbutton.rb,
lib/unbutton/version.rb
Constant Summary collapse
- VERSION =
"0.0.8"
Class Method Summary collapse
- .facebook_link(url, options = {}) ⇒ Object
- .googleplus_link(url, options = {}) ⇒ Object
- .linkedin_link(url, options) ⇒ Object
- .mailto_link(url, options = {}) ⇒ Object
- .pinterest_link(url, options) ⇒ Object
- .tumblr_link(url, options = {}) ⇒ Object
- .twitter_link(url, options = {}) ⇒ Object
Class Method Details
.facebook_link(url, options = {}) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/unbutton.rb', line 5 def self.facebook_link(url, ={}) base = "http://www.facebook.com/sharer.php" params = params = { u: url } .has_key?(:title) && params[:t] = [:title] create_url base, params end |
.googleplus_link(url, options = {}) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/unbutton.rb', line 46 def self.googleplus_link(url, ={}) base = "https://plus.google.com/share" params = { url: url } .has_key?(:title) && params[:t] = [:title] create_url base, params end |
.linkedin_link(url, options) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/unbutton.rb', line 12 def self.linkedin_link(url, ) base = "http://www.linkedin.com/shareArticle" params = params = { url: url, mini: true } .has_key?(:title) && params[:title] = [:title] .has_key?(:description) && params[:summary] = [:description] .has_key?(:source) && params[:source] = [:source] create_url base, params end |
.mailto_link(url, options = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/unbutton.rb', line 53 def self.mailto_link(url, ={}) base = "mailto:" params = { subject: 'Shared', body: url } .has_key?(:title) && params[:subject] = [:title] .has_key?(:source) && params[:subject] += " via #{[:source]}" create_url base, params end |
.pinterest_link(url, options) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/unbutton.rb', line 22 def self.pinterest_link(url, ) base = "http://pinterest.com/pin/create/button/" params = { url: url } .has_key?(:media) && params[:media] = [:media] .has_key?(:title) && params[:description] = [:title] create_url base, params end |
.tumblr_link(url, options = {}) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/unbutton.rb', line 38 def self.tumblr_link(url, ={}) base = "http://www.tumblr.com/share/link" params = { url: url } .has_key?(:title) && params[:name] = [:title] .has_key?(:description) && params[:description] = [:description] create_url base, params end |
.twitter_link(url, options = {}) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/unbutton.rb', line 30 def self.twitter_link(url, ={}) base = "http://twitter.com/intent/tweet" params = { url: url } .has_key?(:title) && params[:text] = [:title] .has_key?(:source) && params[:via] = [:source] create_url base, params end |