Sha256: 6d3f877df9d8b04ac4fa22a2440d6448a40998ead94944084a0a8a0bdac92f7c

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

class RemoteusersController < ApplicationController
  before_filter :authenticate_user!
  
  def index
    if params[:slug].present?
      #Selecting the remote subject
      u = RemoteSubject.find_or_create_using_wslug(params[:slug])
      
      #Creating the tie between me and the remote subject
      t = Tie.create!(:sender => current_user.actor,
                      :receiver => u.actor,
                      :relation_name => "friend") 
      
      #Requesting a subscription to the hub
      t = Thread.new do
        uri = URI.parse(Social2social.hub)   
        response = Net::HTTP::post_form(uri,{ 'hub.callback' => pshb_callback_url, 
                                              'hub.mode'     => "subscribe",
                                              'hub.topic'    => u.home_feed_url,
                                              'hub.verify'   => 'sync'})
                                                                                          
      end                                                         
    end
    
    respond_to do |format|
      format.html
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
social2social-0.0.4 app/controllers/remoteusers_controller.rb
social2social-0.0.3 app/controllers/remoteusers_controller.rb