Class: Zetto::Storage::Session::Data::Response
- Inherits:
-
Common::Response
- Object
- Hash
- Common::Response
- Zetto::Storage::Session::Data::Response
- Defined in:
- lib/zetto/storage/session/data/response.rb
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
readonly
Returns the value of attribute algorithm.
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#remote_ip ⇒ Object
readonly
Returns the value of attribute remote_ip.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
-
#time_live_s ⇒ Object
readonly
Returns the value of attribute time_live_s.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#initialize(data) ⇒ Response
constructor
A new instance of Response.
- #soon_rotten? ⇒ Boolean
- #user ⇒ Object
Constructor Details
#initialize(data) ⇒ Response
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/zetto/storage/session/data/response.rb', line 7 def initialize(data) @session_id = data["session_id"] @user_id = data["user_id"] @algorithm = data["algorithm"] @class_name = data["class_name"] @time_live_s = data["time_live_s"] @user_agent = data["user_agent"] @remote_ip = data["remote_ip"] self['session_id'] = data["session_id"] self['user_id'] = data["user_id"] self['algorithm'] = data["algorithm"] self['class_name'] = data["class_name"] self['time_live_s'] = data["time_live_s"] self['user_agent'] = data["user_agent"] self['remote_ip'] = data["remote_ip"] deep_freeze end |
Instance Attribute Details
#algorithm ⇒ Object (readonly)
Returns the value of attribute algorithm.
5 6 7 |
# File 'lib/zetto/storage/session/data/response.rb', line 5 def algorithm @algorithm end |
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
5 6 7 |
# File 'lib/zetto/storage/session/data/response.rb', line 5 def class_name @class_name end |
#remote_ip ⇒ Object (readonly)
Returns the value of attribute remote_ip.
5 6 7 |
# File 'lib/zetto/storage/session/data/response.rb', line 5 def remote_ip @remote_ip end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
5 6 7 |
# File 'lib/zetto/storage/session/data/response.rb', line 5 def session_id @session_id end |
#time_live_s ⇒ Object (readonly)
Returns the value of attribute time_live_s.
5 6 7 |
# File 'lib/zetto/storage/session/data/response.rb', line 5 def time_live_s @time_live_s end |
#user_agent ⇒ Object (readonly)
Returns the value of attribute user_agent.
5 6 7 |
# File 'lib/zetto/storage/session/data/response.rb', line 5 def user_agent @user_agent end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
5 6 7 |
# File 'lib/zetto/storage/session/data/response.rb', line 5 def user_id @user_id end |
Instance Method Details
#soon_rotten? ⇒ Boolean
31 32 33 34 35 36 |
# File 'lib/zetto/storage/session/data/response.rb', line 31 def soon_rotten? time_restart = Zetto::Config::Params.session_time_restart_min return false if time_restart <= 0 time_restart = time_restart * 60 self['time_live_s'] <= time_restart end |
#user ⇒ Object
27 28 29 |
# File 'lib/zetto/storage/session/data/response.rb', line 27 def user Zetto::Config::Params.user_class(@class_name).find_by(id: @user_id) end |