10

खोज करते समय Contacts प्लगइन में आया।रेलवे पर रूबी में जीमेल, याहू, हॉटमेल, ट्विटर और फेसबुक संपर्क सूची लाने के लिए पता पुस्तिका लाने में मुद्दे

लेकिन उपयोग के अनुसार, रीडेमे फ़ाइल में वर्णित है। संपर्क लाने के लिए इसे उपयोगकर्ता नाम और पासवर्ड की आवश्यकता है। लेकिन यह एक अच्छा दृष्टिकोण नहीं है।

उत्तर

3

Mini FB plugin। यह मुझे उपयोगकर्ताओं के संपर्क लाने की भी अनुमति देता है। तो मैं फेसबुक के लिए इसका इस्तेमाल कर सकता हूं। Koala

FACEBOOK अद्यतन प्राप्त करने में कठिनाई फेसबुक मित्र

यहाँ मैं फेसबुक के लिए समाधान मिल गया के लिए एक और उपाय है, लेकिन मैं यह सिर्फ मुझे फेसबुक

<div id="facebook_invites" class="conclusion" style="width: 750px; text-align: center"> 
     <a id="wall_post" href="#" style="font-size: 2em;">Post on your Wall</a><br/> 
     <a id="invite_friends" href="#" style="font-size: 1.5em;">Invite your Friends</a> 
     </div> 
     <div id="fb-root"></div> 


     <script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script> 
     <script type="text/javascript"> 
      $('#wall_post').click(function() { 
      FB.init({ 
       appId:'app_id', cookie:true, 
       status:true, xfbml:true 
      }); 

      FB.ui({ method: 'feed', 
       link: 'http://localhost:3000/', 
       picture: 'http://localhost:3000/', 
       description: 'abc is cool.', 
       name: 'abc.com'}); 
      }); 

      $('#invite_friends').click(function() { 
      FB.init({ 
       appId:'app_id', cookie:true, 
       status:true, xfbml:true 
      }); 

      FB.ui({ method: 'apprequests', 
       message: 'abc is cool.'}); 
      }); 
     </script> 


के लिए दोस्तों को आमंत्रित दिखाने

Google अपडेट

google developers guide से, हम एक वर्ग "सभी संपर्कों को प्राप्त कर रहा है" है, लेकिन बीच में एक लाइन में लिखा यानी होती है: -

नोट: एक और उपयोगकर्ता के संपर्क प्राप्त कर रहा है संपर्क API के वर्तमान संस्करण द्वारा समर्थित नहीं है ।

/* 
    * Retrieve all contacts 
    */ 

    // Create the contacts service object 
    var contactsService = 
     new google.gdata.contacts.ContactsService('GoogleInc-jsguide-1.0'); 

    // The feed URI that is used for retrieving contacts 
    var feedUri = 'http://www.google.com/m8/feeds/contacts/default/full'; 
    var query = new google.gdata.contacts.ContactQuery(feedUri); 

    // Set the maximum of the result set to be 50 
    query.setMaxResults(50); 

    // callback method to be invoked when getContactFeed() returns data 
    var callback = function(result) { 

    // An array of contact entries 
    var entries = result.feed.entry; 

    // Iterate through the array of contact entries 
    for (var i = 0; i < entries.length; i++) { 
     var contactEntry = entries[i]; 

     var emailAddresses = contactEntry.getEmailAddresses(); 

     // Iterate through the array of emails belonging to a single contact entry 
     for (var j = 0; j < emailAddresses.length; j++) { 
     var emailAddress = emailAddresses[j].getAddress(); 
     PRINT('email = ' + emailAddress); 
     }  
    } 
    } 

    // Error handler 
    var handleError = function(error) { 
    PRINT(error); 
    } 

    // Submit the request using the contacts service object 
    contactsService.getContactFeed(query, callback, handleError); 

गूगल संपर्कों के लिए एक और Sever साइड समाधान: गूगल के लिए समाधान:

here से अपने client_id और client_secret प्राप्त करें। यह एक मोटा लिपि है, जो पूरी तरह से ठीक काम करता है। इसे अपनी जरूरतों के अनुसार संशोधित करें।

