Class: Gatleon::Rails::Authform::User
- Inherits:
-
Object
- Object
- Gatleon::Rails::Authform::User
- Defined in:
- lib/gatleon/rails/authform/user.rb
Constant Summary collapse
- PERMITTED_CHARS =
/\A[a-zA-Z0-9_)]*\z/
Instance Method Summary collapse
-
#[](key) ⇒ Object
Getters.
-
#[]=(key, value) ⇒ Object
Setters.
- #_email ⇒ Object
-
#_id ⇒ Object
Getters.
-
#initialize(json:, _form_secret_key:, _authform_base_url:) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(json:, _form_secret_key:, _authform_base_url:) ⇒ User
Returns a new instance of User.
7 8 9 10 11 12 |
# File 'lib/gatleon/rails/authform/user.rb', line 7 def initialize(json:, _form_secret_key:, _authform_base_url:) @json = json @_form_secret_key = _form_secret_key @_authform_base_url = _authform_base_url end |
Instance Method Details
#[](key) ⇒ Object
Getters
26 27 28 |
# File 'lib/gatleon/rails/authform/user.rb', line 26 def [](key) @json[key.to_s] end |
#[]=(key, value) ⇒ Object
Setters
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gatleon/rails/authform/user.rb', line 32 def []=(key, value) key = _clean_key(key) raise ArgumentError, "can't set reserved field name #{key}" if key[0] == "_" # anything starting with _ raise ArgumentError, "can't set empty field name" if key == "" raise ArgumentError, "only characters a-z, A-Z, 0-9, and _ permitted in field name" unless key.match?(PERMITTED_CHARS) @json[key] = value.to_s end |
#_email ⇒ Object
20 21 22 |
# File 'lib/gatleon/rails/authform/user.rb', line 20 def _email @json["_email"] end |
#_id ⇒ Object
Getters
16 17 18 |
# File 'lib/gatleon/rails/authform/user.rb', line 16 def _id @json["_id"] end |