Class: Auth::Client

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, MongoidVersionedAtomic::VAtomic
Defined in:
app/models/auth/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#add_app_idObject

Returns the value of attribute add_app_id.



22
23
24
# File 'app/models/auth/client.rb', line 22

def add_app_id
  @add_app_id
end

#add_redirect_urlObject

Returns the value of attribute add_redirect_url.



23
24
25
# File 'app/models/auth/client.rb', line 23

def add_redirect_url
  @add_redirect_url
end

Class Method Details

.find(input) ⇒ Object



12
13
14
# File 'app/models/auth/client.rb', line 12

def self.find(input)
	Client.where(:resource_id => input).first
end

.find_valid_api_key(api_key) ⇒ Object



30
31
32
33
# File 'app/models/auth/client.rb', line 30

def self.find_valid_api_key(api_key)
    c =  self.find(:api_key => api_key)
    return c
end

.find_valid_api_key_and_app_id(api_key, app_id) ⇒ Object

USED IN DEVISE.RB -> SET_CLIENT USED IN OMNIAUTH.RB -> CHECK_STATE



37
38
39
40
41
42
43
# File 'app/models/auth/client.rb', line 37

def self.find_valid_api_key_and_app_id(api_key,app_id)
    c = self.where(:api_key => api_key, :app_ids => app_id).first
    if c
        c.current_app_id = app_id
    end
    return c
end

Instance Method Details

#contains_redirect_url?(url) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/models/auth/client.rb', line 26

def contains_redirect_url?(url)
    return self.redirect_urls.include? url
end

#there_are_redirect_urlsObject



45
46
47
# File 'app/models/auth/client.rb', line 45

def there_are_redirect_urls
    return self.redirect_urls && self.redirect_urls.size > 0
end

#to_paramObject



8
9
10
# File 'app/models/auth/client.rb', line 8

def to_param
	resource_id
end