Sha256: e91b091b2b04b1a12c374ca1577440e6c63ff89a14470ba5e3c4709334969141
Contents?: true
Size: 625 Bytes
Versions: 1
Compression:
Stored size: 625 Bytes
Contents
module IdentityClient class AccessGrant < ActiveRecord::Base attr_accessible :access_token, :expires_at, :user_id belongs_to :user def self.create_or_update_by_user_and_credentials(user, credentials) attributes = { access_token: credentials['token'], expires_at: Time.at(credentials['expires_at']) } if (grant = AccessGrant.by_user(user)) grant.update_attributes(attributes) else grant = user.create_access_grant(attributes) end grant end def self.by_user(user) AccessGrant.where(user_id: user.id).first end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
identity_client-0.1.3 | app/models/identity_client/access_grant.rb |