Sha256: 7bacfdc1bd2dfa811227de84405f3ae1bee70eaa9473faff9c2365c58f245913

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

module Arcadex
	module Find

		#Arcadex.find_owner_by_auth_token(auth_token)
		def self.find_owner_by_auth_token(auth_token)
			token = ::Arcadex::Find.find_token_by_auth_token(auth_token)
			return ::Arcadex::Find.find_owner_by_token(token)
		end

		#Arcadex.find_owner_by_token(token)
		def self.find_owner_by_token(token)
			if token.nil?
				return nil
			end
			if ::Arcadex::Destroy.token_expired?(token)
				::Arcadex::Destroy.destroy_token(token)
				return nil
			else
				#instance = ::Object.const_get(token.imageable_type).find(token.imageable_id)
				instance = ::Object.const_get(token.imageable_type).fetch(token.imageable_id)
				return instance
			end
		end

		#Arcadex.find_token_by_auth_token(token.auth_token)
		def self.find_token_by_auth_token(auth_token_string)
			#token = ::Arcadex::Token.find_by(auth_token: auth_token_string)
			token = ::Arcadex::Token.fetch_by_auth_token(auth_token_string)
			if token.nil?
				return nil
			end
			if ::Arcadex::Destroy.token_expired?(token)
				::Arcadex::Destroy.destroy_token(token)
				return nil
			else
				return token
			end
		end

	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arcadex-1.3.1 lib/arcadex/find.rb
arcadex-1.3.0 lib/arcadex/find.rb