Accessing third part website-ruby - ruby-on-rails

I did some web search and found nothing for the question i have with me, so I'm posting it here. I wants to build a simple Ruby On rails web application which will be used to display the search result from a third party ebsite without any API avilable. (ex: For example when a user type a keyword and click search i need to get the response from google.com and display that to user in my application).
How can i achieve this?
I hope scrapping is not an advised solution.Is there any advisable techniques(like SOAP 0r REST API).
NOTE: The website is a public government website.i need to access the search from my application(It has no built in API for this purpose).

Google has a search api that you can use https://developers.google.com/custom-search/json-api/v1/overview
and there is a gem available.
https://github.com/google/google-api-ruby-client

Related

Can I obtain the last session time of all Jira users using the REST API?

Can I use the REST API to filter out users who have not signed in during the last three months?
(I have admin access if that is needed).
Someone correct me if I'm wrong, but from what I know it's not available out of the box. You would probably need to implement a REST plugin module which would get this data from database (or find an existing plugin that does this - I haven't).
There's a page on Atlassian's Confluence that gives you SQLs to get the last login timestamp for a user (and it seems quite up-to-date): https://confluence.atlassian.com/display/JIRAKB/Retrieve+last+login+dates+for+users+from+the+database
Please note that you would have to think about security when developing such a plugin. I have not really considered this, but there might be reasons to include permission restrictions for such a REST resource.
EDIT: I might have found an API (not REST) that exposes login information without the need to query the database (untested): https://developer.atlassian.com/static/javadoc/jira/reference/com/atlassian/jira/bc/security/login/LoginInfo.html
Unfortunately, the JIRA REST API doesn't provide this resource. The latest supported methods can be found on the JIRA REST API Reference Page.
These methods can be tested on your current installation using the JIRA REST API Browser.
The links above contain all of the info you need on the REST API. If you're still interested in using REST, you can always create your own method for retrieving the user list.
Of course, you could use other methods, like SQL, for example. There are a number of plugins available here.

Get URL from search task

I have seen many examples where a search task was launched from application but no examples where application could get some info back from that task.
For example, is it possible to get a list of found sites or URL that user have chosen in task (instead of navigating user to that URL)?
There is no built-in API in WP8 that would allow getting the results of a web search into your app. You should use a 3rd party framework for that.
Bing has an official Web API you can use for that but it starts costing money after 10,000 API calls per month. You can read more about it # https://datamarket.azure.com/dataset/5BA839F1-12CE-4CCE-BF57-A49D98D29A44
Note that Bing did use to have a proper C# API with API keys and what not, but V2.0 of that API has been depercated in favour of the new Azure Data Marketplace service.
Google doesn't have an API for search results. But for the past few years developers have used Google's AJAX webservice to get those. See a C# code sample # http://answers.oreilly.com/topic/2165-how-to-search-google-and-bing-in-c/

How to programmatically obtain OAuth2 client credentials for Google API

I'm trying to create a redistributable web application that will integrate with Google Analytics through the Google Reporting API. Customer will install the application on their server.
I'm following this tutorial (I'm using PHP, but I believe this is not of importance for my question)
https://developers.google.com/analytics/resources/tutorials/hello-analytics-api
This works fine. No issues there.
However I can't figure out one missing element:
The tutorial starts with sending me to the Google APIs console where I have to create and configure a new API project and create and configure a client ID.
That's a lot of work that requires fairly technical knowledge (redirect url, selecting correct API, error-prone copy-and-pasting, etc.)
So my questions:
Is there an API so I can programmatically set this up for my user?
If that's not possible, is there a more user-friendly way to obtain Analytics reporting that is future-proof? (I noticed they are currently deprecating a few older APIs)
Unfortunately that's AFAIK not possible.
You could go one of the following ways:
Move client_id and client_secret to some configuration file and help your customer with deployment.
Show a one-time setup wizard for your app and guide your customer step-by-step. There you can at least provide him with the right callback URLs.
Regard your application as "installed application" and instrument curl or something similar for sending the requests.

What to consider first when designing a meta-search engine using Erlang, Mnesia and Yaws?

Can someone explain to me what to consider first when designing a meta-search engine using Erlang, Mnesia and the Yaws web server? This engine should have SMS capability but I am still wondering how I am going to incorporate this feature...
The meta search engine, you need REST or Ajax APIs from Google, Yahoo and Bing. Below am providing you with examples which you may use within your back end HTTP capable Library or your front end JavaScript. I personally use mochiweb and yaws Appmods.
For example: Google has an Ajax search API which works like this:
http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=computers
Hitting that URL will give you a JSON Object which contains several search responses. In this case, the search term is "computers"
Yahoo has what it calls Boss APIs. An example of Yahoo Rest search API using Boss is here below:
For an XML result:
http://boss.yahooapis.com/ysearch/web/v1/animals?appid=APPID&format=xml&start=1&count=3
For a Json result:
http://boss.yahooapis.com/ysearch/web/v1/animals?appid=APPID&format=json&start=1&count=3
Analyse the whole HTTP GET query very well, you notice something they call an APPID. This you will get when you register with them here. I cannot give to you my APPID, you will have to get yours,then paste it in there and you will be good to go. Yahoo has something more powerful called
YQL. In the above query, the search term is: "animals"
Bing as well has got an API for you, but you will need an APPID:
http://api.bing.net/json.aspx?AppId=APPID&Query=love&Sources=Web&Version=2.0&Market=en-us&Web.Count=10
Above, the search term is: "love"
About the Meta Search Engine
You have a web page, people enter search queries in this page. You use your javaScript (JSONP). JSONP could be implemented in any one of your favorite JavaScript Framework you use e.g.
JQUERY,Ext JS,Dojo, Prototype e.t.c
Then you would have to parse the XML or JSON response from the three sources (Google, Yahoo and Bing),and make an appropriate display for your users to navigate the results.
About the SMS part
SMS capability is attained using SMS Gateway. There are several open and close source SMS Gateways. the most powerful of them all is the one built in Erlang/OTP technology called: OSERL, but to test it, you need direct connection with an SMSC in anyone of your local service provider.You need a Port on their SMSC, a user name and a password.There is another one which is better for development reasons called: NowSMS because it has capabilities for USSD, Modem Internet Communication, SMSC service connectivity, HTTP 1.1 and HTTP 1.0, configuration of two-way SMS messaging e.t.c from a Web App to-and -from the SMS Gateway. Go to their site, grab the trial version, follow the documentation and then configure two-way from your web app to the gateway and vice versa. Since NowSMS is not free, you can try: Kannel, it is open source but you will need help from the community to set it up on your Unix or Linux box.
More on incorporating SMS capability in Web Applications can be found:
Here
I also asked once a Question related to development of a powerful search engine using Erlang, Mnesia & YAWS webserver on Stackoverflow. I got plenty of good answers and responses.
Please CLICK ME!
Hope this may help. As I am not sure about SMS thing.

How to pull a Sharepoint List with a Rails app?

I would like to enable a rails app to pull from a sharepoint list in order to update a model. Has anybody meshed up these two things?
Have you tried to use the SharePoint Web service? you have to use SOAP library
to access the wsdl and to use the specified credential
http://yoursharepoint-site/_vti_bin/Lists.asmx?wsdl
There's multitude of web-service methods you could use to manipulate list on List.asmx web service.
I was implementing a code in PHP for it, and this link that help me to get started to access the web-service and use GetListItems method
http://davidsit.wordpress.com/2010/02/23/reading-a-sharepoint-list-with-php/
you'll get the idea

Resources