From 06c5df3b355a7da6236e4bb2ee60125eca6ec353 Mon Sep 17 00:00:00 2001 From: Ches Martin Date: Thu, 7 May 2015 04:26:11 +0700 Subject: [PATCH] Rename user_tags to get_tag_users The former sounded as if it returned tags, not users. Our naming and object-oriented-ness may not be the greatest throughout, but this is consistent with e.g. `get_tag_jobs`. /cc @StephaneJuban for a heads up :-) --- lib/angellist_api/client/users.rb | 11 ++++++----- spec/integration/users_spec.rb | 2 +- spec/unit/lib/angellist_api/client/users_spec.rb | 8 ++++++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/angellist_api/client/users.rb b/lib/angellist_api/client/users.rb index b0a5286..3d77135 100644 --- a/lib/angellist_api/client/users.rb +++ b/lib/angellist_api/client/users.rb @@ -70,9 +70,10 @@ def me def user_roles(id, options={}) get("1/users/#{id}/roles", options) end - - # Returns users that are tagged with the given tag, either a LocationTag or - # MarketTag. Results are paginated and ordered from highest quality to lowest quality. + + # Returns users that are tagged with the given tag, either a LocationTag + # or MarketTag. Results are paginated and ordered from highest quality to + # lowest quality. # # @requires_authentication No # @paginated Yes @@ -91,9 +92,9 @@ def user_roles(id, options={}) # investors who reside in the given tag. by_activity will only return investors # who invest in the given tag. # - # @example Get users tagged with Louisville tag (1654) and all its children's tag. + # @example Get users tagged with tag ID, and all children of that tag. # AngellistApi.user_tags(1654, :include_children => 1) - def user_tags(id, options={}) + def get_tag_users(id, options={}) get("1/tags/#{id}/users", options) end end diff --git a/spec/integration/users_spec.rb b/spec/integration/users_spec.rb index da3857c..30a9c11 100644 --- a/spec/integration/users_spec.rb +++ b/spec/integration/users_spec.rb @@ -31,7 +31,7 @@ end it 'gets the investors that are tagged with the given tag' do - investors = client.user_tags(tag_id, :investor => 'by_residence') + investors = client.get_tag_users(tag_id, :investor => 'by_residence') user = client.get_user(investors.users.first.id) user.locations.any? { |loc| loc.id == tag_id }.should be true end diff --git a/spec/unit/lib/angellist_api/client/users_spec.rb b/spec/unit/lib/angellist_api/client/users_spec.rb index b7788be..73d8045 100644 --- a/spec/unit/lib/angellist_api/client/users_spec.rb +++ b/spec/unit/lib/angellist_api/client/users_spec.rb @@ -35,5 +35,13 @@ client.me.should == "success" end end + + describe '#get_tag_users' do + it 'gets 1/tags//users' do + id = "123" + client.should_receive(:get).with("1/tags/#{id}/users", {}).and_return("success") + client.get_tag_users(id).should == "success" + end + end end