Skip to content

Users calls

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

####To call /users

RubyStackoverflow.users(options = {})

Example ruby 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 ruby 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.first.last_activity_date 
#=> '2013-10-18 15:57:17 UTC'

####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.first.name
#=> 'Teacher'

####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.first.score
#=> 2

####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], options={})

Example

response = RubyStackoverflow.users_with_mentioned_questions(['707894','1004415'])
response.data.first.comments.first.score
#=> 2

####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.first.view_count
#=> 10

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

Clone this wiki locally