require 'net/http' 
    require 'net/https' 
    require 'uri' 
    require 'rexml/document' 

    class ImportController < ApplicationController 

     def authenticate 
     @title = "Google Authetication" 

     client_id = "xxxxxxxxxxxxxx.apps.googleusercontent.com" 
     google_root_url = "https://accounts.google.com/o/oauth2/auth?state=profile&redirect_uri="+googleauth_url+"&response_type=code&client_id="+client_id.to_s+"&approval_prompt=force&scope=https://www.google.com/m8/feeds/" 
     redirect_to google_root_url 
     end 

     def authorise 
     begin 
      @title = "Google Authetication" 
      token = params[:code] 
      client_id = "xxxxxxxxxxxxxx.apps.googleusercontent.com" 
      client_secret = "xxxxxxxxxxxxxx" 
      uri = URI('https://accounts.google.com/o/oauth2/token') 
      http = Net::HTTP.new(uri.host, uri.port) 
      http.use_ssl = true 
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE 
      request = Net::HTTP::Post.new(uri.request_uri) 

      request.set_form_data('code' => token, 'client_id' => client_id, 'client_secret' => client_secret, 'redirect_uri' => googleauth_url, 'grant_type' => 'authorization_code') 
      request.content_type = 'application/x-www-form-urlencoded' 
      response = http.request(request) 
      response.code 
      access_keys = ActiveSupport::JSON.decode(response.body) 

      uri = URI.parse("https://www.google.com/m8/feeds/contacts/default/full?oauth_token="+access_keys['access_token'].to_s+"&max-results=50000&alt=json") 

      http = Net::HTTP.new(uri.host, uri.port) 
      http.use_ssl = true 
      http.verify_mode = OpenSSL::SSL::VERIFY_NONE 
      request = Net::HTTP::Get.new(uri.request_uri) 
      response = http.request(request) 
      contacts = ActiveSupport::JSON.decode(response.body) 
      contacts['feed']['entry'].each_with_index do |contact,index| 

      name = contact['title']['$t'] 
      contact['gd$email'].to_a.each do |email| 
       email_address = email['address'] 
       Invite.create(:full_name => name, :email => email_address, :invite_source => "Gmail", :user_id => current_user.id) # for testing i m pushing it into database.. 
      end 

      end 
     rescue Exception => ex 
      ex.message 
     end 
     redirect_to root_path , :notice => "Invite or follow your Google contacts." 


     end 

    end 

सेटिंग्स के लिए स्क्रीनशॉट।

enter image description here

5

Gmail या आपके विशिष्ट उद्देश्य के लिए: Gmail Contacts

याहू संपर्कों के लिए, जहां तक ​​मुझे पता है, Contacts उपयोग किया जाता है। अगर किसी के पास बेहतर विकल्प है। कृपया उल्लेख करें।

ट्विटर के लिए, मैं अत्यधिक Twitter मणि की सिफारिश करता हूं।

फेसबुक के लिए, आपको पहले से ही अपना फेसबुक मणि सॉर्ट किया गया है। हालांकि, मैं व्यक्तिगत रूप से FB Graph का उपयोग करता हूं।

संपादित करें:

हम्म, मैं दस्तावेज़ पर एक नज़र होने की कोशिश की। कोई उदाहरण उल्लेख नहीं किया गया। एक उदाहरण जो GmailContacts

का उपयोग करता है कौन सा कहीं नहीं है पाया जा सकता है के लिए

नमूना देखें/authsub.rb: यद्यपि यह उल्लेख करता है। शायद लेखक को एक त्वरित ईमेल मदद कर सकता है?

ऐसा लगता है कि Contacts gem ऑनलाइन अच्छी तरह से प्रलेखित है। यदि आप अपनी परियोजना आवश्यकताओं के साथ काम करने का कोई तरीका ढूंढ सकते हैं। फिर आप इसे अन्य ईमेल प्रदाताओं के लिए सार्वभौमिक समाधान के रूप में उपयोग कर सकते हैं।

वैकल्पिक रूप से, संपर्क पुनर्प्राप्ति के लिए एक और तरीका, मुझे this मिला जो उपयोगी हो सकता है। फेसबुक लॉगिन के लिए

+0

जीमेल संपर्कों के लिए कोई उदाहरण कोड है। मैंने कोशिश की लेकिन कुछ भी नहीं मिला। –

+0

हाय मोहित, मेरा संपादन देखें –

1

जीमेल बजाय किसी भी मणि का उपयोग कर के लिए, आप एक नमूना कोड का उपयोग करना चाहिए, यह मणि एक के लायक नहीं है।

देखें मेरी नमूना यहाँ कोड - https://gist.github.com/742461

वास्तव में यहाँ एक ब्लॉग पोस्ट किया था - http://rtdptech.com/2010/12/importing-gmail-contacts-list-to-rails-application/ लेकिन मौजूदा लगता है यह पुनर्निर्देशन समस्याओं का सामना कर रहा है।

1

आपको एक ट्रैक टेबल के माध्यम से किस उपयोगकर्ता ने आमंत्रित किया है, इसका ट्रैक रखने की आवश्यकता होगी। शुरू करने के लिए यहां FB.ui जेएस डब्ल्यू/कॉलबैक है:

FB.ui({ 
    method: 'apprequests', 
    title: t, 
    message: m 
}, 
function(response) { 
    if (response) { 
    $.ajax({ 
     type: 'POST', 
     url: "/invitation_requests/create", 
     data: { "requests[]" : response.request_ids }, 
     timeout: 12500, 
     async : false, // This fixes an issue w/ IE 
     complete: function() { 
     $.cookie("latest_request_ids", response.request_ids.length); 
     window.location = "/users" 
     } 
    }); 
    } 
}); 
संबंधित मुद्दे