Class: Zzlink::Session
- Inherits:
-
Object
- Object
- Zzlink::Session
- Defined in:
- lib/zzlink/session.rb
Overview
User session.
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#token ⇒ Object
Returns the value of attribute token.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
- #from_hash(attributes) ⇒ Object
-
#initialize(attributes = {}) ⇒ Session
constructor
A new instance of Session.
- #to_hash ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Session
Returns a new instance of Session.
5 6 7 |
# File 'lib/zzlink/session.rb', line 5 def initialize(attributes = {}) from_hash(attributes) end |
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
4 5 6 |
# File 'lib/zzlink/session.rb', line 4 def client_id @client_id end |
#created_at ⇒ Object
Returns the value of attribute created_at.
4 5 6 |
# File 'lib/zzlink/session.rb', line 4 def created_at @created_at end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/zzlink/session.rb', line 4 def token @token end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
4 5 6 |
# File 'lib/zzlink/session.rb', line 4 def updated_at @updated_at end |
#user_id ⇒ Object
Returns the value of attribute user_id.
4 5 6 |
# File 'lib/zzlink/session.rb', line 4 def user_id @user_id end |
Instance Method Details
#from_hash(attributes) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/zzlink/session.rb', line 9 def from_hash(attributes) attributes.each_key do |k| setter = case k.to_sym when :userId then :user_id= when :clientId then :client_id= when :createdAt then :created_at= when :updatedAt then :updated_at= else "#{k}=".to_sym end send(setter, attributes[k]) if respond_to?(setter) end end |
#to_hash ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/zzlink/session.rb', line 22 def to_hash hash = {} hash[:userId] = user_id unless user_id.nil? hash[:clientId] = client_id unless client_id.nil? hash[:token] = token unless token.nil? hash[:createdAt] = created_at unless created_at.nil? hash[:updatedAt] = updated_at unless updated_at.nil? hash end |