Class: RemoteusersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/remoteusers_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/remoteusers_controller.rb', line 4

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.public_feed_url,
                                            'hub.verify'   => 'sync'})
                                                                                        
    end                                                         
  end
  
  respond_to do |format|
    format.html
  end
end