문제

I'm trying to parse the Mochi Media API on my site. Unfortunately, they make use of colons in their API URLs....

http://feedmonger.mochimedia.com/feeds/query/?q=(recommendation:>=0) and category:action&partner_id=XXXX

The question is, using httparty, how do I parse that url given that the :query/options hash will automatically convert to a standard query string:

get('/myNewApiUrl', :query => {:key => value}) | http://base/myNewApiUrl?key=value&key2=value2

I need something to handle this:

get('/myNewApiUrl', :query => {:key => value}) | http://base/myNewApiUrl?key:value&key2=value2

Can anyone help me out... just about ready to bang my head against a wall. :/

도움이 되었습니까?

해결책

Ok, I was able to solve this by using a variable that I then passed along to the httparty's get method.

i.e.

url = ["URL-UP-TO-/?query=CATEGORY:",category].join("")
get(url)

Hopefully this helps someone else looking to use httparty. The GEM is really impressive!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top