Module: DeviantArt::Client::User

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

Instance Method Summary collapse

Instance Method Details

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

Get the users list of friends



21
22
23
24
25
26
# File 'lib/deviantart/client/user.rb', line 21

def get_friends(username, offset: 0, limit: 10)
  params = {}
  params['offset'] = offset if offset != 0
  params['limit'] = limit if limit != 10
  perform(DeviantArt::User::Friends, :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



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

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(DeviantArt::User::Profile, :get, "/api/v1/oauth2/user/profile/#{username.nil? ? '' : username}", params)
end

#get_status(statusid, mature_content: true) ⇒ Object

Fetch the status



58
59
60
61
62
# File 'lib/deviantart/client/user.rb', line 58

def get_status(statusid, mature_content: true)
  params = {}
  params['mature_content'] = mature_content
  perform(DeviantArt::Status, :get, "/api/v1/oauth2/user/statuses/#{statusid}", params)
end

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

User Statuses



48
49
50
51
52
53
54
55
# File 'lib/deviantart/client/user.rb', line 48

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

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

Get the user’s list of watchers



65
66
67
68
69
70
# File 'lib/deviantart/client/user.rb', line 65

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

#search_friends(query, username: nil) ⇒ Object

Search friends by username



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

def search_friends(query, username: nil)
  params = {}
  params['query'] = query
  params['username'] = username unless username.nil?
  perform(DeviantArt::User::Friends::Search, :get, '/api/v1/oauth2/user/friends/search', params)
end

#whoamiObject

Fetch user info of authenticated user



35
36
37
# File 'lib/deviantart/client/user.rb', line 35

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

#whois(users) ⇒ Object

Fetch user info for given usernames



29
30
31
32
# File 'lib/deviantart/client/user.rb', line 29

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