Skip to content

Users calls

Rashmi Yadav edited this page Oct 26, 2013 · 19 revisions

####To call /users

RubyStackoverflow.users(options = {})

Example

response = RubyStackoverflow.users({inname: 'raysrashmi', sort: 'reputation'})
response.data.first.display_name
#=> 'raysrashmi'

response.data is an array of users. If there is any error then you can access it

response.error

####To call /users/{ids}

RubyStackoverflow.users_by_ids([ids], options = {})

Example

response = RubyStackoverflow.users_by_ids(['1363236'])
response.data.first.display_name 
#=> 'raysrashmi'

####To call /users/{ids}/answers (answers of users in {ids})

response = RubyStackoverflow.users_with_answers([ids], options)

Example

response = RubyStackoverflow.users_with_answers(['1363236'],{min: '2013-10-01', max: '2013-10-24'})
response.data.first.answers 
#=> [#<RubyStackoverflow::Client::Answer:0x007fcee5ac6668 @question_id=19551247, @answer_id=19551539, @creation_date="2013-10-23 20:21:50 UTC", @last_activity_date="2013-10-23 20:21:50 UTC", @score=0,...]

####To call /users/{ids}/badges (badges of users in {ids}

RubyStackoverflow.users_with_badges([ids], options={})

Example

response = RubyStackoverflow.users_with_badges(['1363236'],{order: 'asc'})
response.data.first.badges
#=> [#<RubyStackoverflow::Client::Badge:0x007ff635164d50 @badge_id=1, @rank="bronze", @name="Teacher", @award_count=1,..]

####To call /users/{ids}/comments (comments of users in {ids})

RubyStackoverflow.users_with_comments([ids], options={})

Example

response = RubyStackoverflow.users_with_comments(['1363236'],{sort: 'votes'})
response.data.first.comments
#=> [#<RubyStackoverflow::Client::Comment:0x007fb8140d8698 @comment_id=28886246, @post_id=19476854, @creation_date="2013-10-20 12:49:58 UTC"...]

####To call /users/{ids}/comments/{toid} (comments that the users in {ids} have posted in reply to the single user identified in {toid})

RubyStackoverflow.users_with_replied_comments(ids, toid, options = {})

Example

response = RubyStackoverflow.users_with_replied_comments(['707894','1004415'], '1300151')
response.data.first.comments
#=> [#<RubyStackoverflow::Client::Comment:0x007faad95f8b48 @comment_id=28452392, @post_id=19224108, @creation_date="2013-10-07 12:33:45 UTC",...]

####To call /users/{ids}/favorites (questions favorited by users in ids)

RubyStackoverflow.users_with_favorites_questions([ids], options = {})

Example

response = RubyStackoverflow.users_with_favorites_questions(['1363236'])
response.data.first.questions
#=> [#<RubyStackoverflow::Client::Question:0x007ff3523fd688 @answers=[], @question_id=18152587, @last_edit_date="2013-08-12 13:21:25 UTC",...]

####To call /users/{ids}/mentioned (comments that the users in {ids} were mentioned in)

RubyStackoverflow.users_with_mentioned_comments([ids], options={})

Example

response = RubyStackoverflow.users_with_mentioned_comments(['707894','1004415'])
response.data.first.comments
#=> [#<RubyStackoverflow::Client::Comment:0x007fbef1ad14e0 @comment_id=28782642, @post_id=19283744, @creation_date="2013-10-17 00:10:28 UTC",...]

####To call /users/{id}/notifications (notifications of user) To make this request you should have access_token otherwise it wont success

RubyStackoverflow.users_notifications(id, options={})

Example

response = RubyStackoverflow.users_notifications(1363236)
response.data
#=> [#<RubyStackoverflow::Client::Notification:0x007fa27c1fe908 @notification_type="new_privilege",.....]

####To call /users/{id}/notifications (notifications of user) To make this request also you should have access_token otherwise it wont success

RubyStackoverflow.users_unread_notifications(id, options={})

Example

response = RubyStackoverflow.users_unread_notifications(1363236)
response.data
#=> [#<RubyStackoverflow::Client::Notification:0x007fa27c1fe908 @notification_type="new_privilege",.....]

####To call /users/{ids}/questions (questions of users in {ids})

RubyStackoverflow.users_questions([ids], options={})

Example

response = RubyStackoverflow.users_questions(['1363236'])
response.data.questions
#=> [#<RubyStackoverflow::Client::Question:0x007ff3da3b1098 @answers=[], @question_id=19552808, @creation_date="2013-10-23 21:39:05 UTC",....]

####To call /users/{ids}/questions/featured ( questions on which the users in {ids} have active bounties)

RubyStackoverflow.users_featured_questions([ids], options={})

Example

response = RubyStackoverflow.users_featured_questions(['1363236'])
response.data.questions
#=> #=> [#<RubyStackoverflow::Client::Question:0x007ff3da3b1098 @answers=[], @question_id=19552808, @creation_date="2013-10-23 21:39:05 UTC",....]

####To call /users/{ids}/questions/no-answers ( questions asked by a set of users in {ids}, which have no answers)

