Google Analytic with grub gives me 404 error. - ruby-on-rails

I am beginner to ror development.I am developing small RoR application in which i want to integrate Google analytic. I am using Garb gem for thid
According to gem I used
Garb::Session.login(username, password)// for initial session setup
after that select proper profile
profile = Garb::Management::Profile.all.detect {|p| p.web_property_id == 'UA-XXXXXXX-X'}
but when I tried to get the data it gives me error
Exits.results(profile, :filters => {:page_path.eql => '/'})
// error
Error 404 (Not Found)!!1
The requested URL /analytics/feeds/accounts/default was not found on this server.
How to solve this problem is there any way to handle this situation. Or whether I am doind something wrong?
Need Help.... Thank you.....

Related

Creating an asset in Azure Media Services

I am trying to create an asset in Azure from within my MVC 5 Web App and it is failing.
IAsset asset = context.Assets.Create("anynameyouwant", AssetCreationOptions.None);
IAccessPolicy writePolicy = context.AccessPolicies
.Create("writePolicy", TimeSpan.FromMinutes(120), AccessPermissions.Write);
ILocator destinationLocator = context.Locators
.CreateLocator(LocatorType.Sas, asset, writePolicy);
My stack trace indicates that it's a issue with creating a token.
at Microsoft.WindowsAzure.MediaServices.Client.MediaServicesCredentials.<>c__DisplayClass9.<RefreshToken>b__4()
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.<ExecuteAction>b__0()
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction(Action action)
at Microsoft.WindowsAzure.MediaServices.Client.MediaServicesCredentials.RefreshToken()
at Microsoft.WindowsAzure.MediaServices.Client.OAuth.OAuthDataServiceAdapter.RefreshToken()
at Microsoft.WindowsAzure.MediaServices.Client.OAuth.OAuthDataServiceAdapter.AddAccessTokenToRequest(WebRequest request)
at Microsoft.WindowsAzure.MediaServices.Client.AzureMediaServicesClassFactory.<>c__DisplayClass7.<GetAccountApiEndpoint>b__6()
I'm very new to Azure and I've spent the day trying to figure out how to solve this one, so if anyone could help me I'd be very grateful.
Did you specify MediaServicesCredentials in your code and configure access keys? Take a look at if not already Get started with delivering content on demand using .NET SDK. You can also check out the error codes to get some clues about the error you're getting.

Why do I get the error 'HTTP Response: 403 Forbidden' when I try to call the amazon api in my Rails app?

I'm creating a Ruby on Rails application and am following the instructions step for step based on the gem required to call the amazon API (https://github.com/jugend/amazon-ecs) when searching for an item.
This is my code in the Ruby app:
Amazon::Ecs.options = {
:associate_tag => '[*****]',
:AWS_access_key_id => '[*****]',
:AWS_secret_key => '[*****]'
}
res = Amazon::Ecs.item_search('soccer books')
puts res.total_items
I've tried regenerating my keys, still doesn't work and am not sure what to do.
It might be possible issue in gem as they already solved if for 1.9 . You can check changelog here https://github.com/jugend/amazon-ecs/blob/master/CHANGELOG . This confirm that issue resolved for 1.9 . But might be come up again due to new changes they done. So my opinion is to create an issue in gem as well.
please check s3-bucket timestamp and you local machine timestamp. If its greate the 10hr or more s3 considers as invalid request and refuse it.

IllegalArgumentException : Trying to set foreign cookie while downloading Google Spreadsheet via API?

I am trying to download the Google spreadsheet using download API version 3 ( v3 ). I am getting "java.lang.IllegalArgumentException: Trying to set foreign cookie" error message while downloading spreadsheet. I am tried by my google apps account which is authenticated by 2 legged oauth authentication process. Is there anyone facing this kind of problem ?
Here is the error stacktrace :
Servlet.service() for servlet action threw exception|java.lang.IllegalArgumentException: Trying to set foreign cookie
at com.google.gdata.client.http.GoogleGDataRequest$GoogleCookie.<init>(GoogleGDataRequest.java:166)
at com.google.gdata.client.http.GoogleGDataRequest$GoogleCookieHandler.put(GoogleGDataRequest.java:399)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:710)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1000)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(HttpURLConnection.java:2053)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getHeaderFields(HttpsURLConnectionImpl.java:263)
at com.google.gdata.client.http.HttpGDataRequest.isOAuthProxyErrorResponse(HttpGDataRequest.java:558)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:549)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
Edit: This issue occurs only in one of our user's accounts using our App. Its working fine for all other users
I faced the same issue and was able to solve it by changing the url.
The URL I got directly from GDrive:
https://docs.google.com/spreadsheets/d/19Du6mgmzP94vxxHK5httgfK4dqgycQkBBLDq_6I5J7o/edit#gid=1472457471
Had to modify the above to:
https://spreadsheets.google.com/feeds/spreadsheets/**19Du6mgmzP94vxxHK5httgfK4dqgycQkBBLDq_6I5J7o
Hope this will help someone.
I get the service this way:
int GDATA_TIMEOUT = 10* 1000;
spreadsheetService = new SpreadsheetService("cellmaster.com.au-v0.2");
spreadsheetService.setHeader("Authorization", "Bearer " + accessToken);
spreadsheetService.setConnectTimeout(GDATA_TIMEOUT);
spreadsheetService.setReadTimeout(GDATA_TIMEOUT);
And include a retry loop because it does fail once in a while.

Fusion Tables using php Login required Error 401 when inserting

This is what i try to do. select command work but when try to insert it generate
error "Login required Error 401" any example where insertion, updation and deletion is done without this type of error
or any other suggestion which help me
query(SQLBuilder::insert(44444, array('grefid'=>3000, 'distname' => 'xxxx', 'tehsilname' => 'bob')));
?>
I think you need to get the API key...visit the following link to get the same:
Get Google API Key

KOALA + FACEBOOK GRAPH gives FARADAY error (ConnectionFailed - Connection Refused - connect(2))

I am using koala(1.3.0) with rails (3.0.7).
This is how I use them.
Link to click function of facebook
<%= link_to 'Facebook Login', Koala::Facebook::OAuth.new.url_for_oauth_code(:callback => facebook_redirect_url), :class => "facebook_login" %>
This goes to following link
https://graph.facebook.com/oauth/authorize?client_id=MY_APP_ID&redirect_uri=http%3A%2F%2Fexample.example.com%2Ffacebook%2Fredirect
Now I get the code in params in my facebook controller of redirect.
Following is what I do next in redirect method of facebook controller.
session[:access_token] = Koala::Facebook::OAuth.new(url_r).get_access_token(params[:code]) if params[:code]
but this line of code gives faraday ConnectionFailed error.
I am stuck at this point. Can't figure out what is the reason behind this.
I have also done the following with this another way also.
After I get code in params
facebook_access_token_redirect_link = "https://graph.facebook.com/oauth/access_token?client_id=355***************&redirect_uri=#{url_i}&client_secret=MY_APP_SECRET&code=#{params[:code]}"
and redirect to this link. But then I get an error from facebook
Error validating verification code
I don't understand this also.
Any help regarding this is appreciated.
Thanks.
It was a silly thing. The server I was hosting my app at has banned all https connections.
Removed that restriction and I got koala working.

Resources