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



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

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

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



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

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



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

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



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

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

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



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

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