Class: Etwin::Auth::GuestAuthContext
- Inherits:
-
Object
- Object
- Etwin::Auth::GuestAuthContext
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/etwin/auth/guest_auth_context.rb
Overview
Guest authentication context
Instance Attribute Summary collapse
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #as_json ⇒ Object
- #hash ⇒ Object
-
#initialize(scope) ⇒ GuestAuthContext
constructor
A new instance of GuestAuthContext.
- #inspect ⇒ Object
- #to_json(opts = nil) ⇒ Object
Constructor Details
#initialize(scope) ⇒ GuestAuthContext
Returns a new instance of GuestAuthContext.
17 18 19 20 |
# File 'lib/etwin/auth/guest_auth_context.rb', line 17 def initialize(scope) @scope = T.let(scope, AuthScope) freeze end |
Instance Attribute Details
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
14 15 16 |
# File 'lib/etwin/auth/guest_auth_context.rb', line 14 def scope @scope end |
Class Method Details
.deserialize(raw) ⇒ Object
64 65 66 67 |
# File 'lib/etwin/auth/guest_auth_context.rb', line 64 def deserialize(raw) scope = AuthScope.deserialize(raw['scope']) new(scope) end |
.from_json(json_str) ⇒ Object
59 60 61 |
# File 'lib/etwin/auth/guest_auth_context.rb', line 59 def from_json(json_str) deserialize JSON.parse(json_str) end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/etwin/auth/guest_auth_context.rb', line 23 def ==(other) case other when GuestAuthContext @scope == other.scope else false end end |
#as_json ⇒ Object
44 45 46 47 48 |
# File 'lib/etwin/auth/guest_auth_context.rb', line 44 def as_json { 'scope' => @scope.serialize } end |
#hash ⇒ Object
33 34 35 |
# File 'lib/etwin/auth/guest_auth_context.rb', line 33 def hash [@scope].hash end |
#inspect ⇒ Object
51 52 53 |
# File 'lib/etwin/auth/guest_auth_context.rb', line 51 def inspect "GuestAuthContext(scope=#{@scope.inspect})" end |
#to_json(opts = nil) ⇒ Object
39 40 41 |
# File 'lib/etwin/auth/guest_auth_context.rb', line 39 def to_json(opts = nil) JSON.generate(as_json, opts) end |