Skip to content

Commit

Permalink
blogger added & tested
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilton Garcia dos Santos Silveira committed Dec 22, 2014
1 parent 727bd6b commit 6c24a26
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/just_share.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'rest_client'

# Gem files
[:version, :string, :social_linker, :delicious, :facebook, :google_plus, :pinterest, :tumblr, :twitter].each { |lib| require "just_share/#{lib}" }
[:version, :string, :social_linker, :blogger, :delicious, :facebook, :google_plus, :pinterest, :tumblr, :twitter].each { |lib| require "just_share/#{lib}" }

# Module to have "global accessible vars to it gem scope"
module JustShare
Expand Down
14 changes: 14 additions & 0 deletions lib/just_share/blogger.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class JustShare::Blogger < JustShare::SocialLinker
def setup_attrs
# Base URL
self.domain='https://www.blogger.com'
self.path='blog_this.pyra'

# Params (only the link is working, the others are deprecated for the sharer.php & won't work)
url_param = "u=#{self.link}"
description_param = "n=#{self.message}"

# build the params
self.params = "#{url_param}&#{description_param}"
end
end
8 changes: 8 additions & 0 deletions spec/just_share/just_share_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
@google_plus_expected_url = "https://plus.google.com/share?url=#{link}"
@pinterest_expected_url = "http://pinterest.com/pin/create/bookmarklet?url=#{link}&description=#{message}&media=#{url_image}"
@tumblr_expected_url = "https://www.tumblr.com/share?u=#{link}&t=#{message}"
@blogger_expected_url = "https://www.blogger.com/blog_this.pyra?u=#{link}&n=#{message}"
end

# SetUp for each tests
Expand Down Expand Up @@ -67,5 +68,12 @@
expect(@url_generated).to be_equals @tumblr_expected_url
#expect(accessible?(@url_generated)).to be_truthy
end

it "Blogger" do
@base_hash[:social] = :blogger
@url_generated = JustShare.on(@base_hash)
expect(@url_generated).to be_equals @blogger_expected_url
#expect(accessible?(@url_generated)).to be_truthy
end
end
end

0 comments on commit 6c24a26

Please # to comment.