Permalink
Browse files

Updated location searching to use lat, lng over ll for both location …

…and media search
  • Loading branch information...
1 parent 4597f9a commit 8cc3d62a43682990a3886bc720930397348b381e Shayne Sweeney committed Feb 3, 2011
@@ -40,18 +40,18 @@ def location_recent_media(id, *args)
# Returns Instagram locations within proximity of given lat,lng
#
- # @format :json
- # @authenticated false
- # @rate_limited true
- # @param latlng [String] A comma separated string containing a latitude and longitude of which to center the search.
- # @param options [Hash] A customizable set of options.
+ # @param lat [String] A given latitude in decimal format
+ # @param lng [String] A given longitude in decimal format
# @option options [Integer] :count The number of media items to retrieve. Maxiumum of 100 allowed per page.
# @return [Array]
+ # @example Return locations around 37.7808851, -122.3948632 (164 S Park, SF, CA USA)
+ # Instagram.location_search("37.7808851", "-122.3948632")
# @see TODO:doc url
- # @example Return locations around "37.7808851,-122.3948632" (164 S Park, SF, CA USA)
- # Instagram.location_search('37.7808851,-122.3948632')
- def location_search(latlng, options={})
- response = get('locations/search', options.merge(:ll => latlng))
+ # @format :json
+ # @authenticated false
+ # @rate_limited true
+ def location_search(lat, lng, options={})
+ response = get('locations/search', options.merge(:lat => lat, :lng => lng))
response['data']
end
end
@@ -43,18 +43,19 @@ def media_popular(*args)
# Returns media items within proximity of given lat,lng
#
- # @format :json
- # @authenticated false
- # @rate_limited true
- # @param latlng [String] A comma separated string containing a latitude and longitude of which to center the search.
+ # @param lat [String] A given latitude in decimal format
+ # @param lng [String] A given longitude in decimal format
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The number of media items to retrieve. Maxiumum of 100 allowed per page.
# @return [Array]
+ # @example Return media around 37.7808851, -122.3948632 (164 S Park, SF, CA USA)
+ # Instagram.media_search("37.7808851", "-122.3948632")
# @see TODO:doc url
- # @example Return media around "37.7808851,-122.3948632" (164 S Park, SF, CA USA)
- # Instagram.media_search('37.7808851,-122.3948632')
- def media_search(latlng, options={})
- response = get('media/search', options.merge(:ll => latlng))
+ # @format :json
+ # @authenticated false
+ # @rate_limited true
+ def media_search(lat, lng, options={})
+ response = get('media/search', options.merge(:lat => lat, :lng => lng))
response['data']
end
end
@@ -55,20 +55,20 @@
before do
stub_get("locations/search.#{format}").
with(:query => {:access_token => @client.access_token}).
- with(:query => {:ll => "37.7808851,-122.3948632"}).
+ with(:query => {:lat => "37.7808851", :lng => "-122.3948632"}).
to_return(:body => fixture("location_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
- @client.location_search('37.7808851,-122.3948632')
+ @client.location_search("37.7808851", "-122.3948632")
a_get("locations/search.#{format}").
with(:query => {:access_token => @client.access_token}).
- with(:query => {:ll => "37.7808851,-122.3948632"}).
+ with(:query => {:lat => "37.7808851", :lng => "-122.3948632"}).
should have_been_made
end
it "should return an array of user search results" do
- locations = @client.location_search('37.7808851,-122.3948632')
+ locations = @client.location_search("37.7808851", "-122.3948632")
locations.should be_a Array
locations.first.name.should == "Instagram"
end
@@ -55,20 +55,20 @@
before do
stub_get("media/search.#{format}").
with(:query => {:access_token => @client.access_token}).
- with(:query => {:ll => "37.7808851,-122.3948632"}).
+ with(:query => {:lat => "37.7808851", :lng => "-122.3948632"}).
to_return(:body => fixture("media_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
end
it "should get the correct resource" do
- @client.media_search('37.7808851,-122.3948632')
+ @client.media_search("37.7808851", "-122.3948632")
a_get("media/search.#{format}").
with(:query => {:access_token => @client.access_token}).
- with(:query => {:ll => "37.7808851,-122.3948632"}).
+ with(:query => {:lat => "37.7808851", :lng => "-122.3948632"}).
should have_been_made
end
it "should return an array of user search results" do
- user_search = @client.media_search('37.7808851,-122.3948632')
+ user_search = @client.media_search("37.7808851", "-122.3948632")
user_search.should be_a Array
user_search.first.user.username.should == "mikeyk"
end

0 comments on commit 8cc3d62

Please sign in to comment.