Class: CanvasFactory::UserConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/japanda/canvas_factory/user_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ UserConfig



6
7
8
9
10
11
12
13
14
15
# File 'lib/japanda/canvas_factory/user_config.rb', line 6

def initialize(opts = {})
  @email_prefix = opts[:email_prefix] || 'catauto'
  @password = opts[:password] || 'Testing01'
  @short_name = opts[:short_name] || 'cat auto'
  @terms_of_use = opts[:terms_of_use] || '1'
  @send_confirmation = opts[:send_confirmation] || true
  @force_validations = opts[:force_validations] || true
  @role_id = opts[:role_id] || 'AccountAdmin'
  @email_id = opts[:email_id] || "#{@email_prefix}#{SecureRandom.hex}@example.com"
end

Instance Attribute Details

#email_idObject

Returns the value of attribute email_id.



3
4
5
# File 'lib/japanda/canvas_factory/user_config.rb', line 3

def email_id
  @email_id
end

#email_prefixObject

Returns the value of attribute email_prefix.



3
4
5
# File 'lib/japanda/canvas_factory/user_config.rb', line 3

def email_prefix
  @email_prefix
end

#force_validationsObject

Returns the value of attribute force_validations.



3
4
5
# File 'lib/japanda/canvas_factory/user_config.rb', line 3

def force_validations
  @force_validations
end

#passwordObject

Returns the value of attribute password.



3
4
5
# File 'lib/japanda/canvas_factory/user_config.rb', line 3

def password
  @password
end

#role_idObject

Returns the value of attribute role_id.



3
4
5
# File 'lib/japanda/canvas_factory/user_config.rb', line 3

def role_id
  @role_id
end

#send_confirmationObject

Returns the value of attribute send_confirmation.



3
4
5
# File 'lib/japanda/canvas_factory/user_config.rb', line 3

def send_confirmation
  @send_confirmation
end

#short_nameObject

Returns the value of attribute short_name.



3
4
5
# File 'lib/japanda/canvas_factory/user_config.rb', line 3

def short_name
  @short_name
end

#terms_of_useObject

Returns the value of attribute terms_of_use.



3
4
5
# File 'lib/japanda/canvas_factory/user_config.rb', line 3

def terms_of_use
  @terms_of_use
end

Instance Method Details

#admin_request_body(id) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/japanda/canvas_factory/user_config.rb', line 33

def admin_request_body(id)
  {
    user_id: id,
    role_id: @role_id,
    send_confirmation: @send_confirmation
  }
end

#user_request_bodyObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/japanda/canvas_factory/user_config.rb', line 17

def user_request_body
  {
    user: {
      name: @email_id,
      short_name: @short_name,
      terms_of_use: @terms_of_use,
      send_confirmation: @send_confirmation
    },
    pseudonym: {
      unique_id: @email_id,
      password: @password
    },
    force_validations: @force_validations
  }
end