How can we upgrade from Google Local API V1.0.3 to Google Map API in our rails application.
Also what are the other better plugins to use like YM4R/GM.
Rails 2.3.4
Ruby 1.8.7
I'm using google_places gem google_places, gem simply allows an easy interface to send the required HTTP requests and parse the JSON output into ruby hashes.
#client = GooglePlaces::Client.new("API_KEY")
#spot_list = #client.spots(-33.8670522, 151.1957362, :types => 'restaurant')
This hits https://maps.googleapis.com/maps/api/place/search/json url.
Check The Google Places API for other options which can be passed as search parameters.
parse through #spot_list and take out the reference of each place returned in response. Now, #client.spot "reference" will gives the details of the business.
In this case https://maps.googleapis.com/maps/api/place/details/json is accessed to get the data
Related
I'm trying to debug a "too many queries" error I'm getting in my rails app. It appears that the rate limit is being surpassed. I'm trying to locate where the app is providing a Google Geocoding service API key but I don't see it anywhere. I understand that you can optionally create a geokit config file in config/initializers/geokit_config.rb and provide an API key there. However, this project has no such geokit config file.
Does the geokit library use a default Google Geocoding service API key that is hardcoded in the library if there is no geokit_config.rb file present in the app? Stated another way, is it completely optional to provide a Google geocoding API key to use the geokit library with its included google geocoding service functionality?
Thanks for any help.
I'm the maintainer of geokit. Yes, you can use it without a key, though I personally feel it would be unwise to do so in production.
But it is nice for "trying" the gem, though you'll hit your limit very quickly (you might even get that error straight away depending on how google limit, e.g. by IP)
See the README to easily set this:
# See https://developers.google.com/maps/documentation/geocoding/#api_key
Geokit::Geocoders::GoogleGeocoder.api_key = ''
I am using savon gem in my rails application for calling service_now api. I want to call the api for update description. I have url for updating
https://servicenow.com/xyzlist?JSONv2&sysparm_query=number='xyz123'&sysparm_action=update&displayvalue=true
body "comments":"updated description"
Above is working perfectly in postmen. But how can i pass this params into my local rails application for updating
I am using below code for creating tickets.
client = Savon.client(wsdl: "https://servicenow.com/xyzlist.do?WSDL",basic_auth: ['xyz', 'abc'], log: true, log_level: :debug, pretty_print_xml: true)
response = client.call(:insert, message: params)
Can you please anyone help me for this issue.
You are referring to two different APIs in your example code: JSONv2 and SOAP.
Two questions: 1) do you need to use SOAP, or can you use REST instead? (Rails should support this without issue) and 2) what version of ServiceNow are you using? If you're running Geneva or later and you're able to use REST, you should be using the REST Table API for new integrations, not JSONv2.
See the documentation here for examples:
https://developer.servicenow.com/app.do#!/rest_api_doc?v=istanbul&id=r_TableAPI-PUT
I'm experimenting with twitter REST API with Ruby on Rails.
I'm using twitter gem for the same. I could get the client object using in my code.
client = current_domain.twitter_accounts.first.client
following the documentation given here
The client object works fine. But I couldn't get DirectMessages in the same way.
Also followed this documentation. Here I could not find a way to get DirectMessages. Is there a way in REST API to get twitter direct messages. Or do I need to implement Streaming API.
http://www.rubydoc.info/gems/twitter/Twitter/REST/Client
Methods included from DirectMessages
#create_direct_message, #destroy_direct_message, #direct_message, #direct_messages, #direct_messages_received, #direct_messages_sent
These map to the REST API endpoints
https://dev.twitter.com/rest/reference/get/direct_messages
https://dev.twitter.com/rest/reference/get/direct_messages/sent
n.b. you won't get group messages through this API and will need to rebuild an inbox model e.g. sequence replies of replies between yourself and the recipient.
I've went through most of the beginner rails books and I want to try creating something on my own. For a start, I just want to create a few pages in rails that will get from Facebook's api and display something like username, likes, post. I've searched around and couldn't find an answer. My friend recommended that I use a gem called fb_graph, but reviewing the documentation, I have no clue how to use it.
Thanks stackoverflow!
You can query the Graph API directly. The responses will be in JSON which you can then parse into Ruby hash. See the Facebook Documentation for more details on to call specific and sample JSON responses. So here is general guide how to you can start playing around with this:-
Make a API Call to Facebook using Graph API
Explorer. Keep playing around with api until you get a response you want. Note the request params you passed to get that response & JSON you received from facebook.
Send a HTTP request containing those same params in rails using koala, 'fb_graph' or just plain NET:HTTP. It doesn't matter what client you use to sent the request, as long as you send same params as in step1, you will get that familar JSON as response.
Now, once you have the json, just have to parse it. Provided, if the client library is not already doing that as most fb gems will turn JSON into ruby objects/hashes. But if they don't, then you have to do it manually, its something like JSON.parse('JSON_RESPONSE_AS_STRING_GOES_HERE'). after this you will have a plain-old ruby hash which is you can save to db, display in view or whatever you want to do.
Hope it helps
I want to create a service for url shorten for my own project.Basically I am sending some information via sms, so thats why I need to shorten the URL. I don't want to use google url shortner or some other services available.
We want to have our own custom url shortner.
Is there any gem or plugin available for this for rails, something like this
short_url = plugin_function_with_some_configurations(long_url)
long_url = plugin_function_with_some_configurations(short_url)
as from google search i came to know many of those written in PHP.
There are several.
You should check: https://github.com/search?type=Everything&language=Ruby&q=url+shortener
or https://rubygems.org/search?utf8=%E2%9C%93&query=shortener