module DeviantArt::Client::User

Public Instance Methods

damntoken() click to toggle source

Retrieve the dAmn auth token required to connect to the dAmn servers

# File lib/deviantart/client/user.rb, line 118
def damntoken
  perform(DeviantArt::User::DamnToken, :get, '/api/v1/oauth2/user/damntoken?')
end
get_friends(username, offset: 0, limit: 10) click to toggle source

Get the users list of friends

# File lib/deviantart/client/user.rb, line 42
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) click to toggle source

Get user profile information

# File lib/deviantart/client/user.rb, line 20
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) click to toggle source

Fetch the status

# File lib/deviantart/client/user.rb, line 79
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) click to toggle source

User Statuses

# File lib/deviantart/client/user.rb, line 69
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) click to toggle source

Get the user's list of watchers

# File lib/deviantart/client/user.rb, line 86
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) click to toggle source

Search friends by username

# File lib/deviantart/client/user.rb, line 61
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
unwatch(username) click to toggle source

Unwatch a user

# File lib/deviantart/client/user.rb, line 113
def unwatch(username)
  perform(DeviantArt::User::Friends::Unwatch, :get, "/api/v1/oauth2/user/friends/unwatch/#{username.nil? ? '' : username}")
end
update_profile(user_is_artist: nil, artist_level: nil, artist_specialty: nil, real_name: nil, tagline: nil, countryid: nil, website: nil, bio: nil) click to toggle source

Update the users profile information

# File lib/deviantart/client/user.rb, line 28
def update_profile(user_is_artist: nil, artist_level: nil, artist_specialty: nil, real_name: nil,  tagline: nil, countryid: nil, website: nil, bio: nil)
  params = {}
  params['user_is_artist'] = user_is_artist if user_is_artist
  params['artist_level'] = artist_level if artist_level
  params['artist_specialty'] = artist_specialty if artist_specialty
  params['real_name'] = real_name if real_name
  params['tagline'] = tagline if tagline
  params['countryid'] = countryid if countryid
  params['website'] = website if website
  params['bio'] = bio if bio
  perform(DeviantArt::User::UpdateProfile, :post, '/api/v1/oauth2/user/profile/update', params)
end
watch(username, watch = {}) click to toggle source

Watch a user

# File lib/deviantart/client/user.rb, line 99
def watch(username, watch = {})
  watch_params = {}
  %w(friend deviations journals forum_threads critiques scraps activity collections).each do |p|
    if watch[p]
      watch_params[p] = true
    else
      watch_params[p] = false
    end
  end
  params = { watch: watch_params }
  perform(DeviantArt::User::Friends::Watch, :post, "/api/v1/oauth2/user/friends/watch/#{username.nil? ? '' : username}", params)
end
watch_status(username) click to toggle source

Check if user is being watched by the given user

# File lib/deviantart/client/user.rb, line 94
def watch_status(username)
  perform(DeviantArt::User::Friends::Watching, :get, "/api/v1/oauth2/user/friends/watching/#{username.nil? ? '' : username}")
end
whoami() click to toggle source

Fetch user info of authenticated user

# File lib/deviantart/client/user.rb, line 56
def whoami
  perform(DeviantArt::User, :get, '/api/v1/oauth2/user/whoami?')
end
whois(users) click to toggle source

Fetch user info for given usernames

# File lib/deviantart/client/user.rb, line 50
def whois(users)
  params = { usernames: users.is_a?(Enumerable) ? users : [users] }
  perform(DeviantArt::User::Whois, :post, '/api/v1/oauth2/user/whois', params)
end