Sha256: 3cd9459272c87487460a2d3d10c2d4918cce9bfcb2f7f37f33cda841df1583af

Contents?: true

Size: 961 Bytes

Versions: 4

Compression:

Stored size: 961 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)
				::Arcadex::Destroy.destroy_token(token)
				return nil
			else
				return token
			end
		end

	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
arcadex-1.2.3 lib/arcadex/find.rb
arcadex-1.2.1 lib/arcadex/find.rb
arcadex-1.2.0 lib/arcadex/find.rb
arcadex-1.1.3 lib/arcadex/find.rb