Class: Trailblazer::Pro::Session
- Inherits:
-
Struct
- Object
- Struct
- Trailblazer::Pro::Session
- Defined in:
- lib/trailblazer/pro/session.rb
Overview
DISCUSS: do we want #id_token here explicitely? Data structure to hold all data values necessary to keep an authenticated session with Firebase.
Defined Under Namespace
Classes: Uninitialized
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#firebase_refresh_url ⇒ Object
Returns the value of attribute firebase_refresh_url.
-
#firebase_signin_url ⇒ Object
Returns the value of attribute firebase_signin_url.
-
#firebase_upload_url ⇒ Object
Returns the value of attribute firebase_upload_url.
-
#firestore_fields_template ⇒ Object
Returns the value of attribute firestore_fields_template.
-
#id_token ⇒ Object
Returns the value of attribute id_token.
-
#jwt_token_exp ⇒ Object
Returns the value of attribute jwt_token_exp.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#session ⇒ Object
Returns the value of attribute session.
-
#trace_guards ⇒ Object
Returns the value of attribute trace_guards.
-
#trailblazer_pro_host ⇒ Object
Returns the value of attribute trailblazer_pro_host.
-
#wtf_present_options ⇒ Object
Returns the value of attribute wtf_present_options.
Class Method Summary collapse
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def api_key @api_key end |
#expires_at ⇒ Object
Returns the value of attribute expires_at
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def expires_at @expires_at end |
#firebase_refresh_url ⇒ Object
Returns the value of attribute firebase_refresh_url
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def firebase_refresh_url @firebase_refresh_url end |
#firebase_signin_url ⇒ Object
Returns the value of attribute firebase_signin_url
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def firebase_signin_url @firebase_signin_url end |
#firebase_upload_url ⇒ Object
Returns the value of attribute firebase_upload_url
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def firebase_upload_url @firebase_upload_url end |
#firestore_fields_template ⇒ Object
Returns the value of attribute firestore_fields_template
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def firestore_fields_template @firestore_fields_template end |
#id_token ⇒ Object
Returns the value of attribute id_token
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def id_token @id_token end |
#jwt_token_exp ⇒ Object
Returns the value of attribute jwt_token_exp
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def jwt_token_exp @jwt_token_exp end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def refresh_token @refresh_token end |
#session ⇒ Object
Returns the value of attribute session.
8 9 10 |
# File 'lib/trailblazer/pro/session.rb', line 8 def session @session end |
#trace_guards ⇒ Object
Returns the value of attribute trace_guards.
9 10 11 |
# File 'lib/trailblazer/pro/session.rb', line 9 def trace_guards @trace_guards end |
#trailblazer_pro_host ⇒ Object
Returns the value of attribute trailblazer_pro_host
6 7 8 |
# File 'lib/trailblazer/pro/session.rb', line 6 def trailblazer_pro_host @trailblazer_pro_host end |
#wtf_present_options ⇒ Object
Returns the value of attribute wtf_present_options.
7 8 9 |
# File 'lib/trailblazer/pro/session.rb', line 7 def @wtf_present_options end |
Class Method Details
.deserialize(json) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/trailblazer/pro/session.rb', line 24 def self.deserialize(json) data = JSON.parse(json) = data.key?("jwt_token_exp") ? {expires_at: Trace.parse_exp(data["jwt_token_exp"])} : {} data .merge() # TODO: use representer .collect { |k, v| [k.to_sym, v] } .to_h end |
.serialize(session) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/trailblazer/pro/session.rb', line 17 def self.serialize(session) attributes = session.to_h attributes = attributes.slice(*(attributes.keys - [:expires_at])) JSON.dump(attributes) end |