Module: Bearcat::Client::Users

Extended by:
ClientModule
Defined in:
lib/bearcat/client/users.rb

Constant Summary

Constants included from ClientModule

ClientModule::ARG_REGEX

Instance Attribute Summary

Attributes included from ClientModule

#_registered_endpoints

Instance Method Summary collapse

Methods included from ClientModule

context_types, endpoint, prefix

Instance Method Details

#delete_custom_data(user, params, scope = '') ⇒ Object

scope: food params: ‘com.account-domain.canvas-app’ deletes all custom user data for the food scope. If no scope deletes all custom user data



52
53
54
# File 'lib/bearcat/client/users.rb', line 52

def delete_custom_data(user, params, scope = '')
  delete("/api/v1/users/#{user}/custom_data/#{scope}", params)
end

#favorite_courses(user, params = {}) ⇒ Object



56
57
58
59
# File 'lib/bearcat/client/users.rb', line 56

def favorite_courses(user, params = {})
  params.merge!({as_user_id: user})
  get("/api/v1/users/self/favorites/courses", params)
end

#load_custom_data(user, params, scope = '') ⇒ Object

scope: food params: ‘com.account-domain.canvas-app’ returns all custom user food scope data. If no scope returns all custom user data



37
38
39
# File 'lib/bearcat/client/users.rb', line 37

def load_custom_data(user, params, scope = '')
  get("/api/v1/users/#{user}/custom_data/#{scope}", params)
end

#store_custom_data(user, params, scope = '') ⇒ Object

scope: food params: ‘com.account-domain.canvas-app’,

data: {'favorite' => 'steak', 'least favorite' => 'water mellon'}

stores custom data in the food scope



45
46
47
# File 'lib/bearcat/client/users.rb', line 45

def store_custom_data(user, params, scope = '')
  put("/api/v1/users/#{user}/custom_data/#{scope}", params)
end

#unfavorite_course(user, course, params = {}) ⇒ Object



61
62
63
64
# File 'lib/bearcat/client/users.rb', line 61

def unfavorite_course(user, course, params = {})
  params.merge!({as_user_id: user})
  delete("/api/v1/users/self/favorites/courses/#{course}", params)
end