class Zzlink::Session

User session.

Attributes

client_id[RW]
created_at[RW]
token[RW]
updated_at[RW]
user_id[RW]

Public Class Methods

new(attributes = {}) click to toggle source
# File lib/zzlink/session.rb, line 5
def initialize(attributes = {})
  from_hash(attributes)
end

Public Instance Methods

from_hash(attributes) click to toggle source
# 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() click to toggle source
# 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