Class: CanvasFactory::User
- Inherits:
-
Object
- Object
- CanvasFactory::User
- Defined in:
- lib/japanda/canvas_factory/user.rb
Instance Attribute Summary collapse
-
#user_config ⇒ Object
readonly
Returns the value of attribute user_config.
-
#user_password ⇒ Object
readonly
Returns the value of attribute user_password.
-
#user_response ⇒ Object
readonly
Returns the value of attribute user_response.
-
#user_response_email_id ⇒ Object
readonly
Returns the value of attribute user_response_email_id.
-
#user_response_id ⇒ Object
readonly
Returns the value of attribute user_response_id.
-
#user_short_name ⇒ Object
readonly
Returns the value of attribute user_short_name.
Instance Method Summary collapse
- #create_admin_user ⇒ Object
- #create_learner_user ⇒ Object
-
#initialize(user_config = CanvasFactory::UserConfig.new) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(user_config = CanvasFactory::UserConfig.new) ⇒ User
Returns a new instance of User.
7 8 9 |
# File 'lib/japanda/canvas_factory/user.rb', line 7 def initialize(user_config = CanvasFactory::UserConfig.new) @user_config = user_config end |
Instance Attribute Details
#user_config ⇒ Object (readonly)
Returns the value of attribute user_config.
4 5 6 |
# File 'lib/japanda/canvas_factory/user.rb', line 4 def user_config @user_config end |
#user_password ⇒ Object (readonly)
Returns the value of attribute user_password.
4 5 6 |
# File 'lib/japanda/canvas_factory/user.rb', line 4 def user_password @user_password end |
#user_response ⇒ Object (readonly)
Returns the value of attribute user_response.
4 5 6 |
# File 'lib/japanda/canvas_factory/user.rb', line 4 def user_response @user_response end |
#user_response_email_id ⇒ Object (readonly)
Returns the value of attribute user_response_email_id.
4 5 6 |
# File 'lib/japanda/canvas_factory/user.rb', line 4 def user_response_email_id @user_response_email_id end |
#user_response_id ⇒ Object (readonly)
Returns the value of attribute user_response_id.
4 5 6 |
# File 'lib/japanda/canvas_factory/user.rb', line 4 def user_response_id @user_response_id end |
#user_short_name ⇒ Object (readonly)
Returns the value of attribute user_short_name.
4 5 6 |
# File 'lib/japanda/canvas_factory/user.rb', line 4 def user_short_name @user_short_name end |
Instance Method Details
#create_admin_user ⇒ Object
20 21 22 23 24 25 |
# File 'lib/japanda/canvas_factory/user.rb', line 20 def create_admin_user create_learner_user body = @user_config.admin_request_body(@user_response['id'].to_i) admin_end_point = "#{CANVAS_API_V1}/accounts/#{CANVAS_ACCOUNT_ID}/admins" CanvasFactory.perform_post(admin_end_point, body) end |
#create_learner_user ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/japanda/canvas_factory/user.rb', line 11 def create_learner_user user_end_point = "#{CANVAS_API_V1}/accounts/#{CANVAS_ACCOUNT_ID}/users" @user_response = CanvasFactory.perform_post(user_end_point, @user_config.user_request_body) @user_response_id = @user_response['id'] @user_response_email_id = @user_response['login_id'] @user_short_name = @user_config.short_name @user_password = @user_config.password end |