RubyStackoverflow.users_noanswers_questions([ids], options={})

Example

response = RubyStackoverflow.users_noanswers_questions(['1363236'])
response.data.questions
#=> #=> [#<RubyStackoverflow::Client::Question:0x007ff3da3b1098 @answers=[], @question_id=19552808, @creation_date="2013-10-23 21:39:05 UTC",....]

####To call /users/{ids}/questions/unaccepted ( questions asked by a set of users, which have at least one answer but no accepted answer)

RubyStackoverflow.users_unaccepted_questions([ids], options={})

Example

response = RubyStackoverflow.users_unaccepted_questions(['1363236'])
response.data.questions
#=> #=> [#<RubyStackoverflow::Client::Question:0x007ff3da3b1098 @answers=[], @question_id=19552808, @creation_date="2013-10-23 21:39:05 UTC",....]

####To call /users/{ids}/questions/unanswered ( questions asked by a set of users, which have at least one answer but no accepted answer)

RubyStackoverflow.users_unaccepted_questions([ids], options={})

Example

response = RubyStackoverflow.users_unaccepted_questions(['1363236'])
response.data.questions
#=> #=> [#<RubyStackoverflow::Client::Question:0x007ff3da3b1098 @answers=[], @question_id=19552808, @creation_date="2013-10-23 21:39:05 UTC",....]

####To call /users/{ids}/reputation ( reputation subset of the reputation changes experienced by the users identified by a set of ids)

RubyStackoverflow.users_reputations([ids], options={})

Example

response = RubyStackoverflow.users_reputations(['1363236'])
response.data.reputations
#=> #=> [#<RubyStackoverflow::Client::Reputation:0x007f9373779738 @post_id=19552808, @post_type="question", @vote_type="up_votes",...]

####To call /users/{ids}/suggested-edits ( suggested edits provided by users identified by a set of ids)

RubyStackoverflow.users_suggested_edits([ids], options={})

Example

response = RubyStackoverflow.users_suggested_edits(['1363236'])
response.data.first.suggested_edits
#=> #=> [#<RubyStackoverflow::Client::SuggestedEdit:0x007fedbc1de668 @suggested_edit_id=883120, @post_id=18583536, @post_type="answer",...]

####To call /users/{ids}/tags (tags the users identified in {ids} have been active in)

RubyStackoverflow.users_tags([ids], options={})

Example

response = RubyStackoverflow.users_tags(['707894'],{min: 1, max: 10, sort: 'popular' })
response.data.first.tags
#=> #=> [#<RubyStackoverflow::Client::Tag:0x007fef91aae208 @name="devise", @count=9, @is_required=false, @is_moderator_only=false,...]

####To call /users/{id}/tags/{tags}/top-answers (Returns the top 30 answers a user has posted in response to questions with the given tags)

RubyStackoverflow.users_top_answers_with_given_tags(id, [tags], options={})

Example

response = RubyStackoverflow.users_top_answers_with_given_tags('707894',['ruby', 'rails'])
response.data.first.tags
#=> [#<RubyStackoverflow::Client::Answer:0x007f950291b6f0 @question_id=13145611, @answer_id=13145876, @creation_date="2012-10-30 18:58:11 UTC",...]

####To call /users/{id}/tags/{tags}/top-questions (Returns the top 30 questions a user has asked with the given tags)

RubyStackoverflow.users_top_questions_with_given_tags(id, [tags], options={})

Example

response = RubyStackoverflow.users_top_questions_with_given_tags('707894',['ruby', 'rails'])
response.data.first.tags
#=> [#<RubyStackoverflow::Client::Question:0x007fc3b40cc040 @answers=[], @question_id=19224108, @creation_date="2013-10-07 11:48:58 UTC",...]

####To call /users/{ids}/timeline (Returns a subset of the actions the users in {ids} have taken on the site)

RubyStackoverflow.users_timeline([ids], options={})

Example

response = RubyStackoverflow.users_timeline(['1363236'],{fromdate: '2013-10-17', todate: '2013-10-20'})
response.data.first.posts
#=> [#<RubyStackoverflow::Client::Post:0x007f991c93aaa0 @creation_date="2013-10-19 20:10:37 UTC", @post_type="answer", @timeline_type="commented",...]

####To call /users/{id}/write-permissions (Returns the write permissions a user has via the api)

RubyStackoverflow.user_write_permissions(id, options={})

Example

response = RubyStackoverflow.user_write_permissions('1363236')
response.data.first.permissions
#=> [#<RubyStackoverflow::Client::Permission:0x007fbc9a188dd8 @object_type="answer", @can_add=true, @can_edit=true, @can_delete=true,...]

####To call /users/{id}/top-answer-tags (Returns a single user's top tags by answer score)

RubyStackoverflow.user_top_tags_by_answers(id, options ={})

Example

response = RubyStackoverflow.user_top_tags_by_answers('707894')
response.data.first.tags
#=> [#<RubyStackoverflow::Client::Tag:0x007fb0db1b9340 @tag_name="whenever", @question_score=4, @question_count=1, @answer_score=0, @answer_count=0>,...]
Clone this wiki locally