news.anand11
2012-Sep-04 09:39 UTC
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.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2012-Sep-04 10:23 UTC
Re: How to get contact list from yahoo in rails using OAuth
On 4 September 2012 10:39, news.anand11 <news.anand11-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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`Copy and paste the full error message and stack trace and show us the section of your code that it refers to. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
news.anand11
2012-Sep-04 12:23 UTC
Re: How to get contact list from yahoo in rails using OAuth
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:in `normalized_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:in
`signature_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:in `signature''
oauth (0.4.6) lib/oauth/signature.rb:23:in `sign''
oauth (0.4.6) lib/oauth/client/helper.rb:45:in `signature''
oauth (0.4.6) lib/oauth/client/helper.rb:75:in `header''
oauth (0.4.6) lib/oauth/client/net_http.rb:91:in `set_oauth_header''
oauth (0.4.6) lib/oauth/client/net_http.rb:30:in `oauth!''
oauth (0.4.6) lib/oauth/consumer.rb:224:in `sign!''
oauth (0.4.6) lib/oauth/consumer.rb:188:in `create_signed_request''
oauth (0.4.6) lib/oauth/consumer.rb:159:in `request''
oauth (0.4.6) lib/oauth/consumer.rb:194:in `token_request''
oauth (0.4.6) lib/oauth/consumer.rb:136:in `get_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:in
`show''
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:in
`process_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:in `block 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:in
`run_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:in
`process_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:in `block
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:in
`instrument''
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:in
`process_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:in `process''
actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in
`process''
actionpack (3.2.8) lib/action_controller/metal.rb:203:in `dispatch''
actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:in
`dispatch''
actionpack (3.2.8) lib/action_controller/metal.rb:246:in `block 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:in
`dispatch''
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:36:in
`call''
journey (1.0.4) lib/journey/router.rb:68:in `block in call''
journey (1.0.4) lib/journey/router.rb:56:in `each''
journey (1.0.4) lib/journey/router.rb:56:in `call''
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:600:in
`call''
omniauth (1.1.0) lib/omniauth/strategy.rb:177:in `call!''
omniauth (1.1.0) lib/omniauth/strategy.rb:157:in `call''
omniauth (1.1.0) lib/omniauth/strategy.rb:177:in `call!''
omniauth (1.1.0) lib/omniauth/strategy.rb:157:in `call''
omniauth (1.1.0) lib/omniauth/strategy.rb:177:in `call!''
omniauth (1.1.0) lib/omniauth/strategy.rb:157:in `call''
omniauth (1.1.0) lib/omniauth/builder.rb:48:in `call''
warden (1.2.1) lib/warden/manager.rb:35:in `block in call''
warden (1.2.1) lib/warden/manager.rb:34:in `catch''
warden (1.2.1) lib/warden/manager.rb:34:in `call''
actionpack (3.2.8)
lib/action_dispatch/middleware/best_standards_support.rb:17:in `call''
rack (1.4.1) lib/rack/etag.rb:23:in `call''
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call''
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:in
`call''
actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:in
`call''
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context''
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call''
actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:in
`call''
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:in
`call''
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:in
`call''
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:in
`call''
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:in `call''
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app''
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call''
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in
`call''
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call''
rack (1.4.1) lib/rack/runtime.rb:17:in `call''
activesupport (3.2.8)
lib/active_support/cache/strategy/local_cache.rb:72:in `call''
rack (1.4.1) lib/rack/lock.rb:15:in `call''
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in
`call''
railties (3.2.8) lib/rails/engine.rb:479:in `call''
railties (3.2.8) lib/rails/application.rb:223:in `call''
rack (1.4.1) lib/rack/content_length.rb:14:in `call''
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call''
rack (1.4.1) lib/rack/handler/mongrel.rb:77:in `process''
mongrel (1.2.0.pre2) lib/mongrel.rb:165:in `block in process_client''
mongrel (1.2.0.pre2) lib/mongrel.rb:164:in `each''
mongrel (1.2.0.pre2) lib/mongrel.rb:164:in `process_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
On Tue, Sep 4, 2012 at 3:53 PM, Colin Law
<clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:
> On 4 September 2012 10:39, news.anand11
<news.anand11-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > 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`
>
> Copy and paste the full error message and stack trace and show us the
> section of your code that it refers to.
>
> Colin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.