Module: DeviantArt::User

Included in:
Client
Defined in:
lib/deviantart/user.rb

Instance Method Summary collapse

Instance Method Details

#get_friends(username: nil, offset: 0, limit: 10) ⇒ Object

Get the users list of friends



12
13
14
15
16
17
# File 'lib/deviantart/user.rb', line 12

def get_friends(username: nil, offset: 0, limit: 10)
  params = {}
  params['offset'] = offset if offset != 0
  params['limit'] = limit if limit != 10
  perform(:get, "/api/v1/oauth2/user/friends/#{username.nil? ? '' : username}", params)
end

#get_profile(username: nil, ext_collections: false, ext_galleries: false) ⇒ Object

Get user profile information



4
5
6
7
8
9
# File 'lib/deviantart/user.rb', line 4

def get_profile(username: nil, ext_collections: false, ext_galleries: false)
  params = {}
  params['ext_collections'] = ext_collections if ext_collections
  params['ext_galleries'] = ext_galleries if ext_galleries
  perform(:get, "/api/v1/oauth2/user/profile/#{username.nil? ? '' : username}", params)
end

#whoamiObject

Fetch user info of authenticated user



26
27
28
# File 'lib/deviantart/user.rb', line 26

def whoami
  perform(:get, '/api/v1/oauth2/user/whoami?')
end

#whois(users) ⇒ Object

Fetch user info for given usernames



20
21
22
23
# File 'lib/deviantart/user.rb', line 20

def whois(users)
  params = { usernames: users.is_a?(Enumerable) ? users : [users] }
  perform(:post, '/api/v1/oauth2/user/whois', params)
end