Sabre Dev Studio API call by ruby - ruby

I'm trying to take hotels details from sabre dev studio in my app and I'm using gem 'sabre_dev_studio' but I can't understand how and which url I have to hit (APIs) for the hotel details. I'm using like this :
SabreDevStudio.configure do |c|
c.client_id = 'V1:kiifsurie29jj:KITPUI:DFR'
c.client_secret = 'wiurRTs'
c.uri = 'https://api.test.sabre.com'
end
token = SabreDevStudio::Base.get_access_token
themes = SabreDevStudio::Base.get('/v1/shop/themes')
this is working and give me proper response but for hotels I'm not getting which url are for apies.

https://developer.sabre.com/docs/read/rest_basics/endpoints_and_uris
This is the list of the urls you'll want

There are currently no REST APIs for hotels, only SOAP at the moment.
Here's the related documentation:
https://developer.sabre.com/docs/read/soap_apis/hotel

Related

Download my own private albums using Flickr API

I'm trying to download my own flickr albums using the API. I'm using the flickr.rb gem here
I am creating a new object using this:
#flickr = Flickr.new({api_key: 'xxxxx', shared_secret: 'xxxxx', verify_ssl: false})
And then I'm using:
p = #flickr.photoset(photoset_id)
Where I pass the id of my photoset I want to download.
I keep getting the error:
/.rvm/gems/ruby-2.2.5/gems/flickr.rb-1.2.1/lib/flickr.rb:199:in `request': Photoset not found (RuntimeError)
What is the correct way to authenticate to Flickr and download my photos? I don't want to build any UI, just want a command line app to do this. Is there some URL I need to hit in the browser to authorize the app and grant permissions? The documentation is really sparse and doesn't give any examples.
Update: In response to #r-f-nelson
The 'user' as retrieved:
#Flickr::User:0x007fd8cea6ad98 #id="29916617#N02", #username="taraporefarhad", #client=#<Flickr:0x007fd8cf09fc68 #host="https://api.flickr.com", #api="/services/rest", #verify_ssl=false, #api_key="36705xxxxxxxxxxxxxxx", #shared_secret="xxxxxxxxxxxxxx", #auth_token=nil, #ca_file=nil
The 'flickr' client object:
#Flickr:0x007fd8cf09fc68 #host="https://api.flickr.com", #api="/services/rest", #verify_ssl=false, #api_key="36705xxxxxxxxxxxxxxx", #shared_secret="xxxxxxxxxxxxxx", #auth_token=nil, #ca_file=nil, #user=#
Flickr::User:0x007fd8cea6ad98 #id="29916617#N02", #username="taraporefarhad", #client=#<Flickr:0x007fd8cf09fc68 ...
The Photoset object:
#Flickr::Photoset:0x007fd8cf06c9d0 #id="72157638843727066", #api_key=nil, #client=#<Flickr:0x007fd8cf06c8b8 #host="https://api.flickr.com", #api="/services/rest", #verify_ssl=true, #api_key=nil, #shared_secret=nil, #auth_token=nil, #ca_file=nil
/.rvm/gems/ruby-2.2.5/gems/flickr.rb-1.2.1/lib/flickr.rb:199:in `request': Invalid API Key (Key has invalid format) (RuntimeError)
Note above that the "photoset" object has a different flickr client object id and NO shared secret and API key! Not sure how that's happening since I'm using the same client and user objects to get the photoset as well.
Assuming you are successfully connecting to Flickr's API, you can browse your own photosets like so:
user = flickr.users('you#yourflickraccount.com')
photosets = user.photosets
From there you can iterate through your photosets to find the correct one. I'm guessing whatever id you're using is not the actual photoset_id that the Flickr API uses.

Google CivicInfo API Zip Codes for PR

