Module: DeviantArt::User

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

Instance Method Summary collapse

Instance Method Details

#get_friends(username, 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, 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, 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, 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

#get_statuses(username, offset: 0, limit: 10, mature_content: false) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/deviantart/user.rb', line 38

def get_statuses(username, offset: 0, limit: 10, mature_content: false)
  params = {}
  params['username'] = username
  params['mature_content'] = mature_content
  params['offset'] = offset if offset != 0
  params['limit'] = limit if limit != 10
  perform(:get, '/api/v1/oauth2/user/statuses/', params)
end

#search_friends(query, username: nil) ⇒ Object

Search friends by username



31
32
33
34
35
36
# File 'lib/deviantart/user.rb', line 31

def search_friends(query, username: nil)
  params = {}
  params['query'] = query
  params['username'] = username unless username.nil?
  perform(:get, '/api/v1/oauth2/user/friends/search', 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