Ruby on Rails grabbing Yahoo contacts on "Contacts" gem - ruby-on-rails

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?

This is because Yahoo contacts uses Oauth, not BBauth: https://github.com/mislav/contacts/issues/4
The turingstudio version of the gem is more up to date and it seems to support Yahoo Oauth.
Install it using bundler:
gem "turing-contacts", :git => "git://github.com/turingstudio/contacts.git"

Related

How to start work with Gmail API in Rails 4

I would like to add Gmail to my Rails 4 app. So far I have set up everything so user can log in with Google account. I followed this guide.
Now when user tries to log in my Rails 4 app he receives such onscreen :
After "Allow" user is redirected back to my Rails 4 app.
Initializers/omioauth.rb
OmniAuth.config.logger = Rails.logger
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2, Rails.application.secrets.client_id, Rails.application.secrets.client_secret, {scope: ['email',
'https://www.googleapis.com/auth/gmail.modify'],
access_type: 'offline', client_options: {ssl: {ca_file: Rails.root.join("cacert.pem").to_s}}}
end
All authorization data from Google is located in secrets.yml.
Installed gems:
gem "omniauth-google-oauth2", "~> 0.2.1"
gem "google-api-client"
Question: What are the next steps to implement Gmail API in Rails project? How to retrieve my Gmail inbox content..
So far I haven't found complete and self-explaining guide to do so.
I found Gmail gem, but the guide is very incomplete for Rails begginers.
For example, I installed this gem and then tried to require 'gmail' in rails c . Then I received error uninitialized constance 'gmail'.
Note: I don't need full solution to my problem,but just a push to start going and I could understand idea.
Thanks in advance.
Try to check the Ruby implementation of Gmail API in the Google Documentation itself.
Just complete the steps described in the rest of this page, and you'll have a simple Ruby command-line application that makes requests to the Gmail API.
For more information, you can also check these threads:
How to access the Gmail API with Ruby
google/google-api-ruby-client
Gmail API Client Library for Ruby
Gmail API and Rails – Authorize with OAuth via Omniauth

Cookies are turned off Secure Payments PayPal requires cookies to be turned on for many of its features.

I am trying to integrate Paypal express into my spree e-commerce application
I proceed as follow:
in Gemfile:
gem 'spree_paypal_express', github: 'spree-contrib/better_spree_paypal_express', branch: '2-4-stable'
and I run this command:
bundle install
bundle exec rails g spree_paypal_express:install
I got the paypall payment method in the backend configuration panel and I add my API credentials data (username, password and signature)
I have the payPall button added to the other payment method but when i click it I got this error:
Please turn on cookies to check out
and cookies are activated in my chrome browser so why I got this??
I had the same issue as you and the solution here helped me out:
PayPal Sandbox Error: Cookies are blocked
To simplify:
Login first your developer's account here:
http://developer.paypal.com
Open another tab and login your developer's merchant account here:
https://paypalmanager.sandbox.paypal.com/apiAccess.do?subaction=api
Open another tab again and do your express checkout process.
Paypal changed it's Privacy policy last year and is using unsecured cookies (JSESSIONS) Your session information could be stolen in transit by hackers, very worrying and something Paypal is failing miserably to address- be wary. This is why Sandbox rightly blocks them.

Google Open ID and Invalid Credentials

For the past week or two we've had issues signing users via Google Oauth. The user when redirected to Google if already logged in via Gmail is redirected back to our site with the following url.
https://mywinningtrade.com/auth/failure?message=invalid_credentials&origin=https%3A%2F%2Fmywinningtrade.com%2Fauth%2Ffailure%3Fmessage%3Dinvalid_credentials%26origin%3Dhttps%253A%252F%252Fmywinningtrade.com%252Flogin%26strategy%3Dgoogle&strategy=google
Normally I would expect this to be because the account credentials are wrong, but like I said before I was already signed into Gmail.
Added on top of that is that there are times when it does work but only intermittently. I am unable to localize the event of when it happens. I've tried several different emails. The current gems we use are...
gem "oauth", "~> 0.4.7"
gem "omniauth-openid", "~> 1.0.1" # Google
Has anyone else experienced this issue or could know why this is causing it. I would post code but there has been zero change from the time the google OAuth was working till now.
This question is technically about Google OpenID solution, as opposed to OAuth.
As for the answer, it appears to me that the Google IDP issued a successful authentication statement that was not accepted by MyWinningTrade. There could be a configuration issue w/ your library, related to issue https://groups.google.com/forum/#!msg/google-federated-login-api/qXZDD7_K7jU/LfIp5JhFLAoJ
Unfortunately, from the time since last update, I am not sure if omniauth-openid is being actively maintained, so if this issue is affecting you, I hope you know how to rebuild your gem with the proper fixes. Let me know if I can help you sort out the change.

Contacts Gem not importing yahoo contacts in production environment

I am using contacts-1.2.4 for importing contacts from yahoo and gmail. The issue I am facing is that this gem is working fine on my local setup but on my production environment yahoo contacts importing is not working. It repeatedly gives authentication error. I am using Rails-3.1.1 and ruby-1.9.2 for my local and production setup.
Got it working using - https://github.com/liangzan/contacts
Now importing is working fine on production env as well.
For yahoo and gmail it is better to use https://github.com/Diego81/omnicontacts since it doesn't require people to enter their username and password.

Why I get error "Invalid merchant account"?

I want to get PayPal reports and for this reason I installed paypal-report gem.
Can someone look are my credentials are correct or for Reporting API usage I need some special account ?
I have verified bussiness account.
Here is my code:
require 'paypal/report'
api = Paypal::Report.new("my secure account MerchantID", "mypassword", "my secure account MerchantID", "PayPalUK")
puts api.daily.inspect
I also tried to enter my email instead of MerchanID, but it didn't work.
and this gives me error:
C:/Ruby193/lib/ruby/gems/1.9.1/gems/paypal-report-0.1.2/lib/paypal/report.rb:141
:in `block in request': Invalid merchant account (RuntimeError)
I tried to inspect api value, by using puts api and here is result:
puts api
//and result:
#<Paypal::Report:0x27a4310>
Can someone help me ?
Seeing 'PayPalUK' in there, I've got a suspicion the gem you're using is for PayPal Payflow services (and when it comes to reporting, that would be XML Reporting).
Seeing as you mention having a regular 'verified business account', I don't think you'd have access to Payflow API calls. Thus, no correct credentials to enter there.
What PayPal API call are you trying to use? Is it TransactionSearch you're looking for?
If so, try the ruby-paypal gem.
(Note, I haven't tested it, but it's the first one a quick Google search for "PayPal TransactionSearch gem" returned.)

Resources