-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:twoism/foursquare2
- Loading branch information
Showing
5 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module Foursquare2 | ||
module Multi | ||
|
||
# Retrieve multiple requests | ||
# | ||
# param [Array] queries the uri encoded request urls | ||
|
||
def multi(requests, options = {}) | ||
escaped_requests = requests.map {|r| CGI.escape(r) }.join(",") | ||
|
||
options.merge!(requests: escaped_requests) | ||
|
||
response = connection.post do |req| | ||
req.url "multi", options | ||
end | ||
return_error_or_body(response, response.body.response.responses) | ||
end | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'helper' | ||
|
||
class TestMulti < Test::Unit::TestCase | ||
|
||
context "When using the foursquare API and working with multiple requests" do | ||
setup do | ||
@client = foursquare_test_client | ||
end | ||
|
||
should "fetch cw for a single venue" do | ||
stub_post("https://api.foursquare.com/v2/multi?oauth_token=#{@client.oauth_token}", "multi/multi.json") | ||
requests = [ | ||
"/venues/4b8c3d87f964a520f7c532e3", | ||
"/venues/4b8c3d87f964a520f7c532e3", | ||
] | ||
responses = @client.multi(requests, v: 20150101) | ||
|
||
responses.first.response.venue.id.should == "4b8c3d87f964a520f7c532e3" | ||
end | ||
|
||
end | ||
|
||
end |