I am trying to use the Civic Info API V2 to replace the now-defunct Sunlight Labs Congressional Legislator API. To do this I am passing an zip code string as the address into the Google API. However, when I try to pass the zip code for a Puerto Rico address, "00924" I'm returned a 404 - No information for this address. I get the same error when I add the city to the query, San+Juan+PR+00924. Puerto Rico has one Delegate Representative in the US House of Reps.
I'm using ruby's google-api-client gem to access the API in my program, but I get the same errors using the web API. Other zip codes work - just having troubles with this one.
Can anyone help me figure out how to get Delegate's name and information using this API?
EDIT: My current ruby code
def legislators_by_zip_code(zip)
civic_info = Google::Apis::CivicinfoV2::CivicInfoService.new
civic_info.key = '<My API Key>'
return if zip == "00000"
legislators = civic_info.representative_info_by_address(
address: zip,
levels: 'country',
roles: ['legislatorUpperBody', 'legislatorLowerBody'])
end

Accessing entire netflix catalog via API v1.5

Netflix recently updated their API methods for obtaining the full Netflix catalog. I'm curious if anyone has had any success accessing these new xml documents and downloading them via API v1.5 (9/2012). Previously, you could download the entire Netflix catalog via one API call (which I had working perfectly). Now, there are supposedly two calls to make: one for dvd's and one for streaming movies.
I cannot make these calls return anything except for an empty array. Please don't offer an answer unless you have personally downloaded the entire catalog via these new API's.
Bonus points if you can tell me how to do it in Ruby.
http://developer.netflix.com/blog/read/Update_Changes_for_the_Public_API
This did it for me (download the netflix instant cat)...it's in php but can prob be easily rewritten in ruby..this is using JR Collings OAuthsimple
args = Array(
max_results=> 20,
start_index=>0
);
//args don't matter, netflix doesn't listen here
// this is the URL path (note the lack of arguments.)
$rpath = "http://api-public.netflix.com/catalog/titles/streaming";
// Create the Signature object.
$roauth = new OAuthSimple();
$rsigned = $roauth->sign(Array(path=>$rpath,
parameters=>$args,
signatures=> Array('consumer_key'=>YOURKEY,
'shared_secret'=>YOURSECRET,
)));
$getxml = file_get_contents($rsigned['signed_url']);
file_put_contents("streaming.xml", $getxml);

Getting a response uri

I'm new to Windows phone 7 application development. I'm currently developing an app in which I wish to do a HTML request and display the result obtained in Web browser. For example, Suppose I give the below URI
"http://m.imdb.com/find?q="+search_string (where search_string is a variable)
I want to take the result obtained from this and display it on the web browser. I've been searching regarding this for past 1 day... Didn't get any fruitful results. So please redirect me either to a suitable tutorial page or please give a sample code?
WebBrowserTask wbt = new WebBrowserTask();
wbt.URL = "http://m.imdb.com/find?q="+search_string
wbt.Show();
this will allow you to launch the url in the browser.
WebBrowserTask

Implements a local restaurant search

I am currently trying to have a feature similar to the local scout (search button -> proximity) in my Windows Phone 7 app.
I'd like to get the 10 top restaurants or bars/clubs near my current location. Getting the geolocation of the user is the easy part.
Now I'd like to pass this location to an API and get the results.
I tried Bing Search API but I didn't figure out how to get special locations such as restaurants. And the SOAP service connection wasn't working from my phone.
Then I searched from others API... it seems that Google or Yahoo (PlaceFinder) or maybe Foursquare can be used too. But before investigating further, do you have any ideas of a simply solution to implement the local scout from Bing ?
Or is there another way to implement this feature ?
Oh, and I am french but not specially targeting a market so I'd like to use an international service.
Thanks a lot.
Damien
EDIT :
I guess I found a part of my solution :
Get business type/industry from Bing Phonebook API
As I want to use the Bing Search WSDL, I added a service reference to http://api.search.live.net/soap.asmx?AppId=42 (where 42 is my app key).
When I execute (from my phone) a simple test :
public void Test()
{
BingPortTypeClient bing = new BingPortTypeClient();
SearchRequest request = new SearchRequest();
request.AppId = AppId;
request.Sources = new SourceType[] { SourceType.Web };
request.Query = "restaurant";
bing.SearchCompleted += new EventHandler<SearchCompletedEventArgs>(bing_SearchCompleted);
bing.SearchAsync(request);
}
void bing_SearchCompleted(object sender, SearchCompletedEventArgs e)
{
}
I am getting the following exception :
There was no endpoint listening at http://api.search.live.net/soap.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Inner : The remote server returned an error: NotFound.
I thought using this API would be quite more easy and well-documented...

Resources