How to get contact list from yahoo in rails using OAuth

I can successfully get the contacts from google using OAuth gem in
rails.
my gmail configuration is :

:google=>{
:key=>"***",
:secret=>"***",
:expose => true,
:scope=>“https://www.google.com/m8/feeds/
}

now i want to get contact from yahoo and hot mail. How to get that
contact
I have given following configuration in my oauth_consumer.rb file

:yahoo=>{
:client=>:oauth_gem,
:expose => true,
:allow_login => true,
:key=>"",
:secret=>"
",
:scope=>“https://me.yahoo.com
}

:hotmail=>{
:client=>:oauth_gem,
:expose => true,
:allow_login => true,
:key=>"",
:secret=>"
"
}

when i am trying to do same like what is done in google it gives error
like
undefined methoddowncase’ for nil:NilClass`

I have also tried contacts http://rubygems.org/gems/contacts gem but
fail
to load contacts.

On 4 September 2012 10:39, news.anand11 [email protected] wrote:

}
:key=>"**",

:secret=>"**"

}

when i am trying to do same like what is done in google it gives error like
undefined methoddowncase’ for nil:NilClass`

Copy and paste the full error message and stack trace and show us the
section of your code that it refers to.

Colin

stacktrace:

Started GET “/oauth_consumers/yahoo” for 127.0.0.1 at 2012-09-04
17:50:39
+0530
Processing by OauthConsumersController#show as HTML
Parameters: {“id”=>“yahoo”}
User Load (0.1ms) SELECT users.* FROM users WHERE users.id =
2
LIMIT 1
YahooToken Load (0.1ms) SELECT consumer_tokens.* FROM
consumer_tokens WHERE consumer_tokens.type IN (‘YahooToken’) AND
consumer_tokens.user_id = 2 LIMIT 1
Completed 500 Internal Server Error in 23ms

