class Etwin::Auth::AccessTokenAuthContext
Access token authentication context
Attributes
client[R]
scope[R]
user[R]
Public Class Methods
deserialize(raw)
click to toggle source
# File lib/etwin/auth/access_token_auth_context.rb, line 94 def deserialize(raw) scope = AuthScope.deserialize(raw['scope']) client = Etwin::Oauth::ShortOauthClient.deserialize(raw['client']) user = Etwin::User::ShortUser.deserialize(raw['user']) new(scope, client, user) end
from_json(json_str)
click to toggle source
# File lib/etwin/auth/access_token_auth_context.rb, line 89 def from_json(json_str) deserialize JSON.parse(json_str) end
new(scope, client, user)
click to toggle source
# File lib/etwin/auth/access_token_auth_context.rb, line 23 def initialize(scope, client, user) @scope = T.let(scope, AuthScope) @client = T.let(client, Etwin::Oauth::ShortOauthClient) @user = T.let(user, Etwin::User::ShortUser) freeze end
Public Instance Methods
==(other)
click to toggle source
# File lib/etwin/auth/access_token_auth_context.rb, line 31 def ==(other) case other when AccessTokenAuthContext @scope == other.scope && @client == other.client && @user == other.user else false end end
as_json()
click to toggle source
# File lib/etwin/auth/access_token_auth_context.rb, line 52 def as_json { 'scope' => @scope.serialize, 'client' => @client.as_json, 'user' => @user.as_json } end
hash()
click to toggle source
# File lib/etwin/auth/access_token_auth_context.rb, line 41 def hash [@scope, @client, @user].hash end
inspect()
click to toggle source
# File lib/etwin/auth/access_token_auth_context.rb, line 61 def inspect PP.singleline_pp(self, String.new) end
pretty_print(pp)
click to toggle source
# File lib/etwin/auth/access_token_auth_context.rb, line 66 def pretty_print(pp) # rubocop:disable Metrics/MethodLength pp.group(0, "#{self.class.name}(", ')') do pp.nest 1 do pp.breakable '' pp.text 'scope=' pp.pp @scope pp.text ',' pp.breakable '' pp.text 'client=' pp.pp @client pp.text ',' pp.breakable '' pp.text 'user=' pp.pp @user end pp.breakable '' end end
to_json(opts = nil)
click to toggle source
# File lib/etwin/auth/access_token_auth_context.rb, line 47 def to_json(opts = nil) JSON.generate(as_json, opts) end