Skip to content

Commit

Permalink
Rename user_tags to get_tag_users
Browse files Browse the repository at this point in the history
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 :-)
  • Loading branch information
ches committed May 6, 2015
1 parent 2e7a270 commit 06c5df3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 6 additions & 5 deletions lib/angellist_api/client/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/integration/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions spec/unit/lib/angellist_api/client/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,13 @@
client.me.should == "success"
end
end

describe '#get_tag_users' do
it 'gets 1/tags/<id>/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

2 comments on commit 06c5df3

@StephaneJuban
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ches, is this working properly on your side?
The test are OK with bundle exec rake spec but if I want to use the gem on another project I got:

/usr/local/rvm/gems/ruby-2.3.0/gems/angellist_api-1.1.0/lib/angellist_api.rb:16:in 'method_missing': undefined method 'get_tag_users' for AngellistApi:Module (NoMethodError)
.....
/usr/local/rvm/gems/ruby-2.3.0/gems/angellist_api-1.1.0/lib/angellist_api.rb:16:in 'method_missing': undefined method 'user_tags' for AngellistApi:Module (NoMethodError)
Did you mean? user_agent

Both get_tag_users and user_tags are broken for me.

But AngellistApi.get("1/tags/1664/users", :investors => 'by_activity') is working.

@ches
Copy link
Collaborator Author

@ches ches commented on 06c5df3 Apr 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StephaneJuban Sorry, this commit isn't published in a gem release yet—I will try to finally get #20 merged in a few minutes and make a release with it.

Please sign in to comment.