Join the Stack Overflow Community
Stack Overflow is a community of 6.7 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I have been trying for two days to figure this out and can't get what I am doing wrong. I have been working with APIs for a while now, but this is the first time I have tried it with Ruby.

Currently this what I have:

require 'httparty'    

response = URI.parse('http://api.remix.bestbuy.com/v1/stores(area(55423,20))?apiKey=xxxxxxxxxxxxxx')
parse = CGI.parse(response.query)

result = parse['id'].first  

$result = result 

I plan to move $result to result.html.erb to iterate into a table, but not sure if I have the parsing done correctly, since I can't view the contents of reponse or $result. Any idea if I am even close? and how to iterate through the xml after..

share|improve this question
    
Shouldn't you look at response.body instead of response.query? – Uri Agassi Nov 13 '14 at 7:12
    
For parsing you can use nokogiri.org – Uri Agassi Nov 13 '14 at 7:13
    
I have been trying to figure out Nokogiri as well. Sometimes it isn't such a great thing when you have so many options, as in Nokogiri. Just want to pull the XML data, parse it into a useable array that I can iterate into an html table. – Scott Bradford Nov 13 '14 at 7:32
    
It is not supposed to be that difficult: doc = Nokogiri::HTML(open("http://www.threescompany.com/")) – Uri Agassi Nov 13 '14 at 7:35
    
I was more focused on the problem, than a key. I made it more 'anon' thanks. I'll give that a shot with Noko. – Scott Bradford Nov 13 '14 at 7:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.