TIMELINE TIME.
This commit is contained in:
parent
bec7b96de7
commit
8cecedc53b
2 changed files with 1 additions and 20 deletions
|
|
@ -7,17 +7,7 @@ class Services::Facebook < Service
|
|||
|
||||
def post(post, url='')
|
||||
Rails.logger.debug("event=post_to_service type=facebook sender_id=#{self.user_id}")
|
||||
message = public_message(post, url)
|
||||
post_params = self.create_post_params(message)
|
||||
Faraday.post("https://graph.facebook.com/me/feed", post_params.to_param)
|
||||
end
|
||||
|
||||
def create_post_params(message)
|
||||
hash = {:message => message, :access_token => self.access_token}
|
||||
if /https?:\/\/(\S+)/ =~ message
|
||||
hash.merge!({:link => /https?:\/\/(\S+)/.match(message)[0]})
|
||||
end
|
||||
return hash
|
||||
Faraday.post("https://graph.facebook.com/me/joindiaspora:make", {:access_token => self.access_token}.to_param)
|
||||
end
|
||||
|
||||
def public_message(post, url)
|
||||
|
|
|
|||
|
|
@ -34,15 +34,6 @@ describe Services::Facebook do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#create_post_params' do
|
||||
it 'should have a link when the message has a link' do
|
||||
@service.create_post_params("http://example.com/ test message")[:link].should == "http://example.com/"
|
||||
end
|
||||
it 'should not have a link when the message has no link' do
|
||||
@service.create_post_params("test message")[:link].should == nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'finder' do
|
||||
before do
|
||||
@user2 = Factory(:user_with_aspect)
|
||||
|
|
|
|||
Loading…
Reference in a new issue