Class: Ralyxa::RequestEntities::User
- Inherits:
-
Object
- Object
- Ralyxa::RequestEntities::User
- Defined in:
- lib/ralyxa/request_entities/user.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
- #access_token_exists? ⇒ Boolean
-
#initialize(id:, access_token: nil) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(id:, access_token: nil) ⇒ User
Returns a new instance of User.
6 7 8 9 |
# File 'lib/ralyxa/request_entities/user.rb', line 6 def initialize(id:, access_token: nil) @id = id @access_token = access_token end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/ralyxa/request_entities/user.rb', line 4 def access_token @access_token end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/ralyxa/request_entities/user.rb', line 4 def id @id end |
Class Method Details
.build(request) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/ralyxa/request_entities/user.rb', line 11 def self.build(request) user_hash = request.dig('session', 'user') || request.dig('context', 'System', 'user') || {} new( id: user_hash['userId'], access_token: user_hash['accessToken'] ) end |
Instance Method Details
#access_token_exists? ⇒ Boolean
20 21 22 |
# File 'lib/ralyxa/request_entities/user.rb', line 20 def access_token_exists? !@access_token.nil? end |