Module: Arcadex::Find

Defined in:
lib/arcadex/find.rb

Class Method Summary collapse

Class Method Details

.find_owner_by_auth_token(auth_token) ⇒ Object

Arcadex.find_owner_by_auth_token(auth_token)



5
6
7
8
# File 'lib/arcadex/find.rb', line 5

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

.find_owner_by_token(token) ⇒ Object

Arcadex.find_owner_by_token(token)



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/arcadex/find.rb', line 11

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

.find_token_by_auth_token(auth_token_string) ⇒ Object

Arcadex.find_token_by_auth_token(token.auth_token)



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/arcadex/find.rb', line 26

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