Sha256: 4c00e5b35b7ea6d9bc2595b3bf1efe5e2c35126f6a2ed0e953829311a7d80006

Contents?: true

Size: 962 Bytes

Versions: 3

Compression:

Stored size: 962 Bytes

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)
				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)
			if token.nil?
				return nil
			end
			if ::Arcadex::Destroy.token_expired?(token)
				::Arcardex::Destroy.destroy_token(token)
				return nil
			else
				return token
			end
		end

	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arcadex-1.1.2 lib/arcadex/find.rb
arcadex-1.1.1 lib/arcadex/find.rb
arcadex-1.1.0 lib/arcadex/find.rb