Class: TinyGate::TestHelper::User
- Inherits:
-
Object
- Object
- TinyGate::TestHelper::User
- Defined in:
- lib/tiny_gate/test_helper/user.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #add_permission(permission_id, role_id, role_name, organization_id, organization_name = nil, app_id = nil) ⇒ Object
- #data ⇒ Object
-
#initialize(id, email, password, first_name = 'First', last_name = 'Last') ⇒ User
constructor
A new instance of User.
- #sign_in(organization_id = nil) ⇒ Object
Constructor Details
#initialize(id, email, password, first_name = 'First', last_name = 'Last') ⇒ User
Returns a new instance of User.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/tiny_gate/test_helper/user.rb', line 6 def initialize(id, email, password, first_name = 'First', last_name = 'Last') @id = id @email = email @password = password @first_name = first_name @last_name = last_name @token = SecureRandom.hex = Set.new @current_organization_id = nil end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
4 5 6 |
# File 'lib/tiny_gate/test_helper/user.rb', line 4 def email @email end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
4 5 6 |
# File 'lib/tiny_gate/test_helper/user.rb', line 4 def first_name @first_name end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/tiny_gate/test_helper/user.rb', line 4 def id @id end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
4 5 6 |
# File 'lib/tiny_gate/test_helper/user.rb', line 4 def last_name @last_name end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
4 5 6 |
# File 'lib/tiny_gate/test_helper/user.rb', line 4 def password @password end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
4 5 6 |
# File 'lib/tiny_gate/test_helper/user.rb', line 4 def token @token end |
Instance Method Details
#add_permission(permission_id, role_id, role_name, organization_id, organization_name = nil, app_id = nil) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/tiny_gate/test_helper/user.rb', line 21 def (, role_id, role_name, organization_id, organization_name = nil, app_id = nil) << OpenStruct.new( id: , role_id: role_id, role_name: role_name, organization_id: organization_id, organization_name: organization_name, app_id: app_id ) end |
#data ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/tiny_gate/test_helper/user.rb', line 32 def data { id: id, email: email, token: token, first_name: first_name, last_name: last_name, current_permission: , active_permissions: } end |
#sign_in(organization_id = nil) ⇒ Object
17 18 19 |
# File 'lib/tiny_gate/test_helper/user.rb', line 17 def sign_in(organization_id = nil) @current_organization_id = organization_id end |