GithubHelp home page GithubHelp logo

cardmagic / contacts Goto Github PK

View Code? Open in Web Editor NEW
615.0 615.0 219.0 88 KB

A universal interface to import email contacts from various providers including Yahoo, Gmail, Hotmail, AOL and Plaxo.

Home Page: http://rubyforge.org/projects/contacts

License: BSD 3-Clause "New" or "Revised" License

Ruby 100.00%

contacts's People

Contributors

adamhunter avatar balepc avatar cardmagic avatar cluesque avatar dependabot[bot] avatar eshear avatar gf3 avatar glennfu avatar joeyaghion avatar khanhnguyen avatar lazyatom avatar onomojo avatar pimtel avatar tonytargonski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contacts's Issues

Yahoo and Aol not work in ruby 1.9.3

resp, data = http.get("#{url.path}?#{url.query}", "User-Agent" => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0", "Accept-Encoding" => "gzip", "Cookie" => cookies, "Referer" => referer )

data always return nil in ruby 1.9.3

incompatibility with ruby 1.9

When starting my app in a ruby 1.9 environment I get this issue :

/home/ror/gem/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:158:in `require': /home/ror/gem/gems/contacts-1.0.16/lib/contacts/base.rb:165: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' (SyntaxError)
/home/ror/gem/gems/contacts-1.0.16/lib/contacts/base.rb:172: syntax error, unexpected keyword_when, expecting keyword_end
when 'deflate':
^
/home/ror/gem/gems/contacts-1.0.16/lib/contacts/base.rb:172: syntax error, unexpected ':', expecting keyword_end
/home/ror/gem/gems/contacts-1.0.16/lib/contacts/base.rb:210: syntax error, unexpected keyword_end, expecting $end

Auhentication error

I tried this on console Contacts::Gmail.new('[email protected]', 'aaaa').contacts, i am getting Contacts::AuthenticationError (Username or password are incorrect) even though username and password are correct.

Not working with yahoo

c = Contacts.new(:yahoo, '***', '**')
undefined method index' for nil:NilClass from /home/pramod/.rvm/gems/ruby-1.9.3-p374/gems/contacts-1.2.4/lib/contacts/yahoo.rb:17:inreal_connect'
from /home/pramod/.rvm/gems/ruby-1.9.3-p374/gems/contacts-1.2.4/lib/contacts/base.rb:26:in connect' from /home/pramod/.rvm/gems/ruby-1.9.3-p374/gems/contacts-1.2.4/lib/contacts/base.rb:21:ininitialize'
from /home/pramod/.rvm/gems/ruby-1.9.3-p374/gems/contacts-1.2.4/lib/contacts/base.rb:202:in new' from /home/pramod/.rvm/gems/ruby-1.9.3-p374/gems/contacts-1.2.4/lib/contacts/base.rb:202:innew'
from (irb):1
from /home/pramod/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in start' from /home/pramod/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/console.rb:8:instart'
from /home/pramod/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands.rb:41:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

Yahoo! contacts not loading properly

I installed "contacts" gem on my local machine, wrote some code to get yahoo, gmail and hotmail contacts, and it was running smoothly. I moved the code to a server for testing, my gmail and hotmail contacts were still running, but Yahoo gave me the following error:

Contacts::AuthenticationError: Username and password do not match

I am sure that email and password are correct. I tried my code on another server the behavior was the same ...

Any hints?

gem jcode

Installation is complaining about the jcode gem. Troubleshooting suggests to require the jcode gem if using Ruby < 1.9

Which version of Ruby, Rails is this gem tested for?

Can we update the README?

This example code might help your users get up and running

require 'gdata'
require 'contacts'

service, login, password = ARGV[0], ARGV[1], ARGV[2]
accepted = %w(aol gmail hotmail plaxo yahoo)
if accepted.include? service
  mapped = Contacts.new(service, login, password).contacts.inject( {} ){ |xs, x| (xs[x[0]] ||= []) << x[1] unless x[1].nil?; xs}.to_a.map{ |name, emails| [name.downcase, emails.uniq.sort]}.sort
  print mapped.map{ |name, emails| "#{name}: #{emails.join(',')}" }.join( "\n" ) + "\n"
else
  print "Sorry I don't know how to access '#{service}'. It has to be one of: #{accepted.join(', ')}\n"
end

Already loaded JSON

When starting the rails server i get the following warnings:

.../json_pure-1.4.6/lib/json/common.rb:65: warning: already initialized constant State
.../json_pure-1.4.6/lib/json/common.rb:66: warning: already initialized constant SAFE_STATE_PROTOTYPE
.../json_pure-1.4.6/lib/json/common.rb:67: warning: already initialized constant FAST_STATE_PROTOTYPE
.../json_pure-1.4.6/lib/json/common.rb:74: warning: already initialized constant PRETTY_STATE_PROTOTYPE
.../json_pure-1.4.6/lib/json/pure.rb:76: warning: already initialized constant JSON_LOADED

Not grabbing all the gmail addresses

Tested against my own gmail account, which has 536 contacts. Only 165 were actually returned. I looked to see if there was a paging mechanism or built-in limitation in the code and couldn't find one, so please forgive me if I missed it.

Rails 3.1.0 issue

/usr/local/rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require': no such file to load -- jcode (LoadError)
    from /usr/local/rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /usr/local/rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /usr/local/rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /usr/local/rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /usr/local/rvm/gems/ruby-1.9.2-p180@rails31/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p180@rails31/gems/gdata-1.1.1/lib/gdata.rb:21:in `<top (required)>'

Gmail import is not working

It used to work for me but recently it is not. It looks like Gmail just changed their login mechanism. From the debugger, in real_connect method in gmail.rb, I could see that after calling post on the signin page, it didn't get thru and went back to the signin page. Any suggestion/help to fix this? Thx.

Gmail import is not working

Gmail import is not working for me with v1.0.19 of the gem.
Returns an empty array, whether I provide the correct pw or not. (Does not throw an AuthenticationError with the wrong pw, does not return data with the right pw.)

Does this gem support oauth?

It seems like from the docs this requires the user to enter the username/password, which is pretty uncommon in other sites I've seen with features like this. Thanks!

How to install

Hi All,

  • gem 'contacts' in our existing application
    
  • bundle install in our terminal and what the next steps to reach it ?
    

yahoo doesn't work

Hi, thanks for this great library. I try to retrieve contacts for a yahoo email and I get this error:

Contacts::ConnectionError: Yahoo has changed its protocols, please upgrade this library first. If that does not work, dive into the code and submit a patch at http://github.com/cardmagic/contacts
from /Library/Ruby/Gems/1.8/gems/contacts-1.2.1/lib/contacts/yahoo.rb:47:in `contacts'
from (irb):26

Here's the code:

Contacts.new(:yahoo, email, password).contacts

Thanks!

Can't fetch contacts from hotmail

Hi,

using the last 1.0.14 version, If I try to fetch my hotmail contacts (using a @live.com email address), I get this error :

>> c.contacts
NoMethodError: undefined method `[]' for nil:NilClass
  from /Library/Ruby/Gems/1.8/gems/cardmagic-contacts-1.0.14/lib/contacts/hotmail.rb:111:in `contacts'

Thanks

Contacts Just Hanging.

Hi,

I have recently installed this gem and basically when I run this in the console:

Contacts.new(:hotmail,'[email protected]','password').contacts

it hangs until I ctrl+c it. I'm running windows ruby 1.8.7 and rails 2.3.4 and my business partner is on a mac.

Any help would be greatly appreciated!

Mark

Updated version

Is there a new version out that supports ruby 1.9.3 and rails 3.2?
Who's currently managing this project now?

thanks

AOL

Hi Guys,

Thanks for a great gem. Looks like AOL recently changed their protocol. The following tests are failing for me:

  1. Error:
    test_fetch_contacts(AolContactImporterTest):
    CSV::IllegalFormatError: CSV::IllegalFormatError
    /opt/local/lib/ruby/1.8/csv.rb:607:in get_row' /opt/local/lib/ruby/1.8/csv.rb:556:ineach'
    ./unit/../../lib/contacts/aol.rb:140:in map' ./unit/../../lib/contacts/aol.rb:140:inparse'
    ./unit/../../lib/contacts/aol.rb:132:in contacts' unit/aol_contact_importer_test.rb:34:intest_fetch_contacts'

Any ideas?

Thanks.

How to print the catcha response code? Hotmail

When I try to login with my hotmail acount in production mode I get the followin error:

Captcha?ctoken=iLdMq4XbHTeTMVI7asj12nJZAbIBot867Dh7MgJSf-pv1sovBooUcma7z0tdpBoelWXgX18-75tWArgDmPT8pho5jVdTNcYftxAUpEuuGf8%3ACOey3mpQg07CLz8ATD-X5A

How I can print the catcha image for the user?

Thanks

conflict between json gem and rails json

Hello,

I am generating json with the to_json method using the :except option and I bump into this error :

TypeError: wrong argument type Hash (expected Data)

This is because contacts depends on the json gem which had a to_json method conflicting with the ActiveSupport one, as described here :

http://stackoverflow.com/questions/683989/how-do-you-deal-with-the-conflict-between-activesupportjson-and-the-json-gem

Is it possible to have contacts use the rails json functions instead ?

Thank you for contacts !

Timeout issues with AOL and Hotmail

I'm currently working on a contact importer module for my website and I'm very glad I've found the contacts gem. It works perfectly with Gmail and Yahoo! However, I got some timeout issues when I try to retrieve contacts from AOL and Hotmail email accounts.

I've tried with both official contact gem (1.2.0) and also a the latest up-to-date working release of onomojo (Brian McQuay, http://github.com/onomojo/contacts) but still experience the same problems.

Does this require any particular version of required gems?

Here is my error:

Timeout::Error (execution expired):
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:60:in rbuf_fill' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:134:inrbuf_fill'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:116:in readuntil' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/protocol.rb:126:inreadline'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:2020:in read_status_line' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:2009:inread_new'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:1050:in request' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:772:inget'
contacts (1.2.0) lib/contacts/base.rb:153:in get' contacts (1.2.0) lib/contacts/aol.rb:86:inreal_connect'
contacts (1.2.0) lib/contacts/base.rb:24:in connect' contacts (1.2.0) lib/contacts/base.rb:19:ininitialize'
contacts (1.2.0) lib/contacts/base.rb:200:in new' contacts (1.2.0) lib/contacts/base.rb:200:innew'
app/controllers/contact_import_controller.rb:32:in list' -e:2:inload'
-e:2

require "json/add/rails" breaks my Rails to_json

Hey there,

the line 3 of gmail.rb (require "json/add/rails") breaks the default "to_json" method for me. Instead of

{"artist":{"name":"artist1",bla, bla...}}

I get

{"attributes":{"name":"artist1",bla, bla...},"json_class":"Artist","attributes_cache":{}}

If I comment the above line, everything is fine.

problem with running gem

I can not seem to get this gem working. I think it is a great idea, but I'm having a lot of issues with it.

  1. I installed with rails 3.1 and Ruby 1.9.3, did not work. I then got a forked version that fixed that issue.
  2. After the above issue was fixed I got the below issue when I ran in 1.9.3 so I downgraded and got the issue again, see below.

What is causing this? How can I get this working with rails 3.1 and 1.9.3? thank you

/Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/contacts-1.2.4/lib/contacts/aol.rb:2:in require': no such file to load -- hpricot (LoadError) from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/contacts-1.2.4/lib/contacts/aol.rb:2 from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/contacts-1.2.4/lib/contacts.rb:10:inrequire'
from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/contacts-1.2.4/lib/contacts.rb:10
from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in require' from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:inrequire'
from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in each' from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:inrequire'
from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in each' from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:inrequire'
from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/bundler-1.1.3/lib/bundler.rb:119:in require' from /Users/aa/rails_projects/contacts/config/application.rb:7 from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/railties-3.2.5/lib/rails/commands.rb:39:inrequire'
from /Users/aa/.rvm/gems/ruby-1.8.7-p358/gems/railties-3.2.5/lib/rails/commands.rb:39
from script/rails:6:in `require'
from script/rails:6

Corporate Gmail addresses not supported

If you have a company on Google Apps, you can use Gmail as your email client. So the you can have [email protected], and you check it at mail.google.com/a/company.com, where you login with name: username, pass:whatever.

Currently Contacts will fail to retrieve contacts for Gmail accounts of this type.

display authentication, connection error messages of contacts gem as errors in application.

I am successfully able to import contacts using contacts gem in rails 3.1. However, I am not able to display contacts authentication or connection error messages in my application. It gives the following error message in new page:-

Contacts::AuthenticationError in SocialContactsController#import_contacts

Username and password do not match

I am using

@contacts = @sites[params[:from]].new(params[:login], params[:password]).contacts

for authenticating username and password

Contacts::Yahoo does not work consistently

About 20% of the time it returns the contacts... 80% of the time it croaks with a protocol error. Apparently even when it returns data it has some parse errors (some emails dropped, some characters carried over to the next entry.) Testing with address books of several hundred contacts. Traces below.

Thanks for merging the gdata version of the GMail importer--it would be so great if someone could rewrite this importer (and all the others) to use the supported APIs from each provider where they exist rather than screen scraping which is destine to break continuously. Look how much less code the gdata call is than trying to parse the screen! Please consider this as a priority to any other development if this gem is to have any utility in the real world.

Trace:

c = provider.provider.new( u, p ).contacts()

Contacts::ConnectionError: #<Net::HTTPInternalServerError 500 Internal Server Error readbody=true>

"\n"
from d:/dev/ruby/lib/ruby/gems/1.8/gems/contacts-1.2.1/lib/contacts/yahoo.rb:82:in contacts' from d:/dev/ruby/lib/ruby/gems/1.8/gems/contacts-1.2.1/lib/contacts/yahoo.rb:71:intimes'
from d:/dev/ruby/lib/ruby/gems/1.8/gems/contacts-1.2.1/lib/contacts/yahoo.rb:71:in `contacts'
from (irb):12
c = provider.provider.new( u, p ).contacts()

Contacts::ConnectionError: #<Net::HTTPInternalServerError 500 Internal Server Error readbody=true>

"\n"
from d:/dev/ruby/lib/ruby/gems/1.8/gems/contacts-1.2.1/lib/contacts/yahoo.rb:62:in `contacts'
from (irb):13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.