Skip to content

Users calls

Rashmi Yadav edited this page Oct 25, 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.suggested_edits
#=> #=> [#<RubyStackoverflow::Client::SuggestedEdit:0x007fedbc1de668 @suggested_edit_id=883120, @post_id=18583536, @post_type="answer",...]

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

Clone this wiki locally