NoMethodError (undefined method downcase' for nil:NilClass): oauth (0.4.6) lib/oauth/request_proxy/base.rb:93:innormalized_uri’
oauth (0.4.6) lib/oauth/request_proxy/base.rb:113:in
signature_base_string' oauth (0.4.6) lib/oauth/signature/base.rb:77:insignature_base_string’
oauth (0.4.6) lib/oauth/signature/hmac/base.rb:12:in digest' oauth (0.4.6) lib/oauth/signature/base.rb:65:insignature’
oauth (0.4.6) lib/oauth/signature.rb:23:in sign' oauth (0.4.6) lib/oauth/client/helper.rb:45:insignature’
oauth (0.4.6) lib/oauth/client/helper.rb:75:in header' oauth (0.4.6) lib/oauth/client/net_http.rb:91:inset_oauth_header’
oauth (0.4.6) lib/oauth/client/net_http.rb:30:in oauth!' oauth (0.4.6) lib/oauth/consumer.rb:224:insign!’
oauth (0.4.6) lib/oauth/consumer.rb:188:in create_signed_request' oauth (0.4.6) lib/oauth/consumer.rb:159:inrequest’
oauth (0.4.6) lib/oauth/consumer.rb:194:in token_request' oauth (0.4.6) lib/oauth/consumer.rb:136:inget_request_token’
oauth-plugin (0.4.0) lib/oauth/models/consumers/token.rb:30:in
get_request_token' oauth-plugin (0.4.0) lib/oauth/controllers/consumer_controller.rb:32:inshow’
actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in
send_action' actionpack (3.2.8) lib/abstract_controller/base.rb:167:inprocess_action’
actionpack (3.2.8) lib/action_controller/metal/rendering.rb:10:in
process_action' actionpack (3.2.8) lib/abstract_controller/callbacks.rb:18:inblock
in
process_action’
activesupport (3.2.8) lib/active_support/callbacks.rb:425:in
_run__1000277956__process_action__178317870__callbacks' activesupport (3.2.8) lib/active_support/callbacks.rb:405:in__run_callback’
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in
_run_process_action_callbacks' activesupport (3.2.8) lib/active_support/callbacks.rb:81:inrun_callbacks’
actionpack (3.2.8) lib/abstract_controller/callbacks.rb:17:in
process_action' actionpack (3.2.8) lib/action_controller/metal/rescue.rb:29:inprocess_action’
actionpack (3.2.8)
lib/action_controller/metal/instrumentation.rb:30:in
block in process_action' activesupport (3.2.8) lib/active_support/notifications.rb:123:inblock
in instrument’
activesupport (3.2.8)
lib/active_support/notifications/instrumenter.rb:20:in instrument' activesupport (3.2.8) lib/active_support/notifications.rb:123:ininstrument’
actionpack (3.2.8)
lib/action_controller/metal/instrumentation.rb:29:in
process_action' actionpack (3.2.8) lib/action_controller/metal/params_wrapper.rb:207:inprocess_action’
activerecord (3.2.8)
lib/active_record/railties/controller_runtime.rb:18:in process_action' actionpack (3.2.8) lib/abstract_controller/base.rb:121:inprocess’
actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in
process' actionpack (3.2.8) lib/action_controller/metal.rb:203:indispatch’
actionpack (3.2.8)
lib/action_controller/metal/rack_delegation.rb:14:in
dispatch' actionpack (3.2.8) lib/action_controller/metal.rb:246:inblock in
action’
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in
call' actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:indispatch’
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:36:in
call' journey (1.0.4) lib/journey/router.rb:68:inblock in call’
journey (1.0.4) lib/journey/router.rb:56:in each' journey (1.0.4) lib/journey/router.rb:56:incall’
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:600:in
call' omniauth (1.1.0) lib/omniauth/strategy.rb:177:incall!’
omniauth (1.1.0) lib/omniauth/strategy.rb:157:in call' omniauth (1.1.0) lib/omniauth/strategy.rb:177:incall!’
omniauth (1.1.0) lib/omniauth/strategy.rb:157:in call' omniauth (1.1.0) lib/omniauth/strategy.rb:177:incall!’
omniauth (1.1.0) lib/omniauth/strategy.rb:157:in call' omniauth (1.1.0) lib/omniauth/builder.rb:48:incall’
warden (1.2.1) lib/warden/manager.rb:35:in block in call' warden (1.2.1) lib/warden/manager.rb:34:incatch’
warden (1.2.1) lib/warden/manager.rb:34:in call' actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:incall’
rack (1.4.1) lib/rack/etag.rb:23:in call' rack (1.4.1) lib/rack/conditionalget.rb:25:incall’
actionpack (3.2.8) lib/action_dispatch/middleware/head.rb:14:in call' actionpack (3.2.8) lib/action_dispatch/middleware/params_parser.rb:21:incall’
actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:in
call' rack (1.4.1) lib/rack/session/abstract/id.rb:205:incontext’
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in call' actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:incall’
activerecord (3.2.8) lib/active_record/query_cache.rb:64:in call' activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:incall’
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in
block in call' activesupport (3.2.8) lib/active_support/callbacks.rb:405:in_run__876948165__call__890979334__callbacks’
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in
__run_callback' activesupport (3.2.8) lib/active_support/callbacks.rb:385:in_run_call_callbacks’
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in
run_callbacks' actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:incall’
actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in
call' actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:incall’
actionpack (3.2.8)
lib/action_dispatch/middleware/debug_exceptions.rb:16:in call' actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:incall’
railties (3.2.8) lib/rails/rack/logger.rb:26:in call_app' railties (3.2.8) lib/rails/rack/logger.rb:16:incall’
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in
call' rack (1.4.1) lib/rack/methodoverride.rb:21:incall’
rack (1.4.1) lib/rack/runtime.rb:17:in call' activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:incall’
rack (1.4.1) lib/rack/lock.rb:15:in call' actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:incall’
railties (3.2.8) lib/rails/engine.rb:479:in call' railties (3.2.8) lib/rails/application.rb:223:incall’
rack (1.4.1) lib/rack/content_length.rb:14:in call' railties (3.2.8) lib/rails/rack/log_tailer.rb:17:incall’
rack (1.4.1) lib/rack/handler/mongrel.rb:77:in process' mongrel (1.2.0.pre2) lib/mongrel.rb:165:inblock in process_client’
mongrel (1.2.0.pre2) lib/mongrel.rb:164:in each' mongrel (1.2.0.pre2) lib/mongrel.rb:164:inprocess_client’
mongrel (1.2.0.pre2) lib/mongrel.rb:291:in `block (2 levels) in run’

Rendered
/home/bacancy/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_trace.erb
(1.3ms)
Rendered
/home/bacancy/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
(1.0ms)
Rendered
/home/bacancy/.rvm/gems/ruby-1.9.2-p320/gems/actionpack-3.2.8/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb
within rescues/layout (8.4ms)

Oauth controller code:

require ‘oauth/controllers/consumer_controller’

class OauthConsumersController < ApplicationController
include Oauth::Controllers::ConsumerController
before_filter :authenticate_user!, :only=>:index

def index

@consumer_tokens=ConsumerToken.all :conditions=>{:user_id=>

current_user.id}
@services=OAUTH_CREDENTIALS.keys-@consumer_tokens.collect{|c|
c.class.service_name}
end

def callback

begin
  super
  if params[:denied]
    render :denied
  end
rescue OAuth::Unauthorized
  render :denied
end

end

def client
super
end

protected

def go_back

@service = params[:id].to_s

if @service == 'google' || @service == 'twitter'
  render :authorized
else
  render :denied
end

end

def logged_in?

user_signed_in?

end

def current_user=(user)
sign_in(user)
end

end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs